[docs] [issue15580] fix True/False/None reST markup

Chris Jerdonek report at bugs.python.org
Wed Aug 8 03:53:23 CEST 2012


Chris Jerdonek added the comment:

Here is a command to find the file names of all occurrences:

find Doc -type f -name *.rst | xargs grep -ERl ":const:\`(True|False|None)\`"

The occurrences are in the following directories:

Doc/c-api/
Doc/library/
Doc/reference/
Doc/whatsnew/

And here are commands to do the replacement on a branch.

# Replace the occurrences inside tables, to preserve table alignment.
find Doc/c-api/ Doc/library/ Doc/reference/ -type f -name *.rst | \
  xargs sed -i '' \
    -e 's/\(\|.*\):const:`True`/\1``True``     /g' \
    -e 's/\(\|.*\):const:`False`/\1``False``     /g' \
    -e 's/\(\|.*\):const:`None`/\1``None``     /g'

# Replace the rest of the occurrences.
find Doc/c-api/ Doc/library/ Doc/reference/ -type f -name *.rst | \
  xargs sed -i '' \
    -e 's/:const:`True`/``True``/g' \
    -e 's/:const:`False`/``False``/g' \
    -e 's/:const:`None`/``None``/g'

I left out Doc/whatsnew/ because the What's New is historical and because it includes entries describing the introduction of True/False, which may be considered special.

Incidentally, the constants documentation of True/False/None link to the descriptions using ":data:`True`", etc, so they are not affected by this change:

http://docs.python.org/dev/library/constants.html#built-in-constants

To commit, the commands above could be run on a branch and committed, then merged forward to newer branches, and then the scripts re-run on the next newer branch to catch new introductions of True/False/None, and so on.

For illustration purposes only, I'm attaching the patch that results from running the script on the default branch.

----------
keywords: +patch
Added file: http://bugs.python.org/file26723/script-result-default-branch.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15580>
_______________________________________


More information about the docs mailing list