diff options
author | Yuri Takhteyev <yuri@freewisdom.org> | 2006-05-19 05:45:44 +0000 |
---|---|---|
committer | Yuri Takhteyev <yuri@freewisdom.org> | 2006-05-19 05:45:44 +0000 |
commit | fad3cbda681391a4ac12f8dd3e2033a1f9b086c8 (patch) | |
tree | 6b20f014ed82c81a9d1055156981eadbcad6d2c1 /markdown.py | |
parent | 413e484987756659ffdbf4c410b566c6bc748eff (diff) | |
download | markdown-fad3cbda681391a4ac12f8dd3e2033a1f9b086c8.tar.gz markdown-fad3cbda681391a4ac12f8dd3e2033a1f9b086c8.tar.bz2 markdown-fad3cbda681391a4ac12f8dd3e2033a1f9b086c8.zip |
Stopped catching unquoted titles in reference links. Stopped creating blank headers.
Diffstat (limited to 'markdown.py')
-rw-r--r-- | markdown.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/markdown.py b/markdown.py index ff81f4a..a52b62b 100644 --- a/markdown.py +++ b/markdown.py @@ -270,7 +270,7 @@ class HeaderPreprocessor : def run (self, lines) : for i in range(len(lines)) : - if not lines[i] : + if not lines[i].strip() : continue if lines[i].startswith("#") : @@ -422,15 +422,25 @@ HTML_BLOCK_PREPROCESSOR = HtmlBlockPreprocessor() class ReferencePreprocessor : def run (self, lines) : + new_text = []; for line in lines: m = RE.regExp['reference-def'].match(line) if m: id = m.group(2).strip().lower() - title = dequote(m.group(4).strip()) #.replace('"', """) - self.references[id] = (m.group(3), title) + t = m.group(4).strip() # potential title + if not t : + self.references[id] = (m.group(3), t) + elif (len(t) >= 2 + and (t[0] == t[-1] == "\"" + or t[0] == t[-1] == "\'" + or (t[0] == "(" and t[-1] == ")") ) ) : + self.references[id] = (m.group(3), t[1:-1]) + else : + new_text.append(line) else: new_text.append(line) + return new_text #+ "\n" REFERENCE_PREPROCESSOR = ReferencePreprocessor() @@ -1858,6 +1868,9 @@ if __name__ == '__main__': CHANGELOG ========= +May 18, 2006: Stopped catching unquoted titles in reference links. +Stopped creating blank headers. + May 15, 2006: A bug with lists, recursion on block-level elements, run-in headers, spaces before headers, unicode input (thanks to Aaron Swartz). Sourceforge tracker #s: 1489313, 1489312, 1489311, 1488370, |