From 30f0c5929254571b6fd2cd36ead67ce90ecf17ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Wed, 7 Apr 2010 22:11:54 +0200 Subject: Removed the javascript toc and replaced it by a mako-solution --- static/css/style.css | 8 ++------ static/js/toc.js | 30 ------------------------------ templates/page.mako | 36 ++++++++++++++++-------------------- templates/pages/development.mako | 10 +++++----- templates/pages/translating.mako | 10 +++++----- 5 files changed, 28 insertions(+), 66 deletions(-) delete mode 100644 static/js/toc.js diff --git a/static/css/style.css b/static/css/style.css index 26900e0..caa829d 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -234,14 +234,10 @@ img.right { /* Table of contents */ -#tocheader { - display: none; +ul#toc { } -#innertoc { -} - -#tocLink { +.tocLink { } /* Footer */ diff --git a/static/js/toc.js b/static/js/toc.js deleted file mode 100644 index 5ef8545..0000000 --- a/static/js/toc.js +++ /dev/null @@ -1,30 +0,0 @@ -function createToc(pages) { - var tdiv = document.getElementById('toc'); - if (tdiv) { - var header = tdiv.appendChild(document.createElement('span')); - // header.onclick = showhideToc; - header.id = 'tocheader'; - header.innerHTML = 'Contents'; - - var tul = tdiv.appendChild(document.createElement('ul')); - tul.id = 'innertoc'; - - for (key in pages) { - var link = tul.appendChild(document.createElement('li')).appendChild(document.createElement('a')); - link.innerHTML = pages[key]; - link.className = 'tocLink'; - link.href = '#' + key; - } - - // showhideToc(); - } -} - -var TocState = 'none'; - -function showhideToc() { - TocState = (TocState == 'none') ? 'block' : 'none'; - var newText = (TocState == 'none') ? 'show page contents' : 'hide page contents'; - document.getElementById('tocheader').innerHTML = newText; - document.getElementById('innertoc').style.display = TocState; -} diff --git a/templates/page.mako b/templates/page.mako index 4670764..625a05c 100644 --- a/templates/page.mako +++ b/templates/page.mako @@ -2,25 +2,23 @@ title = "" uses_toc = False %> +<% + page_text = capture(next.body) +%> <%inherit file="/root.mako" /> -

${self.attr.title}

-${next.body()} +## content +

${self.attr.title}

% if self.attr.uses_toc: - + ${self.preface()} + ${self.toc()} % endif +${page_text} -<%def name="style()"> - ${parent.style()} - % if self.attr.uses_toc: - - % endif - +## functions <%def name="h2()"> <% @@ -38,13 +36,11 @@ ${next.body()} <%def name="toc()"> -
- -
- + + +<%def name="preface()"> diff --git a/templates/pages/development.mako b/templates/pages/development.mako index dfc6200..7e42326 100644 --- a/templates/pages/development.mako +++ b/templates/pages/development.mako @@ -3,11 +3,11 @@ uses_toc = True %> <%inherit file="/page.mako" /> -

- If you want to have a look at the sourcecode, or even support the development with patches or similar, you are now on the correct page :). -

- -${self.toc()} +<%def name="preface()"> +

+ If you want to have a look at the sourcecode, or even support the development with patches or similar, you are now on the correct page :). +

+ <%self:h2>Getting the source

diff --git a/templates/pages/translating.mako b/templates/pages/translating.mako index 811ff41..8abe9a5 100644 --- a/templates/pages/translating.mako +++ b/templates/pages/translating.mako @@ -4,11 +4,11 @@ %> <%inherit file="/page.mako" /> -

- Portato supports native languages. Nevertheless the translations into these languages have to be created. This page shows how to add a new translation or how to extend an existing translation. -

- -${self.toc()} +<%def name="preface()"> +

+ Portato supports native languages. Nevertheless the translations into these languages have to be created. This page shows how to add a new translation or how to extend an existing translation. +

+ <%self:h2>Short introduction about NLS in Linux

-- cgit v1.2.3