summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docutils/transforms/frontmatter.py6
-rw-r--r--docutils/utils.py2
-rwxr-xr-xtest/test_transforms/test_docinfo.py11
3 files changed, 11 insertions, 8 deletions
diff --git a/docutils/transforms/frontmatter.py b/docutils/transforms/frontmatter.py
index 00afc6fd2..1a45c1336 100644
--- a/docutils/transforms/frontmatter.py
+++ b/docutils/transforms/frontmatter.py
@@ -334,10 +334,10 @@ class DocInfo(Transform):
return 1
rcs_keyword_substitutions = [
- (re.compile(r'\$' r'Date: (\d\d\d\d)/(\d\d)/(\d\d) [\d:]+ \$$',
+ (re.compile(r'\$' r'Date: (\d\d\d\d)/(\d\d)/(\d\d) [\d:]+ \$',
re.IGNORECASE), r'\1-\2-\3'),
- (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'),
- (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),]
+ (re.compile(r'\$' r'RCSfile: (.+),v \$', re.IGNORECASE), r'\1'),
+ (re.compile(r'\$[a-zA-Z]+: (.+) \$'), r'\1'),]
def extract_authors(self, field, name, docinfo):
try:
diff --git a/docutils/utils.py b/docutils/utils.py
index 2e60a6c6f..148845330 100644
--- a/docutils/utils.py
+++ b/docutils/utils.py
@@ -406,7 +406,7 @@ def clean_rcs_keywords(paragraph, keyword_substitutions):
if len(paragraph) == 1 and isinstance(paragraph[0], nodes.Text):
textnode = paragraph[0]
for pattern, substitution in keyword_substitutions:
- match = pattern.match(textnode.data)
+ match = pattern.search(textnode.data)
if match:
textnode.data = pattern.sub(substitution, textnode.data)
return
diff --git a/test/test_transforms/test_docinfo.py b/test/test_transforms/test_docinfo.py
index 9fafa4ccb..dcab14a3b 100755
--- a/test/test_transforms/test_docinfo.py
+++ b/test/test_transforms/test_docinfo.py
@@ -305,8 +305,9 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [
["""\
.. RCS keyword extraction.
-:Status: $RCSfile$
-:Date: $Date$
+:Status: $""" + """RCSfile: test_docinfo.py,v $
+:Date: (some text) $""" + """Date: 2002/10/08 01:34:23 $ (more text)
+:Version: $""" + """Revision: 1.1 $ (still more text)
RCS keyword 'RCSfile' doesn't change unless the file name changes,
so it's safe. The 'Date' keyword changes every time the file is
@@ -319,7 +320,9 @@ derived (hacked) in parallel in order to stay in sync.
<status>
test_docinfo.py
<date>
- %s
+ (some text) %s (more text)
+ <version>
+ 1.1 (still more text)
<comment xml:space="preserve">
RCS keyword extraction.
<paragraph>
@@ -327,7 +330,7 @@ derived (hacked) in parallel in order to stay in sync.
so it's safe. The 'Date' keyword changes every time the file is
checked in to CVS, so the test's expected output text has to be
derived (hacked) in parallel in order to stay in sync.
-""" % ('$Date$'[7:17].replace('/', '-'),)],
+""" % (('$' 'Date: 2002/10/08 01:34:23 $')[7:17].replace('/', '-'),)],
])