From cfc428548286b75133e99cb4b0fed21a0d90c3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 20 Jun 2012 00:48:14 +0200 Subject: [PATCH] update rules, handle partly tables --- syntaxreference.txt | 47 ++++++++++++++++++++++++++++++++++++--------- text_dokuwiki.py | 11 +++++++---- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/syntaxreference.txt b/syntaxreference.txt index 624a763..3edcd1c 100644 --- a/syntaxreference.txt +++ b/syntaxreference.txt @@ -24,15 +24,6 @@ print code.colorize("abc", 1 + 1) foo = new something(1, "soo\nice") }}} -{{{ -plain -multiline block -with some ''text'' in it -fourth line - -sixth line! -}}} - = Bullet list = {{{ * item 1 @@ -63,3 +54,41 @@ sixth line! 1. item 2 a. item 1 a. item 2 + += Code display = +{{{ +line 1 + indented 4 characters +}}} + +{{{ +plain +multiline block +with some ''text'' in it +fourth line + +sixth line! +}}} + += Rules = +{{{ +--- (not a rule) +---- +----- +------ +------- +-------- +--------- +---------- +-------------------------------------------- (not thicker than 10) +}}} +--- (not a rule) +---- +----- +------ +------- +-------- +--------- +---------- +-------------------------------------------- (not thicker than 10) + diff --git a/text_dokuwiki.py b/text_dokuwiki.py index 58d6ac1..98999ef 100644 --- a/text_dokuwiki.py +++ b/text_dokuwiki.py @@ -89,7 +89,10 @@ class Formatter(FormatterBase): def rule(self, size=0, **kw): # size not supported - return '----\n' + if size >= 4: + return '----\n' + else: + return '-' * size + '\n' def icon(self, type): return '' % type @@ -162,13 +165,13 @@ class Formatter(FormatterBase): return u' %s' % (u'=' * heading_depth) def table(self, on, attrs={}, **kw): - return ['', '
'][not on] + return '' def table_row(self, on, attrs={}, **kw): - return ['', ''][not on] + return ['|', ''][on] def table_cell(self, on, attrs={}, **kw): - return ['', ''][not on] + return ['|', '|'][not on] def anchordef(self, id): return '' % id