ó Šç\c@@s0dZddlmZddlmZddlmZmZddlZddlZddl Z ddl m Z ddl m Z dd lmZdd lmZdd lmZdd lmZdd lmZddlmZmZdddgZe jdƒZdefd„ƒYZd„Z d„Z!dS(uÚ Python Markdown =============== Python Markdown converts Markdown to HTML and can be used as a library or called from the command line. ## Basic usage as a module: import markdown html = markdown.markdown(your_text_string) See for more information and instructions on how to extend the functionality of Python Markdown. Read that before you try modifying this file. ## Authors and License Started by [Manfred Stienstra](http://www.dwerg.net/). Continued and maintained by [Yuri Takhteyev](http://www.freewisdom.org), [Waylan Limberg](http://achinghead.com/) and [Artem Yunusov](http://blog.splyer.com). Contact: markdown@freewisdom.org Copyright 2007-2013 The Python Markdown Project (v. 1.7 and later) Copyright 200? Django Software Foundation (OrderedDict implementation) Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) Copyright 2004 Manfred Stienstra (the original version) License: BSD (see LICENSE for details). i(tabsolute_import(tunicode_literalsi(tversiont version_infoN(tutil(tbuild_preprocessors(tbuild_block_parser(tbuild_treeprocessors(tbuild_inlinepatterns(tbuild_postprocessors(t Extension(tto_html_stringtto_xhtml_stringuMarkdownumarkdownumarkdownFromFileuMARKDOWNtMarkdowncB@seZdZdZidd6dd6ed6ed6ed6Zied 6ed 6ed 6ed 6ed 6ed6ZddddddddddddddddgZ d„Z d „Z d!„Z gd"„Z d#„Zd$„Zd%„Zd&„Zd(d(d(d'„ZRS()uConvert Markdown to HTML.udivu[HTML_REMOVED]uhtml_replacement_textiu tab_lengthuenable_attributesusmart_emphasisulazy_oluhtmluhtml4uhtml5uxhtmluxhtml1uxhtml5u\u`u*u_u{u}u[u]u(u)u>u#u+u-u.u!cO@snddddg}d}xO|D]G}|||krF||||iuu<%s />u4Markdown failed to strip top-level tags. Document=%rN(R@Rt text_typetUnicodeDecodeErrortreasonR>tlinesR,tvaluestrunR-t parseDocumenttgetrootR/R6RYRtindextdoc_tagRtrindext ValueErrortendswithR0( R#tsourceROtpreptroott treeprocessortnewRoottoutputtstarttendtpp((s5/usr/lib/python2.7/site-packages/markdown/__init__.pytconvertüs8    '  c C@s“|p d}|rpt|tjƒrBtj|ddd|ƒ}ntj|ƒ|ƒ}|jƒ}|jƒn3tj jƒ}t|tj ƒs£|j |ƒ}n|j dƒ}|j |ƒ}|rBt|tjƒrtj|dd|ddƒ}|j|ƒ|jƒqtj|ƒ}||ddƒ}|j|ƒnM|j|dƒ}ytjjj|ƒWn!tk rŽtjj|ƒnX|S( u?Converts a markdown file and returns the HTML as a unicode string. Decodes the file using the provided encoding (defaults to utf-8), passes the file content to markdown, and outputs the html to either the provided stream or the file with provided name, using the same encoding as the source file. The 'xmlcharrefreplace' error handler is used when encoding the output. **Note:** This is the only place that decoding and encoding of unicode takes place in Python-Markdown. (All other code is unicode-in / unicode-out.) Keyword arguments: * input: File object or path. Reads from stdin if `None`. * output: File object or path. Writes to stdout if `None`. * encoding: Encoding of input and output files. Defaults to utf-8. uutf-8tmodeurtencodinguuwterrorsuxmlcharrefreplace(R1RR2tcodecstopent getreadertreadtclosetsyststdinR`tdecodetlstripRvtwritet getwritertencodetstdouttbufferRF( R#tinputRrRxt input_filettextthtmlt output_filetwriter((s5/usr/lib/python2.7/site-packages/markdown/__init__.pyt convertFile@s8       N(R:R9t__doc__RiRRR R RXt ESCAPED_CHARSR+RR R3RSR"R!RvR6RŽ(((s5/usr/lib/python2.7/site-packages/markdown/__init__.pyR 5s4   ?  .   DcO@st||Ž}|j|ƒS(uÔConvert a markdown string to HTML and return HTML as a unicode string. This is a shortcut function for `Markdown` class to cover the most basic use case. It initializes an instance of Markdown, loads the necessary extensions and runs the parser on the given text. Keyword arguments: * text: Markdown formatted text as Unicode or ASCII string. * Any arguments accepted by the Markdown class. Returns: An HTML document as a string. (R Rv(RŠR$R%tmd((s5/usr/lib/python2.7/site-packages/markdown/__init__.pytmarkdown‹scO@s±ddddg}d}xO|D]G}|||krF||||s(   ÿW