Ńň éíŃXc@s“dZddkZddkZd„Zdeifd„ƒYZdeiifd„ƒYZdd„Z e d joddk Z e i ƒndS( s\ WikiLinks Extension for Python-Markdown ====================================== Converts [[WikiLinks]] to relative links. Requires Python-Markdown 2.0+ Basic usage: >>> import markdown >>> text = "Some text with a [[WikiLink]]." >>> html = markdown.markdown(text, ['wikilinks']) >>> html u'

Some text with a WikiLink.

' Whitespace behavior: >>> markdown.markdown('[[ foo bar_baz ]]', ['wikilinks']) u'

foo bar_baz

' >>> markdown.markdown('foo [[ ]] bar', ['wikilinks']) u'

foo bar

' To define custom settings the simple way: >>> markdown.markdown(text, ... ['wikilinks(base_url=/wiki/,end_url=.html,html_class=foo)'] ... ) u'

Some text with a WikiLink.

' Custom settings the complex way: >>> md = markdown.Markdown( ... extensions = ['wikilinks'], ... extension_configs = {'wikilinks': [ ... ('base_url', 'http://example.com/'), ... ('end_url', '.html'), ... ('html_class', '') ]}, ... safe_mode = True) >>> md.convert(text) u'

Some text with a WikiLink.

' Use MetaData with mdx_meta.py (Note the blank html_class in MetaData): >>> text = """wiki_base_url: http://example.com/ ... wiki_end_url: .html ... wiki_html_class: ... ... Some text with a [[WikiLink]].""" >>> md = markdown.Markdown(extensions=['meta', 'wikilinks']) >>> md.convert(text) u'

Some text with a WikiLink.

' MetaData should not carry over to next document: >>> md.convert("No [[MetaData]] here.") u'

No MetaData here.

' Define a custom URL builder: >>> def my_url_builder(label, base, end): ... return '/bar/' >>> md = markdown.Markdown(extensions=['wikilinks'], ... extension_configs={'wikilinks' : [('build_url', my_url_builder)]}) >>> md.convert('[[foo]]') u'

foo

' From the command line: python markdown.py -x wikilinks(base_url=http://example.com/,end_url=.html,html_class=foo) src.txt By [Waylan Limberg](http://achinghead.com/). License: [BSD](http://www.opensource.org/licenses/bsd-license.php) Dependencies: * [Python 2.3+](http://python.org) * [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/) i˙˙˙˙NcCs&tidd|ƒ}d|||fS(s1 Build a url from the label, a base, and an end. s([ ]+_)|(_[ ]+)|([ ]+)t_s%s%s%s(tretsub(tlabeltbasetendt clean_label((sA/usr/lib/python2.6/site-packages/markdown/extensions/wikilinks.pyt build_urlSstWikiLinkExtensioncBseZd„Zd„ZRS(cCshhddgd6ddgd6ddgd6td gd 6|_x$|D]\}}|i||ƒqDWdS( Nt/s%String to append to beginning or URL.tbase_urlsString to append to end of URL.tend_urltwikilinksCSS hook. Leave blank for none.t html_classs Callable formats URL from label.R(Rtconfigt setConfig(tselftconfigstkeytvalue((sA/usr/lib/python2.6/site-packages/markdown/extensions/wikilinks.pyt__init__Zs    cCsD||_d}t||iƒ}||_|iid|dƒdS(Ns\[\[([A-Za-z0-9_ -]+)\]\]R s Ns   "