Anonymous avatar Anonymous committed 073d04d

AND_SUBSTITUTE -> AMP_SUBSTITUTE

Comments (0)

Files changed (1)

 file.)
 
 Started by [Manfred Stienstra](http://www.dwerg.net/).  Continued and
-maintained  by [Yuri Takhteyev](http://www.freewisdom.org) and [Waylan
-Limberg](http://achinghead.com/).
+maintained  by [Yuri Takhteyev](http://www.freewisdom.org), [Waylan
+Limberg](http://achinghead.com/) and [Artem Yunusov](http://blog.splyer.com).
 
 Contact: 
 
             
     return etree
 
-etree = importETree()
+"""ElementTree module
+in extensions use: `from markdown import etree`
+to access to the ElemetTree module, do not import it by yourself"""
+etree = importETree() 
 
 def indentETree(elem, level=0):
     """ Indent ElementTree before serialization """
 
 # --------------- CONSTANTS YOU _SHOULD NOT_ HAVE TO CHANGE ----------
 
-AND_SUBSTITUTE = unichr(2) + unichr(4) + unichr(3) 
 
 # placeholders
 STX = u'\u0002'  # Use STX ("Start of text") for start-of-placeholder
 INLINE_PLACEHOLDER_PREFIX = STX+"inline:"
 INLINE_PLACEHOLDER_SUFFIX = ETX
 
+AMP_SUBSTITUTE = STX+"amp"+ETX 
+
 
 BLOCK_LEVEL_ELEMENTS = ['p', 'div', 'blockquote', 'pre', 'table',
                         'dl', 'ol', 'ul', 'script', 'noscript',
 
 
 def codepoint2name(code):
-    """ Return entity definition by code, or code 
-    if there is no such entity definition"""
+    """ 
+    Return entity definition by code, or code 
+    if there is no such entity definition
+    """
     entity = htmlentitydefs.codepoint2name.get(code)
     if entity:
-        return "%s%s;" % (AND_SUBSTITUTE, entity)
+        return "%s%s;" % (AMP_SUBSTITUTE, entity)
     else:
-        return "%s#%d;" % (AND_SUBSTITUTE, code)
+        return "%s#%d;" % (AMP_SUBSTITUTE, code)
     
 def handleAttributes(text, parent):
     """ Handale attributes, e.g {@id=123} """
             el.text += codepoint2name(ord(letter))
 
         mailto = "mailto:" + email
-        mailto = "".join([AND_SUBSTITUTE + '#%d;' % 
+        mailto = "".join([AMP_SUBSTITUTE + '#%d;' % 
                           ord(letter) for letter in mailto])
         el.set('href', mailto)
         return el
 
     def run(self, text):
 
-        text =  text.replace(AND_SUBSTITUTE, "&")
+        text =  text.replace(AMP_SUBSTITUTE, "&")
         return text
 
-ANDSUBSTITUTETEXTPOSTPROCESSOR = AndSubstitutePostprocessor()
+AMPSUBSTITUTETEXTPOSTPROCESSOR = AndSubstitutePostprocessor()
 
 
 """
         self.textPostprocessors = [# a footnote postprocessor will get
                                    # inserted here
                                    RAWHTMLTEXTPOSTPROCESSOR,
-                                   ANDSUBSTITUTETEXTPOSTPROCESSOR]
+                                   AMPSUBSTITUTETEXTPOSTPROCESSOR]
 
         self.prePatterns = []
                                
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.