@ -33,7 +33,7 @@ print repr(package_data)
setup(
name='zippydoc',
version='1.0',
version='1.1',
maintainer='Sven Slootweg',
maintainer_email='admin@cryto.net',
description='Documentation markup language and library, including HTML converter.',
@ -231,6 +231,21 @@ starting a new block.
$$ ####### This is a level 7 (smallest) header.
^ List block
! This block cannot have child elements!
A list block is a list containing items. In HTML, it's rendered as a bulletpoint list. Each item is prefixed with an asterisk. Items can consist of multiple lines.
@ Using list blocks
* This is item one.
* This is item three.
* This is item two. We can
even make it continue
onto the next lines.
* This is item four.
^ Text block
@ -35,6 +35,10 @@ class Text(TreeLevel):
def transform(self, ruleset):
return ruleset.transform_text(Value(self.data))
class List(TreeLevel):
return ruleset.transform_list([Value(line) for line in self.data])
class Exclamation(TreeLevel):
return ruleset.transform_exclamation(Value(self.data), self.transform_children(ruleset))
@ -63,6 +63,9 @@ class Document(object):
# Exclamation
lines[0] = lines[0].lstrip("! ")
element = block_markup.Exclamation(indentation, " ".join(lines))
elif lines[0].startswith("* "):
items = [item.replace("\n", " ") for item in "\n".join(lines)[2:].split("\n*")]
element = block_markup.List(indentation, items)
elif re.match(".*::\s*$", lines[0]):
# Argument definition
argname = re.match("(.*)::\s*$", lines[0]).group(1)
@ -25,6 +25,9 @@ class TransformationRuleset(object):
def transform_text(self, text):
pass
def transform_list(self, items):
def transform_reference(self, target, description):
@ -60,6 +60,9 @@ class HtmlRuleset(zippydoc.TransformationRuleset):
return '<div class="text">%s</div>' % text.transform(self)
return '<ul>%s</ul>' % "".join("<li>%s</li>" % item.transform(self) for item in items)
return '<a href="%s.html">%s</a>' % (target, description.transform(self))