Commits

Anonymous committed 2a2102e

Moved doc building script into django website dir

Comments (0)

Files changed (1)

docs/build.py

-#!/usr/bin/env python
-
-"""
-Script to build the documentation for Django from ReST -> HTML.
-"""
-
-import os
-import sys
-import glob
-import locale
-from docutils.core import publish_parts
-from docutils.writers import html4css1
-
-SETTINGS = {
-    'initial_header_level': 2
-}
-
-locale.setlocale(locale.LC_ALL, '')
-
-def build(dirs):
-    writer = html4css1.Writer()
-    writer.translator_class = DjangoHTMLTranslator
-    for dir in dirs:
-        for fname in glob.glob1(dir, "*.txt"):
-            in_file = os.path.join(dir, fname)
-            out_file = os.path.join(dir, os.path.splitext(fname)[0] + ".html")
-            print "+++", in_file
-            parts = publish_parts(
-                open(in_file).read(),
-                source_path=in_file,
-                destination_path=out_file,
-                writer=writer,
-                settings_overrides={
-                    'initial_header_level' : 2,
-                }
-            )
-            open(out_file, 'w').write(parts['html_body'])
-
-class DjangoHTMLTranslator(html4css1.HTMLTranslator):
-    """Remove the damn border=1 from the standard HTML writer"""
-    def visit_table(self, node):
-        self.body.append(self.starttag(node, 'table', CLASS='docutils'))
-
-if __name__ == "__main__":
-    if len(sys.argv) > 1:
-        build(sys.argv[1:])
-    else:
-        build([os.getcwd()])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.