From bba089527a53d20a00ac90c0424ef8456c1b9deb Mon Sep 17 00:00:00 2001 From: Yuri Takhteyev Date: Mon, 13 Mar 2006 20:25:17 +0000 Subject: Converted some instance variables to class variables (patch from Stelios Xanthakis) --- markdown.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'markdown.py') 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) -- cgit v1.2.3