From: Nick Fitzgerald Date: Fri, 9 Jul 2010 18:50:49 +0000 (-0700) Subject: Regenerating documentation X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=refs%2Fheads%2Fgh-pages;p=pycco.git Regenerating documentation --- diff --git a/index.html b/index.html index 9f05b77..88b78de 100644 --- a/index.html +++ b/index.html @@ -188,6 +188,16 @@ found in resources/pycco.html

#
+

This module contains all of our static resources.

+ + +
import pycco_resources
+ + + +
+ # +

Import our external dependencies.

@@ -200,10 +210,10 @@ found in resources/pycco.html

from pygments import lexers, formatters from subprocess import Popen, PIPE - +
- # + #

A list of the languages that Pycco supports, mapping the file extension to the name of the Pygments lexer and the symbol that indicates a comment. To @@ -219,30 +229,30 @@ add another language to Pycco's repertoire, add it here.

".lua": { "name": "lua", "symbol": "--" }, } - +
- # + #

Build out the appropriate matchers and delimiters for each language.

for ext, l in languages.items():
- +
- # + #

Does the line begin with a comment?

    l["comment_matcher"] = re.compile(r"^\s*" + l["symbol"] + "\s?")
- +
- # + #

The dividing token we feed into Pygments, to delimit the boundaries between sections.

@@ -250,10 +260,10 @@ sections.

    l["divider_text"] = "\n" + l["symbol"] + "DIVIDER\n"
- +
- # + #

The mirror of divider_text that we expect Pygments to return. We can split on this to recover the original sections.

@@ -261,20 +271,20 @@ on this to recover the original sections.

    l["divider_html"] = re.compile(r'\n*<span class="c[1]?">' + l["symbol"] + 'DIVIDER</span>\n*')
- +
- # + #

Get the Pygments Lexer for this language.

    l["lexer"] = lexers.get_lexer_by_name(l["name"])
- +
- # + #

Get the current language we're documenting, based on the extension.

@@ -293,10 +303,10 @@ on this to recover the original sections.

else: raise ValueError("Can't figure out the language!") - +
- # + #

Compute the destination HTML path for an input source file path. If the source is lib/example.py, the HTML will be at docs/example.html

@@ -309,10 +319,10 @@ is lib/example.py, the HTML will be at docs/example.htmlname = filepath return "docs/" + path.basename(name) + ".html" - +
- # + #

Shift items off the front of the list until it is empty, then return default.

@@ -324,10 +334,10 @@ is lib/example.py, the HTML will be at docs/example.htmlexcept IndexError: return default - +
- # + #

Ensure that the destination directory exists.

@@ -338,52 +348,50 @@ is lib/example.py, the HTML will be at docs/example.htmldef template(source): return lambda context: pystache.render(source, context) - +
- # + #

Create the template that we will use to generate the Pycco HTML page.

-
pycco_template = template(open(path.join(path.dirname(__file__),
-                                         "resources/pycco.html")).read())
+
pycco_template = template(pycco_resources.html)
- +
- # + #

The CSS styles we"d like to apply to the documentation.

-
pycco_styles = open(path.join(path.dirname(__file__),
-                              "resources/pycco.css")).read()
+
pycco_styles = pycco_resources.css
- +
- # + #

The start of each Pygments highlight block.

highlight_start = "<div class=\"highlight\"><pre>"
- +
- # + #

The end of each Pygments highlight block.

highlight_end = "</pre></div>"
- +
- # + #

Run the script. For each source file passed in as an argument, generate the documentation.