summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authorgrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2008-02-15 09:23:07 +0000
committergrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2008-02-15 09:23:07 +0000
commitd39181c68124d31c8472bdce706e52e7c6614833 (patch)
tree8d20fc353e892e5f274b52811c190a1e185b490d /docutils
parent94f2abc8fc14ecf5f95031b100d653b79618c24f (diff)
downloaddocutils-d39181c68124d31c8472bdce706e52e7c6614833.tar.gz
Allow ``+`` and ``:`` in reference names.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5510 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/HISTORY.txt1
-rw-r--r--docutils/docutils/parsers/rst/states.py4
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_citations.py14
3 files changed, 17 insertions, 2 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt
index a205c4088..ce3b179da 100644
--- a/docutils/HISTORY.txt
+++ b/docutils/HISTORY.txt
@@ -46,6 +46,7 @@ Changes Since 0.4
* docutils/parsers/rst/states.py:
+ - Allow ``+`` and ``:`` in reference names.
- Unquoted targets beginning with an underscore (``.. __target:
URI``) are no longer accepted.
- Added support for multiple attributions in a physical block quote
diff --git a/docutils/docutils/parsers/rst/states.py b/docutils/docutils/parsers/rst/states.py
index 50f5dd082..eabc179ef 100644
--- a/docutils/docutils/parsers/rst/states.py
+++ b/docutils/docutils/parsers/rst/states.py
@@ -512,8 +512,8 @@ class Inliner:
non_whitespace_before = r'(?<![ \n])'
non_whitespace_escape_before = r'(?<![ \n\x00])'
non_whitespace_after = r'(?![ \n])'
- # Alphanumerics with isolated internal [-._] chars (i.e. not 2 together):
- simplename = r'(?:(?!_)\w)+(?:[-._](?:(?!_)\w)+)*'
+ # Alphanumerics with isolated internal [-._+:] chars (i.e. not 2 together):
+ simplename = r'(?:(?!_)\w)+(?:[-._+:](?:(?!_)\w)+)*'
# Valid URI characters (see RFC 2396 & RFC 2732);
# final \x00 allows backslash escapes in URIs:
uric = r"""[-_.!~*'()[\];/:@&=+$,%a-zA-Z0-9\x00]"""
diff --git a/docutils/test/test_parsers/test_rst/test_citations.py b/docutils/test/test_parsers/test_rst/test_citations.py
index 349569ba3..09f7cef81 100755
--- a/docutils/test/test_parsers/test_rst/test_citations.py
+++ b/docutils/test/test_parsers/test_rst/test_citations.py
@@ -137,6 +137,10 @@ isolated internals : ``.-_``.
.. [citation-withdot] one hyphen
.. [citation_withunderscore] one underscore
+
+.. [citation:with:colons] two colons
+
+.. [citation+withplus] one plus
""",
"""<document source="test data">
<paragraph>
@@ -159,6 +163,16 @@ isolated internals : ``.-_``.
citation_withunderscore
<paragraph>
one underscore
+ <citation ids="citation-with-colons" names="citation:with:colons">
+ <label>
+ citation:with:colons
+ <paragraph>
+ two colons
+ <citation ids="citation-withplus" names="citation+withplus">
+ <label>
+ citation+withplus
+ <paragraph>
+ one plus
"""],
]