From c72eff754646c1a8a54dcf810523b34b0c85ec43 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 23 May 2009 11:00:48 -0400 Subject: Sphinx experiments getting complicated... --- doc/Makefile | 2 +- doc/_ext/px_xlator.py | 18 ++++++++++++++++++ doc/conf.py | 16 +++++++++++----- 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 doc/_ext/px_xlator.py diff --git a/doc/Makefile b/doc/Makefile index 7eb15211..da5df57e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -9,7 +9,7 @@ PAPER = # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +ALLSPHINXOPTS = -a -E $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest diff --git a/doc/_ext/px_xlator.py b/doc/_ext/px_xlator.py new file mode 100644 index 00000000..5314f425 --- /dev/null +++ b/doc/_ext/px_xlator.py @@ -0,0 +1,18 @@ +from sphinx.writers.html import SmartyPantsHTMLTranslator +from sphinx.builders.html import StandaloneHTMLBuilder + +class PxTranslator(SmartyPantsHTMLTranslator): + """Adjust the HTML translator into a .px translator. + + """ + + def visit_section(self, node): + self.body.append("") + SmartyPantsHTMLTranslator.visit_section(self, node) + self.body.append("") + +class PxBuilder(StandaloneHTMLBuilder): + def get_target_uri(self, docname, typ=None): + import pdb;pdb.set_trace() + return docname + self.link_suffix + \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 3d7a93e5..98bc93f1 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -17,6 +17,8 @@ import sys, os # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) +# Copied from django docs: +sys.path.append(os.path.join(os.path.dirname(__file__), "_ext")) # -- General configuration ----------------------------------------------------- @@ -89,6 +91,8 @@ pygments_style = 'sphinx' # -- Options for HTML output --------------------------------------------------- +html_translator_class = "px_xlator.PxTranslator" + # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'px' @@ -98,6 +102,8 @@ html_theme = 'px' # documentation. #html_theme_options = {} +html_add_permalinks = False + # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ['_templates'] @@ -128,7 +134,7 @@ html_static_path = ['_static'] # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} @@ -138,16 +144,16 @@ html_static_path = ['_static'] #html_additional_pages = {} # If false, no module index is generated. -#html_use_modindex = True +html_use_modindex = False # If false, no index is generated. -#html_use_index = True +html_use_index = False # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +html_show_sourcelink = False # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the @@ -155,7 +161,7 @@ html_static_path = ['_static'] #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' +html_file_suffix = '.px' # Output file base name for HTML help builder. htmlhelp_basename = 'coveragepydoc' -- cgit v1.2.1