From ef739404d33e8ea24f106e386575eaf1128a2d14 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Thu, 14 Jul 2005 18:08:56 +0000 Subject: [PATCH] Moved doc building script into django website dir git-svn-id: http://code.djangoproject.com/svn/django/trunk@27 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/build.py | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100755 docs/build.py diff --git a/docs/build.py b/docs/build.py deleted file mode 100755 index 29b5c5add4..0000000000 --- a/docs/build.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/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()])