generate in-page TOCs on demand

This commit is contained in:
Mark Pilgrim
2009-03-19 01:42:12 -04:00
parent cfeee5d73d
commit 3b9c6c67e9
8 changed files with 29 additions and 189 deletions
+1 -21
View File
@@ -14,27 +14,7 @@ th{font-family:inherit !important}
<blockquote class=q>
<p><span>&#x275D;</span> Don&#8217;t bury your burden in saintly silence. You have a problem? Great. Rejoice, dive in, and investigate. <span>&#x275E;</span><br>&mdash; <cite>Ven. Henepola Gunararatana</cite>
</blockquote>
<ol>
<li><a href=#divingin>Diving in</a>
<li><a href=#declaringfunctions>Declaring functions</a>
<ol>
<li><a href=#datatypes>How Python's datatypes compare to other programming languages</a>
</ol>
<li><a href=#readability>Writing readable code</a>
<ol>
<li><a href=#docstrings>Docstrings</a>
<li><a href=#functionannotations>Function annotations</a>
<li><a href=#styleconventions>Style conventions</a>
</ol>
<li><a href=#everythingisanobject>Everything is an object</a>
<ol>
<li><a href=#importsearchpath>The <code>import</code> search path</a>
<li><a href=#whatsanobject>What's an object?</a>
</ol>
<li><a href=#indentingcode>Indenting code</a>
<li><a href=#runningscripts>Running scripts</a>
<li><a href=#furtherreading>Further reading</a>
</ol>
<p id=toc>&nbsp;
<h2 id=divingin>Diving in</h2>
<p class=f>Books about programming usually start with a bunch of boring chapters about fundamentals and eventually work up to building something useful. Let's skip all that. Here is a complete, working Python program. It probably makes absolutely no sense to you. Don't worry about that, because you're going to dissect it line by line. But read through it first and see what, if anything, you can make of it.
<p id=noscript>[The code examples will be easier to follow if you enable Javascript, but whatever.]