\ @sddlmZddlZddlZejddkZerVeZeZe Z ne Ze Ze Z ejdejZdZdZedZedeZejed Zed eZed eZejed Zed eZd#ZyMddljjZddlmZee_ ej!dkrCe"dnWnHe#e"fk rddljj$Zej!dkre"dnYnXddZ%dddZ&GdddeZ'Gddde(Z)Gdd d e(Z*dS)$)unicode_literalsNz^(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|hr|hr/|style|li|dt|dd|thead|tbody|tr|th|td|section|footer|header|group|figure|figcaption|aside|article|canvas|output|progress|video|nav)$zklzzwxh:z%sz([0-9]+)Zampz wzxhzdk:%sz hzzhzkh:%s֐߿ⴰ⵿)Commentz1.0.5z1cElementTree version 1.0.5 or higher is required.z1.1z-ElementTree version 1.1 or higher is requiredcCs t|trtj|SdS)z+Check if the tag is a block level HTML tag.F) isinstance string_typeBLOCK_LEVEL_ELEMENTSmatch)tagrbuild/lib/markdown/util.py isBlockLevelQs rTcCsbt|tst|S|jdkr/dS|jdkrEd S|r^td |ndS)zParses a string representing bool value. If parsing was successful, returns True or False. If parsing was not successful, raises ValueError, or, if fail_on_errors=False, returns None.trueyesyon1Tfalsenonoff0FzCannot parse bool value: %rN)ztruezyesrzonr)zfalseznorzoffr)r r boollower ValueError)valueZfail_on_errorsrrrparseBoolValueXs r!c@seZdZdZdS) AtomicStringz/A string which should not be further processed.N)__name__ __module__ __qualname____doc__rrrrr"js r"c@seZdZdddZdS) ProcessorNcCs|r||_ndS)N)markdown)selfZmarkdown_instancerrr__init__pszProcessor.__init__)r#r$r%r*rrrrr'os r'c@sUeZdZdZddZdddZddZd d Zd d Zd S) HtmlStashz{ This class is used for stashing HTML objects that we extract in the beginning and replace with place-holders. cCs(d|_g|_d|_g|_dS)z Create a HtmlStash. rN) html_counter rawHtmlBlocks tag_countertag_data)r)rrrr*{s   zHtmlStash.__init__FcCs;|jj||f|j|j}|jd7_|S)a: Saves an HTML segment for later reinsertion. Returns a placeholder string that needs to be inserted into the document. Keyword arguments: * html: an html segment * safe: label an html segment as safe for safemode Returns : a placeholder string )r-appendget_placeholderr,)r)htmlZsafe placeholderrrrstoreszHtmlStash.storecCsd|_g|_dS)Nr)r,r-)r)rrrresets zHtmlStash.resetcCst|S)N)HTML_PLACEHOLDER)r)keyrrrr2szHtmlStash.get_placeholdercCsR|jji|d6|d6|d6|d6tt|j}|jd7_|S)z(Store tag data and return a placeholder.rattrs left_index right_indexr0)r/r1TAG_PLACEHOLDERstrr.)r)rr9r:r;r4rrr store_tags  zHtmlStash.store_tagN) r#r$r%r&r*r5r6r2r>rrrrr+us    r+rrrr )r?r@)+ __future__rresys version_infoZPY3r=r text_typechrZint2strZ basestringunicodeZunichrcompile IGNORECASEr ZSTXZETXZINLINE_PLACEHOLDER_PREFIXZINLINE_PLACEHOLDERZINLINE_PLACEHOLDER_REZAMP_SUBSTITUTEr7ZHTML_PLACEHOLDER_REr<ZRTL_BIDI_RANGESZxml.etree.cElementTreeZetreeZ cElementTreeZxml.etree.ElementTreer Z test_commentVERSION RuntimeError ImportErrorZ ElementTreerr!r"objectr'r+rrrrsL