From fd5ae92bd218b72a7a923e406eee023afe024dc0 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 9 Nov 2010 03:54:45 -0500 Subject: - All references to Pyramid-the-application were changed from :mod:`pyramid` to :app:`Pyramid`. A custom role setting was added to ``docs/conf.py`` to allow for this. (internal) --- docs/conf.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index 569855aa5..88cf07797 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,6 +17,8 @@ import datetime # skip raw nodes from sphinx.writers.text import TextTranslator from docutils import nodes +from docutils import utils + def raw(*arg): raise nodes.SkipNode TextTranslator.visit_raw = raw @@ -320,8 +322,6 @@ latex_elements = { # 'pointsize':'12pt', # uncomment for 12pt version } -from docutils import nodes - # secnumdepth counter reset to 2 causes numbering in related matter; # reset to -1 causes chapters to not be numbered, reset to -2 causes # parts to not be numbered. @@ -375,7 +375,18 @@ def backmatter(name, arguments, options, content, lineno, return [nodes.raw('', '\\backmatter\n\\setcounter{secnumdepth}{-1}\n', format='latex')] +def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]): + """custom role for :app: marker, does nothing in particular except allow + :app:`Pyramid` to work (for later search and replace).""" + if 'class' in options: + assert 'classes' not in options + options['classes'] = options['class'] + del options['class'] + return [nodes.inline(rawtext, utils.unescape(text), **options)], [] + + def setup(app): + app.add_role('app', app_role) app.add_directive('frontmatter', frontmatter, 1, (0, 0, 0)) app.add_directive('mainmatter', mainmatter, 1, (0, 0, 0)) app.add_directive('backmatter', backmatter, 1, (0, 0, 0)) -- cgit v1.2.3