Author: goodger Date: 2006-03-23 15:28:36 +0100 (Thu, 23 Mar 2006) New Revision: 4445 Modified: trunk/docutils/docs/user/config.txt trunk/docutils/docutils/parsers/rst/__init__.py trunk/docutils/docutils/parsers/rst/roles.py trunk/docutils/docutils/parsers/rst/states.py trunk/docutils/docutils/writers/pep_html/template.txt trunk/docutils/test/functional/expected/standalone_rst_html4css1.html trunk/docutils/test/functional/expected/standalone_rst_latex.tex trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt trunk/docutils/test/test_parsers/test_rst/test_interpreted.py trunk/docutils/test/test_readers/test_pep/test_inline_markup.py Log: added pep_file_url_template setting; corrected PEP urls (removed .html); restored warning comment to HTML output Modified: trunk/docutils/docs/user/config.txt =================================================================== --- trunk/docutils/docs/user/config.txt 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/docs/user/config.txt 2006-03-23 14:28:36 UTC (rev 4445) @@ -743,6 +743,12 @@ Default: "http://www.python.org/peps/". Option: ``--pep-base-url``. +_`pep_file_url_template` + Template for PEP file part of URL, interpolated with the PEP + number and appended to pep_base_url_. + + Default: "pep-%04d". Option: ``--pep-file-url``. + _`raw_enabled` Enable or disable the "raw_" directive. A "warning" system message (including the directive text) is inserted instead. (See Modified: trunk/docutils/docutils/parsers/rst/__init__.py =================================================================== --- trunk/docutils/docutils/parsers/rst/__init__.py 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/docutils/parsers/rst/__init__.py 2006-03-23 14:28:36 UTC (rev 4445) @@ -96,6 +96,9 @@ ['--pep-base-url'], {'metavar': '<URL>', 'default': 'http://www.python.org/dev/peps/', 'validator': frontend.validate_url_trailing_slash}), + ('Template for PEP file part of URL. (default "pep-%04d")', + ['--pep-file-url-template'], + {'metavar': '<URL>', 'default': 'pep-%04d'}), ('Recognize and link to standalone RFC references (like "RFC 822").', ['--rfc-references'], {'action': 'store_true', 'validator': frontend.validate_boolean}), Modified: trunk/docutils/docutils/parsers/rst/roles.py =================================================================== --- trunk/docutils/docutils/parsers/rst/roles.py 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/docutils/parsers/rst/roles.py 2006-03-23 14:28:36 UTC (rev 4445) @@ -266,7 +266,8 @@ prb = inliner.problematic(rawtext, rawtext, msg) return [prb], [msg] # Base URL mainly used by inliner.pep_reference; so this is correct: - ref = inliner.document.settings.pep_base_url + inliner.pep_url % pepnum + ref = (inliner.document.settings.pep_base_url + + inliner.document.settings.pep_file_url_template % pepnum) set_classes(options) return [nodes.reference(rawtext, 'PEP ' + utils.unescape(text), refuri=ref, **options)], [] Modified: trunk/docutils/docutils/parsers/rst/states.py =================================================================== --- trunk/docutils/docutils/parsers/rst/states.py 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/docutils/parsers/rst/states.py 2006-03-23 14:28:36 UTC (rev 4445) @@ -915,8 +915,6 @@ else: # not a valid scheme raise MarkupMismatch - pep_url = 'pep-%04d.html' - def pep_reference(self, match, lineno): text = match.group(0) if text.startswith('pep-'): @@ -925,7 +923,8 @@ pepnum = int(match.group('pepnum2')) else: raise MarkupMismatch - ref = self.document.settings.pep_base_url + self.pep_url % pepnum + ref = (self.document.settings.pep_base_url + + self.document.settings.pep_file_url_template % pepnum) unescaped = unescape(text, 0) return [nodes.reference(unescape(text, 1), unescaped, refuri=ref)] Modified: trunk/docutils/docutils/writers/pep_html/template.txt =================================================================== --- trunk/docutils/docutils/writers/pep_html/template.txt 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/docutils/writers/pep_html/template.txt 2006-03-23 14:28:36 UTC (rev 4445) @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- This HTML is auto-generated. DO NOT EDIT THIS FILE! If you are writing a new -PEP, see http://www.python.org/peps/pep-0001.html for instructions and links +PEP, see http://www.python.org/dev/peps/pep-0001 for instructions and links to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! --> <head> Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2006-03-23 14:28:36 UTC (rev 4445) @@ -175,7 +175,7 @@ (generated by processing errors; this one is intentional). Here is a reference to the <a class="reference" href="#doctitle">doctitle</a> and the <a class="reference" href="#subtitle">subtitle</a>.</p> <p>The default role for interpreted text is <cite>Title Reference</cite>. Here are -some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/dev/peps/pep-0287.html">PEP 287</a>); an +some explicit interpreted text roles: a PEP reference (<a class="reference" href="http://www.python.org/dev/peps/pep-0287">PEP 287</a>); an RFC reference (<a class="reference" href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>); a <sub>subscript</sub>; a <sup>superscript</sup>; and explicit roles for <em>standard</em> <strong>inline</strong> <tt class="docutils literal"><span class="pre">markup</span></tt>.</p> Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2006-03-23 14:28:36 UTC (rev 4445) @@ -312,7 +312,7 @@ reference to the \href{\#doctitle}{doctitle} and the \href{\#subtitle}{subtitle}. The default role for interpreted text is \titlereference{Title Reference}. Here are -some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287.html}{PEP 287}); an +some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); a $_{subscript}$; a $^{superscript}$; and explicit roles for \emph{standard} \textbf{inline} \texttt{markup}. Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2006-03-23 14:28:36 UTC (rev 4445) @@ -470,7 +470,7 @@ Title Reference . Here are some explicit interpreted text roles: a PEP reference ( - <reference refuri="http://www.python.org/dev/peps/pep-0287.html"> + <reference refuri="http://www.python.org/dev/peps/pep-0287"> PEP 287 ); an RFC reference ( Modified: trunk/docutils/test/test_parsers/test_rst/test_interpreted.py =================================================================== --- trunk/docutils/test/test_parsers/test_rst/test_interpreted.py 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/test/test_parsers/test_rst/test_interpreted.py 2006-03-23 14:28:36 UTC (rev 4445) @@ -182,7 +182,7 @@ """\ <document source="test data"> <paragraph> - <reference refuri="http://www.python.org/dev/peps/pep-0000.html"> + <reference refuri="http://www.python.org/dev/peps/pep-0000"> PEP 0 """], ["""\ Modified: trunk/docutils/test/test_readers/test_pep/test_inline_markup.py =================================================================== --- trunk/docutils/test/test_readers/test_pep/test_inline_markup.py 2006-03-23 03:53:57 UTC (rev 4444) +++ trunk/docutils/test/test_readers/test_pep/test_inline_markup.py 2006-03-23 14:28:36 UTC (rev 4445) @@ -30,10 +30,10 @@ <document source="test data"> <paragraph> See \n\ - <reference refuri="http://www.python.org/dev/peps/pep-0287.html"> + <reference refuri="http://www.python.org/dev/peps/pep-0287"> PEP 287 ( - <reference refuri="http://www.python.org/dev/peps/pep-0287.html"> + <reference refuri="http://www.python.org/dev/peps/pep-0287"> pep-0287.txt ), and \n\ @@ -61,7 +61,7 @@ <paragraph> References split across lines: <paragraph> - <reference refuri="http://www.python.org/dev/peps/pep-0287.html"> + <reference refuri="http://www.python.org/dev/peps/pep-0287"> PEP 287 <paragraph> @@ -72,18 +72,18 @@ ["""\ Test PEP-specific implicit references before a URL: -PEP 287 (http://www.python.org/dev/peps/pep-0287.html), RFC 2822. +PEP 287 (http://www.python.org/dev/peps/pep-0287), RFC 2822. """, """\ <document source="test data"> <paragraph> Test PEP-specific implicit references before a URL: <paragraph> - <reference refuri="http://www.python.org/dev/peps/pep-0287.html"> + <reference refuri="http://www.python.org/dev/peps/pep-0287"> PEP 287 ( - <reference refuri="http://www.python.org/dev/peps/pep-0287.html"> - http://www.python.org/dev/peps/pep-0287.html + <reference refuri="http://www.python.org/dev/peps/pep-0287"> + http://www.python.org/dev/peps/pep-0287 ), \n\ <reference refuri="http://www.faqs.org/rfcs/rfc2822.html"> RFC 2822 |