ó Šį\c@@sŲdZddlmZddlmZddlmZddlmZddlm Z dd l m Z m Z dd l Z e jd ƒZd efd „ƒYZdefd„ƒYZde fd„ƒYZd d„Zd S(uĢ Abbreviation Extension for Python-Markdown ========================================== This extension adds abbreviation handling to Python-Markdown. Simple Usage: >>> import markdown >>> text = """ ... Some text with an ABBR and a REF. Ignore REFERENCE and ref. ... ... *[ABBR]: Abbreviation ... *[REF]: Abbreviation Reference ... """ >>> print markdown.markdown(text, ['abbr'])

Some text with an ABBR and a REF. Ignore REFERENCE and ref.

Copyright 2007-2008 * [Waylan Limberg](http://achinghead.com/) * [Seemant Kulleen](http://www.kulleen.org/) i(tabsolute_import(tunicode_literalsi(t Extensioni(t Preprocessor(tPattern(tetreet AtomicStringNu,[*]\[(?P[^\]]*)\][ ]?:\s*(?P.*)t ���AbbrExtensionc�����������B@�s���e��Z�d��Z�d�„��Z�RS(���u-��� Abbreviation Extension for Python-Markdown. c���������C@�s ���|�j��j�d�t�|�ƒ�d�ƒ�d�S(���u7��� Insert AbbrPreprocessor before ReferencePreprocessor. u���abbru ���<referenceN(���t ���preprocessorst���addt���AbbrPreprocessor(���t���selft���mdt ���md_globals(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyt���extendMarkdown(���s����(���t���__name__t ���__module__t���__doc__R���(����(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyR���%���s���R ���c�����������B@�s ���e��Z�d��Z�d�„��Z�d�„��Z�RS(���u=��� Abbreviation Preprocessor - parse text for abbr references. c���������C@�s���g��}�xƒ�|�D]{�}�t��j�|�ƒ�}�|�r{�|�j�d�ƒ�j�ƒ��}�|�j�d�ƒ�j�ƒ��}�t�|��j�|�ƒ�|�ƒ�|��j�j�d�|�<q �|�j�|�ƒ�q �W|�S(���uĒ��� Find and remove all Abbreviation references from the text. Each reference is set as a new AbbrPattern in the markdown instance. u���abbru���titleu���abbr-%s( ���t ���ABBR_REF_REt���matcht���groupt���stript ���AbbrPatternt���_generate_patternt���markdownt���inlinePatternst���append(���R ���t���linest���new_textt���linet���mt���abbrt���title(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyt���run0���s���� )c���������C@�sL���t��|�ƒ�}�x,�t�t�|�ƒ�ƒ�D]�}�d�|�|�|�|�<q�Wd�d�j�|�ƒ�S(���u �� Given a string, returns an regex pattern to match that string. 'HTML' -> r'(?P<abbr>[H][T][M][L])' Note: we force each char as a literal match (in brackets) as we don't know what they will be beforehand. u���[%s]u���(?P<abbr>\b%s\b)u����(���t���listt���ranget���lent���join(���R ���t���textt���charst���i(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyR���B���s���� (���R���R���R���R!���R���(����(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyR ���-���s��� R���c�����������B@�s ���e��Z�d��Z�d�„��Z�d�„��Z�RS(���u��� Abbreviation inline pattern. c���������C@�s#���t��t�|��ƒ�j�|�ƒ�|�|��_�d��S(���N(���t���superR���t���__init__R ���(���R ���t���patternR ���(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyR*���U���s����c���������C@�s>���t��j�d�ƒ�}�t�|�j�d�ƒ�ƒ�|�_�|�j�d�|��j�ƒ�|�S(���Nu���abbru���title(���R���t���ElementR���R���R&���t���setR ���(���R ���R���R���(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyt ���handleMatchY���s����(���R���R���R���R*���R.���(����(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyR���R���s��� c���������C@�s ���t��d�|��ƒ�S(���Nt���configs(���R���(���R/���(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyt ���makeExtension_���s����(���R���t ���__future__R����R���t����R���R���R���t���inlinepatternsR���t���utilR���R���t���ret���compileR���R���R ���R���t���NoneR0���(����(����(����s<���/usr/lib/python2.7/site-packages/markdown/extensions/abbr.pyt���<module>���s��� %