Docs: make nav sidebar work

This commit is contained in:
Aldo Cortesi 2013-01-01 15:30:02 +13:00
parent 8b66681929
commit 6f1fa30bc6
2 changed files with 40 additions and 31 deletions

View File

@ -19,42 +19,42 @@
<ul class="nav nav-list">
<li><a href="@!urlTo("intro.html")!@">Introduction</a></li>
<li><a href="@!urlTo("install.html")!@">Installation</a></li>
<li><a href="@!urlTo("mitmproxy.html")!@">mitmproxy</a></li>
<li><a href="@!urlTo("mitmdump.html")!@">mitmdump</a></li>
<li><a href="@!urlTo("faq.html")!@">FAQ</a></li>
$!nav("intro.html", this, state)!$
$!nav("install.html", this, state)!$
$!nav("mitmproxy.html", this, state)!$
$!nav("mitmdump.html", this, state)!$
$!nav("faq.html", this, state)!$
<li class="nav-header">Features</li>
<li><a href="@!urlTo("clientreplay.html")!@">Client-side replay</a></li>
<li><a href="@!urlTo("serverreplay.html")!@">Server-side replay</a></li>
<li><a href="@!urlTo("sticky.html")!@">Sticky cookies and auth</a></li>
<li><a href="@!urlTo("reverseproxy.html")!@">Reverse proxy mode</a></li>
<li><a href="@!urlTo("upstreamcerts.html")!@">Upstream Certs</a></li>
<li><a href="@!urlTo("replacements.html")!@">Replacements</a></li>
<li><a href="@!urlTo("anticache.html")!@">Anticache</a></li>
<li><a href="@!urlTo("filters.html")!@">Filter expressions</a></li>
<li class="nav-header">Scripting mitmproxy</li>
<li><a href="@!urlTo("scripting/inlinescripts.html")!@">Inline Scripts</a></li>
<li><a href="@!urlTo("scripting/libmproxy.html")!@">libmproxy</a></li>
$!nav("clientreplay.html", this, state)!$
$!nav("serverreplay.html", this, state)!$
$!nav("sticky.html", this, state)!$
$!nav("reverseproxy.html", this, state)!$
$!nav("upstreamcerts.html", this, state)!$
$!nav("replacements.html", this, state)!$
$!nav("anticache.html", this, state)!$
$!nav("filters.html", this, state)!$
<li class="nav-header">SSL interception</li>
<li><a href="@!urlTo("ssl.html")!@">Overview</a></li>
<li><a href="@!urlTo("certinstall/firefox.html")!@">Firefox</a></li>
<li><a href="@!urlTo("certinstall/osx.html")!@">OSX</a></li>
<li><a href="@!urlTo("certinstall/windows7.html")!@">Windows 7</a></li>
<li><a href="@!urlTo("certinstall/ios.html")!@">iPhone/iPad</a></li>
<li><a href="@!urlTo("certinstall/android.html")!@">Android</a></li>
$!nav("ssl.html", this, state)!$
$!nav("certinstall/firefox.html", this, state)!$
$!nav("certinstall/osx.html", this, state)!$
$!nav("certinstall/windows7.html", this, state)!$
$!nav("certinstall/ios.html", this, state)!$
$!nav("certinstall/android.html", this, state)!$
<li class="nav-header">Transparent Proxying</li>
<li><a href="@!urlTo("transparent.html")!@">Overview</a></li>
<li><a href="@!urlTo("transparent/linux.html")!@">Linux</a></li>
<li><a href="@!urlTo("transparent/osx.html")!@">OSX</a></li>
$!nav("transparent.html", this, state)!$
$!nav("transparent/linux.html", this, state)!$
$!nav("transparent/osx.html", this, state)!$
<li class="nav-header">Tutorials</li>
<li> <a href="@!urlTo("tutorials/30second.html")!@">Client replay: a 30 second example</a> </li>
<li> <a href="@!urlTo("tutorials/gamecenter.html")!@">Setting highscores on Apple's GameCenter</a> </li>
$!nav("tutorials/30second.html", this, state)!$
$!nav("tutorials/gamecenter.html", this, state)!$
<li class="nav-header">Scripting mitmproxy</li>
$!nav("scripting/inlinescripts.html", this, state)!$
$!nav("scripting/libmproxy.html", this, state)!$
</ul>

View File

@ -1,6 +1,6 @@
import os, sys
import countershape
from countershape import Page, Directory, PythonModule, markup
from countershape import Page, Directory, PythonModule, markup, model
import countershape.template
sys.path.insert(0, "..")
from libmproxy import filt
@ -64,6 +64,15 @@ filt_help.extend(
ns.filt_help = filt_help
def nav(page, current, state):
if current.match(page, False):
pre = '<li class="active">'
else:
pre = "<li>"
p = state.application.getPage(page)
return pre + '<a href="%s">%s</a></li>'%(model.UrlTo(page), p.title)
ns.nav = nav
pages = [
Page("index.html", "docs"),
@ -79,8 +88,8 @@ pages = [
Page("reverseproxy.html", "Reverse proxy mode"),
Page("anticache.html", "Anticache"),
Page("filters.html", "Filter expressions"),
Page("ssl.html", "Setting up SSL interception"),
Page("transparent.html", "Transparent Proxying"),
Page("ssl.html", "SSL Overview"),
Page("transparent.html", "Transparent Overview"),
Directory("certinstall"),
Directory("scripting"),
Directory("tutorials"),