Skip to content

Commit 700cf28

Browse files
committed
Add "suspicious" builder which finds leftover markup in the HTML files.
Patch by Gabriel Genellina.
1 parent 775aa4a commit 700cf28

File tree

5 files changed

+430
-12
lines changed

5 files changed

+430
-12
lines changed

Doc/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ help:
2424
@echo " text to make plain text files"
2525
@echo " changes to make an overview over all changed/added/deprecated items"
2626
@echo " linkcheck to check all external links for integrity"
27+
@echo " suspicious to check for suspicious markup in output text"
2728
@echo " coverage to check documentation coverage for library and C API"
2829
@echo " dist to create a \"dist\" directory with archived docs for download"
2930

@@ -84,6 +85,11 @@ linkcheck: build
8485
@echo "Link check complete; look for any errors in the above output " \
8586
"or in build/$(BUILDER)/output.txt"
8687

88+
suspicious: BUILDER = suspicious
89+
suspicious: build
90+
@echo "Suspicious check complete; look for any errors in the above output " \
91+
"or in build/$(BUILDER)/suspicious.txt"
92+
8793
coverage: BUILDER = coverage
8894
coverage: build
8995
@echo "Coverage finished; see c.txt and python.txt in build/coverage"

Doc/make.bat

+19-12
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,35 @@ if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe
88
if "%1" EQU "" goto help
99
if "%1" EQU "html" goto build
1010
if "%1" EQU "htmlhelp" goto build
11-
if "%1" EQU "web" goto build
12-
if "%1" EQU "webrun" goto webrun
11+
if "%1" EQU "latex" goto build
12+
if "%1" EQU "text" goto build
13+
if "%1" EQU "suspicious" goto build
14+
if "%1" EQU "linkcheck" goto build
15+
if "%1" EQU "changes" goto build
1316
if "%1" EQU "checkout" goto checkout
1417
if "%1" EQU "update" goto update
1518

1619
:help
20+
set this=%~n0
1721
echo HELP
1822
echo.
19-
echo builddoc checkout
20-
echo builddoc update
21-
echo builddoc html
22-
echo builddoc htmlhelp
23-
echo builddoc web
24-
echo builddoc webrun
23+
echo %this% checkout
24+
echo %this% update
25+
echo %this% html
26+
echo %this% htmlhelp
27+
echo %this% latex
28+
echo %this% text
29+
echo %this% suspicious
30+
echo %this% linkcheck
31+
echo %this% changes
2532
echo.
2633
goto end
2734

2835
:checkout
2936
svn co %SVNROOT%/doctools/trunk/sphinx tools/sphinx
30-
svn co %SVNROOT%/external/docutils-0.4/docutils tools/docutils
31-
svn co %SVNROOT%/external/Jinja-1.1/jinja tools/jinja
32-
svn co %SVNROOT%/external/Pygments-0.9/pygments tools/pygments
37+
svn co %SVNROOT%/external/docutils-0.5/docutils tools/docutils
38+
svn co %SVNROOT%/external/Jinja-1.2/jinja tools/jinja
39+
svn co %SVNROOT%/external/Pygments-0.11.1/pygments tools/pygments
3340
goto end
3441

3542
:update
@@ -43,7 +50,7 @@ goto end
4350
if not exist build mkdir build
4451
if not exist build\%1 mkdir build\%1
4552
if not exist build\doctrees mkdir build\doctrees
46-
cmd /C %PYTHON% tools\sphinx-build.py -b%1 -dbuild\doctrees . build\%1
53+
cmd /C %PYTHON% tools\sphinx-build.py -b%1 -dbuild\doctrees . build\%*
4754
if "%1" EQU "htmlhelp" "%HTMLHELP%" build\htmlhelp\pydoc.hhp
4855
goto end
4956

Doc/tools/sphinxext/pyspecific.py

+4
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def finish(self):
9292
finally:
9393
f.close()
9494

95+
# Support for checking for suspicious markup
96+
97+
import suspicious
9598

9699
# Support for documenting Opcodes
97100

@@ -116,5 +119,6 @@ def parse_opcode_signature(env, sig, signode):
116119
def setup(app):
117120
app.add_role('issue', issue_role)
118121
app.add_builder(PydocTopicsBuilder)
122+
app.add_builder(suspicious.CheckSuspiciousMarkupBuilder)
119123
app.add_description_unit('opcode', 'opcode', '%s (opcode)',
120124
parse_opcode_signature)

Doc/tools/sphinxext/susp-ignored.csv

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
c-api/arg,,:ref,"PyArg_ParseTuple(args, ""O|O:ref"", &object, &callback)"
2+
c-api/list,,:high,list[low:high]
3+
c-api/list,,:high,list[low:high] = itemlist
4+
c-api/sequence,,:i2,o[i1:i2]
5+
c-api/sequence,,:i2,o[i1:i2] = v
6+
c-api/sequence,,:i2,del o[i1:i2]
7+
c-api/unicode,,:end,str[start:end]
8+
distutils/apiref,,:action,http://pypi.python.org/pypi?:action=list_classifiers
9+
distutils/setupscript,,::,
10+
extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))"
11+
extending/extending,,:set,"if (PyArg_ParseTuple(args, ""O:set_callback"", &temp)) {"
12+
extending/extending,,:myfunction,"PyArg_ParseTuple(args, ""D:myfunction"", &c);"
13+
extending/newtypes,,:call,"if (!PyArg_ParseTuple(args, ""sss:call"", &arg1, &arg2, &arg3)) {"
14+
extending/windows,,:initspam,/export:initspam
15+
howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))"
16+
howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))"
17+
howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))"
18+
howto/curses,,:black,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
19+
howto/curses,,:blue,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
20+
howto/curses,,:cyan,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
21+
howto/curses,,:green,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
22+
howto/curses,,:magenta,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
23+
howto/curses,,:red,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
24+
howto/curses,,:white,"7:white."
25+
howto/curses,,:yellow,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
26+
howto/regex,,::,
27+
howto/regex,,:foo,(?:foo)
28+
howto/urllib2,,:example,"for example ""joe@password:example.com"""
29+
howto/webservers,,.. image:,.. image:: http.png
30+
library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],"
31+
library/datetime,,:MM,
32+
library/datetime,,:SS,
33+
library/decimal,,:optional,"trailneg:optional trailing minus indicator"
34+
library/difflib,,:ahi,a[alo:ahi]
35+
library/difflib,,:bhi,b[blo:bhi]
36+
library/difflib,,:i2,
37+
library/difflib,,:j2,
38+
library/difflib,,:i1,
39+
library/dis,,:TOS,
40+
library/dis,,`,TOS = `TOS`
41+
library/doctest,,`,``factorial`` from the ``example`` module:
42+
library/doctest,,`,The ``example`` module
43+
library/doctest,,`,Using ``factorial``
44+
library/functions,,:step,a[start:stop:step]
45+
library/functions,,:stop,"a[start:stop, i]"
46+
library/functions,,:stop,a[start:stop:step]
47+
library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)"
48+
library/httplib,,:port,host:port
49+
library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
50+
library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
51+
library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh"
52+
library/logging,,:And,
53+
library/logging,,:package1,
54+
library/logging,,:package2,
55+
library/logging,,:root,
56+
library/logging,,:This,
57+
library/logging,,:port,host:port
58+
library/mmap,,:i2,obj[i1:i2]
59+
library/multiprocessing,,:queue,">>> QueueManager.register('get_queue', callable=lambda:queue)"
60+
library/multiprocessing,,`,">>> l._callmethod('__getitem__', (20,)) # equiv to `l[20]`"
61+
library/multiprocessing,,`,">>> l._callmethod('__getslice__', (2, 7)) # equiv to `l[2:7]`"
62+
library/multiprocessing,,`,# `BaseManager`.
63+
library/multiprocessing,,`,# `Pool.imap()` (which will save on the amount of code needed anyway).
64+
library/multiprocessing,,`,# A test file for the `multiprocessing` package
65+
library/multiprocessing,,`,# A test of `multiprocessing.Pool` class
66+
library/multiprocessing,,`,# Add more tasks using `put()`
67+
library/multiprocessing,,`,# create server for a `HostManager` object
68+
library/multiprocessing,,`,# Depends on `multiprocessing` package -- tested with `processing-0.60`
69+
library/multiprocessing,,`,# in the original order then consider using `Pool.map()` or
70+
library/multiprocessing,,`,# Not sure if we should synchronize access to `socket.accept()` method by
71+
library/multiprocessing,,`,# object. (We import `multiprocessing.reduction` to enable this pickling.)
72+
library/multiprocessing,,`,# register the Foo class; make `f()` and `g()` accessible via proxy
73+
library/multiprocessing,,`,# register the Foo class; make `g()` and `_h()` accessible via proxy
74+
library/multiprocessing,,`,# register the generator function baz; use `GeneratorProxy` to make proxies
75+
library/multiprocessing,,`,`Cluster` is a subclass of `SyncManager` so it allows creation of
76+
library/multiprocessing,,`,`hostname` gives the name of the host. If hostname is not
77+
library/multiprocessing,,`,`slots` is used to specify the number of slots for processes on
78+
library/optparse,,:len,"del parser.rargs[:len(value)]"
79+
library/os.path,,:foo,c:foo
80+
library/parser,,`,"""Make a function that raises an argument to the exponent `exp`."""
81+
library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS"""
82+
library/profile,,:lineno,ncalls tottime percall cumtime percall filename:lineno(function)
83+
library/profile,,:lineno,filename:lineno(function)
84+
library/pyexpat,,:elem1,<py:elem1 />
85+
library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">"
86+
library/repr,,`,"return `obj`"
87+
library/smtplib,,:port,"as well as a regular host:port server."
88+
library/socket,,::,'5aef:2b::8'
89+
library/sqlite3,,:memory,
90+
library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age"
91+
library/sqlite3,,:who,"select name_last, age from people where name_last=:who and age=:age"
92+
library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc."
93+
library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group"
94+
library/ssl,,:myserver,"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com"
95+
library/ssl,,:MyState,State or Province Name (full name) [Some-State]:MyState
96+
library/ssl,,:ops,Email Address []:ops@myserver.mygroup.myorganization.com
97+
library/ssl,,:Some,"Locality Name (eg, city) []:Some City"
98+
library/ssl,,:US,Country Name (2 letter code) [AU]:US
99+
library/stdtypes,,:len,s[len(s):len(s)]
100+
library/stdtypes,,:len,s[len(s):len(s)]
101+
library/string,,:end,s[start:end]
102+
library/string,,:end,s[start:end]
103+
library/subprocess,,`,"output=`mycmd myarg`"
104+
library/subprocess,,`,"output=`dmesg | grep hda`"
105+
library/tarfile,,:compression,filemode[:compression]
106+
library/tarfile,,:gz,
107+
library/tarfile,,:bz2,
108+
library/time,,:mm,
109+
library/time,,:ss,
110+
library/turtle,,::,Example::
111+
library/urllib,,:port,:port
112+
library/urllib2,,:password,"""joe:password@python.org"""
113+
library/uuid,,:uuid,urn:uuid:12345678-1234-5678-1234-567812345678
114+
library/xmlrpclib,,:pass,http://user:pass@host:port/path
115+
library/xmlrpclib,,:pass,user:pass
116+
library/xmlrpclib,,:port,http://user:pass@host:port/path
117+
license,,`,THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
118+
license,,:zooko,mailto:zooko@zooko.com
119+
license,,`,THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
120+
reference/datamodel,,:step,a[i:j:step]
121+
reference/datamodel,,:max,
122+
reference/expressions,,:index,x[index:index]
123+
reference/expressions,,:datum,{key:datum...}
124+
reference/expressions,,`,`expressions...`
125+
reference/grammar,,:output,#diagram:output
126+
reference/grammar,,:rules,#diagram:rules
127+
reference/grammar,,:token,#diagram:token
128+
reference/grammar,,`,'`' testlist1 '`'
129+
reference/lexical_analysis,,:fileencoding,# vim:fileencoding=<encoding-name>
130+
reference/lexical_analysis,,`,", : . ` = ;"
131+
tutorial/datastructures,,:value,key:value pairs within the braces adds initial key:value pairs
132+
tutorial/datastructures,,:value,It is also possible to delete a key:value
133+
tutorial/stdlib2,,:start,"fields = struct.unpack('<IIIHH', data[start:start+16])"
134+
tutorial/stdlib2,,:start,extra = data[start:start+extra_size]
135+
tutorial/stdlib2,,:start,filename = data[start:start+filenamesize]
136+
tutorial/stdlib2,,:config,"logging.warning('Warning:config file %s not found', 'server.conf')"
137+
tutorial/stdlib2,,:config,WARNING:root:Warning:config file server.conf not found
138+
tutorial/stdlib2,,:Critical,CRITICAL:root:Critical error -- shutting down
139+
tutorial/stdlib2,,:Error,ERROR:root:Error occurred
140+
tutorial/stdlib2,,:root,CRITICAL:root:Critical error -- shutting down
141+
tutorial/stdlib2,,:root,ERROR:root:Error occurred
142+
tutorial/stdlib2,,:root,WARNING:root:Warning:config file server.conf not found
143+
tutorial/stdlib2,,:Warning,WARNING:root:Warning:config file server.conf not found
144+
using/cmdline,,:line,file:line: category: message
145+
using/cmdline,,:category,action:message:category:module:line
146+
using/cmdline,,:line,action:message:category:module:line
147+
using/cmdline,,:message,action:message:category:module:line
148+
using/cmdline,,:module,action:message:category:module:line
149+
using/cmdline,,:errorhandler,:errorhandler
150+
using/windows,162,`,`` this fixes syntax highlighting errors in some editors due to the \\\\ hackery
151+
using/windows,170,`,``
152+
whatsnew/2.0,418,:len,
153+
whatsnew/2.3,,::,
154+
whatsnew/2.3,,:config,
155+
whatsnew/2.3,,:Critical,
156+
whatsnew/2.3,,:Error,
157+
whatsnew/2.3,,:Problem,
158+
whatsnew/2.3,,:root,
159+
whatsnew/2.3,,:Warning,
160+
whatsnew/2.4,,::,
161+
whatsnew/2.4,,:System,
162+
whatsnew/2.5,,:memory,:memory:
163+
whatsnew/2.5,,:step,[start:stop:step]
164+
whatsnew/2.5,,:stop,[start:stop:step]

0 commit comments

Comments
 (0)