aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-03-21 08:30:28 -0400
committerWaylan Limberg <waylan@gmail.com>2009-03-21 08:30:28 -0400
commitd633e83d818c6198ba26f2265243475c0db1dd58 (patch)
tree2cb538a9263d4d0cc09f5866191a8a691e82d41b
parent4e3ca945b7f1df90052e221fd24d7ec7dbeb38ac (diff)
downloadmarkdown-d633e83d818c6198ba26f2265243475c0db1dd58.tar.gz
markdown-d633e83d818c6198ba26f2265243475c0db1dd58.tar.bz2
markdown-d633e83d818c6198ba26f2265243475c0db1dd58.zip
Fixed a documentation error with recent wikilinks update and added a regression test to make sure it continues to work.
-rw-r--r--docs/extensions/WikiLinks.txt2
-rw-r--r--markdown/extensions/wikilinks.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/extensions/WikiLinks.txt b/docs/extensions/WikiLinks.txt
index 36045cb..8bbead5 100644
--- a/docs/extensions/WikiLinks.txt
+++ b/docs/extensions/WikiLinks.txt
@@ -86,7 +86,7 @@ could also pass in a callable which must accept three arguments (``label``,
md = markdown.Markdown(
extensions=['wikilinks],
- extension_configs={'wikilinks' : ('build_url', my_url_builder)}
+ extension_configs={'wikilinks' : [('build_url', my_url_builder)]}
)
diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py
index feb55b3..df44e1c 100644
--- a/markdown/extensions/wikilinks.py
+++ b/markdown/extensions/wikilinks.py
@@ -56,6 +56,15 @@ MetaData should not carry over to next document:
>>> md.convert("No [[MetaData]] here.")
u'<p>No <a class="wikilink" href="/MetaData/">MetaData</a> here.</p>'
+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'<p><a class="wikilink" href="/bar/">foo</a></p>'
+
From the command line:
python markdown.py -x wikilinks(base_url=http://example.com/,end_url=.html,html_class=foo) src.txt