Abbreviation Extension for Python-Markdown.
| 30 | ABBR_REF_RE = re.compile(r'[*]\[(?P<abbr>[^\]]*)\][ ]?:\s*(?P<title>.*)') |
| 31 | |
| 32 | class AbbrExtension(markdown.Extension): |
| 33 | """ Abbreviation Extension for Python-Markdown. """ |
| 34 | |
| 35 | def extendMarkdown(self, md, md_globals): |
| 36 | """ Insert AbbrPreprocessor before ReferencePreprocessor. """ |
| 37 | md.preprocessors.add('abbr', AbbrPreprocessor(md), '<reference') |
| 38 | |
| 39 | |
| 40 | class AbbrPreprocessor(markdown.preprocessors.Preprocessor): |