[PATCH 2 of 3] help: modify config.txt to make minirst find sections correctly (issue2804)

yun lee yun.lee.bj at gmail.com
Sat May 28 07:14:51 CDT 2011


It's necessary to make the change in this patch to make minirst find
sections correctly .


1.With patch[1], we can see in 'blocks.txt' generated by the patch
that for section name not followed by a empty line

``alias``
"""""""""
Defines command aliases.
Aliases allow you to define your own commands in terms of other
commands (or aliases), optionally including arguments. Positional
arguments in the form of ``$1``, ``$2``, etc in the alias definition
are expanded by Mercurial before execution. Positional arguments not
already used by ``$N`` in the definition are put at the end of the
command to be executed.

it will not be recognized as a section, and it's type is 'paragraph':

{'lines': ['``alias``', '"""""""""', 'Defines command aliases.',
'Aliases allow you to define your own commands in terms of other',
'commands (or aliases), optionally including arguments. Positional',
'arguments in the form of ``$1``, ``$2``, etc in the alias
definition', 'are expanded by Mercurial before execution. Positional
arguments not', 'already used by ``$N`` in the definition are put at
the end of the', 'command to be executed.'], 'indent': 4, 'type':
'paragraph'}


2.While, for section name followed by a empty line

``alias``
"""""""""

Defines command aliases.
Aliases allow you to define your own commands in terms of other
commands (or aliases), optionally including arguments. Positional
arguments in the form of ``$1``, ``$2``, etc in the alias definition
are expanded by Mercurial before execution. Positional arguments not
already used by ``$N`` in the definition are put at the end of the
command to be executed.

it will not be recognized as a section, and it's type is 'section':

{'lines': ['``alias``'], 'indent': 4, 'underline': '"', 'type': 'section'}
{'lines': ['Defines command aliases.', 'Aliases allow you to define
your own commands in terms of other', 'commands (or aliases),
optionally including arguments. Positional', 'arguments in the form of
``$1``, ``$2``, etc in the alias definition', 'are expanded by
Mercurial before execution. Positional arguments not', 'already used
by ``$N`` in the definition are put at the end of the', 'command to be
executed.'], 'indent': 4, 'type': 'paragraph'}
{'lines': ['Alias definitions consist of lines of the form:'],
'indent': 4, 'type': 'paragraph'}




[1]
diff -r be66dc433d4b mercurial/minirst.py
--- a/mercurial/minirst.py	Sat May 28 12:39:26 2011 +0800
+++ b/mercurial/minirst.py	Sat May 28 19:48:04 2011 +0800
@@ -442,6 +442,13 @@
     blocks = findliteralblocks(blocks)
     blocks, pruned = prunecontainers(blocks, keep or [])
     blocks = findsections(blocks)
+
+    f = open('blocks.txt', 'w')
+    content = '\n'.join(str(b) for b in blocks)
+
+    f.write(content)
+    f.close()
+
     blocks = inlineliterals(blocks)
     blocks = hgrole(blocks)
     blocks = splitparagraphs(blocks)


More information about the Mercurial-devel mailing list