summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-08-22 18:28:51 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-08-22 18:28:51 -0400
commit41005832b16af1dc054429c78656259175f2f0ca (patch)
treeef5a2ad7531c0af1852f35b9421a3baced4e7790 /doc
parent97658fc24b38aed0457b06033e58623c96c8bd21 (diff)
downloadpython-coveragepy-git-41005832b16af1dc054429c78656259175f2f0ca.tar.gz
Don't need the .px doc toolchain any morecoverage-4.0b2
Diffstat (limited to 'doc')
-rw-r--r--doc/_ext/px_cleaner.py19
-rw-r--r--doc/_ext/px_xlator.py117
-rw-r--r--doc/conf.py3
3 files changed, 0 insertions, 139 deletions
diff --git a/doc/_ext/px_cleaner.py b/doc/_ext/px_cleaner.py
deleted file mode 100644
index 24541207..00000000
--- a/doc/_ext/px_cleaner.py
+++ /dev/null
@@ -1,19 +0,0 @@
-"""Clean up .px files created by Sphinx."""
-
-import sys
-
-def clean_px(fname):
- """Clean a px file."""
-
- with open(fname) as f:
- text = f.read()
- text = text.lstrip()
- with open(fname, "w") as f:
- f.write(text)
-
-def clean_px_files(fnames):
- for fname in fnames:
- clean_px(fname)
-
-if __name__ == '__main__':
- clean_px_files(sys.argv[1:])
diff --git a/doc/_ext/px_xlator.py b/doc/_ext/px_xlator.py
deleted file mode 100644
index e4950d9a..00000000
--- a/doc/_ext/px_xlator.py
+++ /dev/null
@@ -1,117 +0,0 @@
-from docutils import nodes
-from sphinx import addnodes
-from sphinx.writers.html import SmartyPantsHTMLTranslator
-from sphinx.builders.html import StandaloneHTMLBuilder
-import os
-
-def setup(app):
- app.add_builder(PxBuilder)
-
-
-BaseHtmlXlator = SmartyPantsHTMLTranslator
-class PxTranslator(BaseHtmlXlator):
- """Adjust the HTML translator into a .px translator.
-
- """
-
- def __init__(self, *args, **kwargs):
- BaseHtmlXlator.__init__(self, *args, **kwargs)
- #self.document.reporter.debug_flag = 1
- # To make the doc title be h0 (skipped), and the next h1.
- self.initial_header_level = 0
-
- def visit_section(self, node):
- self.section_level += 1
-
- def depart_section(self, node):
- self.section_level -= 1
-
- def visit_title(self, node):
- if self.section_level == 1:
- raise nodes.SkipNode
- else:
- # The id for the h2 tag is on the parent, move it
- # down here so we'll get the right HTML.
- if not node['ids'] and len(node.parent['ids']) > 1:
- node['ids'] = [node.parent['ids'][1]]
- BaseHtmlXlator.visit_title(self, node)
-
- def visit_field_list(self, node):
- self.history = []
-
- def depart_field_list(self, node):
- if self.history:
- self.body.append("<history>\n")
- for hist in self.history:
- when, what = hist.split(',', 1)
- self.body.append("<what when='%s'>%s</what>\n" % (when, self.encode(what.strip())))
- self.body.append("</history>\n")
-
- prerel = None
- if "b" in self.builder.config.release:
- prerel = "a beta"
- if "a" in self.builder.config.release:
- prerel = "an ALPHA"
- if prerel:
- self.body.append("""
- <box>
- These docs are for %s release, %s.
- For the latest released version, see <a href='/code/coverage'>coverage.py</a>.
- </box>
- """ % (prerel, self.builder.config.release))
-
- def visit_field(self, node):
- if node.children[0].astext() == 'history':
- self.history.append(node.children[1].astext())
- raise nodes.SkipChildren
-
- def depart_field(self, node):
- pass
-
- def visit_literal_block(self, node):
- if node.rawsource != node.astext():
- # most probably a parsed-literal block -- don't highlight
- return BaseHtmlXlator.visit_literal_block(self, node)
- lang = self.highlightlang
- if node.has_key('language'):
- # code-block directives
- lang = node['language']
- self.body.append('<code lang="%s">' % lang)
- self.body.append(self.encode(node.rawsource))
- self.body.append('</code>\n')
- raise nodes.SkipNode
-
- def visit_desc_parameterlist(self, node):
- # I'm overriding this method so that the base class doesn't write out
- # <big>(</big>, but I also have to handle the logic from the base class,
- # so most of this is just copied from sphinx/writers/html.py...
- self.body.append('(')
- self.first_param = 1
- self.optional_param_level = 0
- # How many required parameters are left.
- self.required_params_left = sum([isinstance(c, addnodes.desc_parameter)
- for c in node.children])
- self.param_separator = node.child_text_separator
- def depart_desc_parameterlist(self, node):
- self.body.append(')')
-
-
-class PxBuilder(StandaloneHTMLBuilder):
- name = 'px'
-
- def init(self):
- self.config.html_theme = 'px'
- self.config.html_translator_class = "px_xlator.PxTranslator"
-
- super(PxBuilder, self).init()
-
- self.out_suffix = '.px'
- self.link_suffix = '.html'
-
- if max(self.config.release).isalpha():
- self.px_uri = "/code/coverage/beta/"
- else:
- self.px_uri = "/code/coverage/"
-
- def get_target_uri(self, docname, typ=None):
- return self.px_uri + docname + self.link_suffix
diff --git a/doc/conf.py b/doc/conf.py
index 8b2bb24c..5417b8ac 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -20,8 +20,6 @@ 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"))
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
@@ -35,7 +33,6 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.ifconfig',
'sphinxcontrib.spelling',
- 'px_xlator',
]
# Add any paths that contain templates here, relative to this directory.