update rules, handle partly tables

This commit is contained in:
Elan Ruusamäe 2012-06-20 00:48:14 +02:00
parent c15568c652
commit cfc4285482
2 changed files with 45 additions and 13 deletions

View file

@ -24,15 +24,6 @@ print code.colorize("abc", 1 + 1)
foo = new something(1, "soo\nice") foo = new something(1, "soo\nice")
}}} }}}
{{{
plain
multiline block
with some ''text'' in it
fourth line
sixth line!
}}}
= Bullet list = = Bullet list =
{{{ {{{
* item 1 * item 1
@ -63,3 +54,41 @@ sixth line!
1. item 2 1. item 2
a. item 1 a. item 1
a. item 2 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)

View file

@ -89,7 +89,10 @@ class Formatter(FormatterBase):
def rule(self, size=0, **kw): def rule(self, size=0, **kw):
# size not supported # size not supported
return '----\n' if size >= 4:
return '----\n'
else:
return '-' * size + '\n'
def icon(self, type): def icon(self, type):
return '<icon type="%s" />' % type return '<icon type="%s" />' % type
@ -162,13 +165,13 @@ class Formatter(FormatterBase):
return u' %s' % (u'=' * heading_depth) return u' %s' % (u'=' * heading_depth)
def table(self, on, attrs={}, **kw): def table(self, on, attrs={}, **kw):
return ['<table>', '</table>'][not on] return ''
def table_row(self, on, attrs={}, **kw): def table_row(self, on, attrs={}, **kw):
return ['<tr>', '</tr>'][not on] return ['|', ''][on]
def table_cell(self, on, attrs={}, **kw): def table_cell(self, on, attrs={}, **kw):
return ['<td>', '</td>'][not on] return ['|', '|'][not on]
def anchordef(self, id): def anchordef(self, id):
return '<anchor id="%s"/>' % id return '<anchor id="%s"/>' % id