From 4784fc2080e4c6506264a5f3fe899e72d837b4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 20 Jun 2012 01:24:02 +0200 Subject: [PATCH] handle toc and anchorlink --- syntaxreference.txt | 11 +++++++++++ text_dokuwiki.py | 7 ++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/syntaxreference.txt b/syntaxreference.txt index 8848cde..9cae98a 100644 --- a/syntaxreference.txt +++ b/syntaxreference.txt @@ -1,4 +1,14 @@ +This page tries to use each supported markup element at least once. + +{{{ +'''Index''' +[[TableOfContents(2)]] +}}} +'''Index''' + +[[TableOfContents(2)]] + = Headers = == Header 2 == === Header 3 === @@ -24,6 +34,7 @@ print code.colorize("abc", 1 + 1) foo = new something(1, "soo\nice") }}} + = Hyperlinks = == Internal == {{{ diff --git a/text_dokuwiki.py b/text_dokuwiki.py index 090589f..e14c827 100644 --- a/text_dokuwiki.py +++ b/text_dokuwiki.py @@ -177,11 +177,8 @@ class Formatter(FormatterBase): return '' def anchorlink(self, on, name='', **kw): - id = kw.get('id',None) - extra = '' - if id: - extra = ' id="%s"' % id - return ('' % (name, extra) ,'') [not on] + # kw.id not supported, we hope the anchor matches existing heading on page + return ('[[#', ']]') [not on] def underline(self, on, **kw): return ['__', '__'][not on]