diff options
author | Yuri Takhteyev <yuri@freewisdom.org> | 2006-03-13 20:25:17 +0000 |
---|---|---|
committer | Yuri Takhteyev <yuri@freewisdom.org> | 2006-03-13 20:25:17 +0000 |
commit | bba089527a53d20a00ac90c0424ef8456c1b9deb (patch) | |
tree | d4914eea15913acc09a5210224fc36735078e2e4 /markdown.py | |
parent | ffa9ecc21ccfad36f7a6f98fc2715af83ce4d24b (diff) | |
download | markdown-bba089527a53d20a00ac90c0424ef8456c1b9deb.tar.gz markdown-bba089527a53d20a00ac90c0424ef8456c1b9deb.tar.bz2 markdown-bba089527a53d20a00ac90c0424ef8456c1b9deb.zip |
Converted some instance variables to class variables (patch from Stelios Xanthakis)
Diffstat (limited to 'markdown.py')
-rw-r--r-- | markdown.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/markdown.py b/markdown.py index 6a6060a..a3a50e7 100644 --- a/markdown.py +++ b/markdown.py @@ -123,8 +123,10 @@ class Document : class Element : + type = "element" + def __init__ (self, tag) : - self.type = "element" + self.nodeName = tag self.attributes = [] self.attribute_values = {} @@ -205,10 +207,11 @@ class Element : class TextNode : + type = "text" + attrRegExp = re.compile(r'\{@([^\}]*)=([^\}]*)}') # {@id=123} + def __init__ (self, text) : - self.type = "text" - self.value = text - self.attrRegExp = re.compile(r'\{@([^\}]*)=([^\}]*)}') # {@id=123} + self.value = text def attributeCallback(self, match) : self.parent.setAttribute(match.group(1), match.group(2)) @@ -230,8 +233,9 @@ class TextNode : class EntityReference: + type = "entity_ref" + def __init__(self, entity): - self.type = "entity_ref" self.entity = entity def handleAttributes(self): @@ -1277,9 +1281,10 @@ method. class FootnoteExtension : + DEF_RE = re.compile(r'(\ ?\ ?\ ?)\[\^([^\]]*)\]:\s*(.*)') + SHORT_USE_RE = re.compile(r'\[\^([^\]]*)\]', re.M) # [^a] + def __init__ (self) : - self.DEF_RE = re.compile(r'(\ ?\ ?\ ?)\[\^([^\]]*)\]:\s*(.*)') - self.SHORT_USE_RE = re.compile(r'\[\^([^\]]*)\]', re.M) # [^a] self.reset() def extendMarkdown(self, md) : @@ -1688,6 +1693,10 @@ if __name__ == '__main__': CHANGELOG ========= +Mar. 15, 2006: Replaced some instance variables with class variables +(a patch from Stelios Xanthakis). Chris Clark's new regexps that do +not trigger midword underlining. + Feb. 28, 2006: Clean-up and command-line handling by Stewart Midwinter. (Version 1.3) |