Browse files

The Paragraph macro doesn't parse its arguments

--HG--
branch : sneakylang
  • Loading branch information...
1 parent 14abc38 commit 4a5cf14b59162bc425280a362f6d22e165aadd20 andros committed Mar 25, 2009
View
7 sneakylang/macro.py
@@ -10,8 +10,7 @@
class Macro(object):
""" All macros should derive from this class """
name = None # define macro name
- help = """<this macro haven't specified usage example>"""
- parsers_allowed = None
+ help = "<this macro doesn't have usage example>"
def __init__(self, register_map, builder, state=None):
object.__init__(self)
@@ -22,7 +21,7 @@ def __init__(self, register_map, builder, state=None):
self.state = state
def get_argument_list(self, argument_string):
- """ DEPRECATED: Use get_arguments instead.
+ """ DEPRECATED: Use get_arguments instead.
Return list of arguments. Uses ARGUMENT_SEPARATOR as argument separator."""
return parse_macro_arguments(argument_string)
@@ -64,4 +63,4 @@ def _get_register(self):
from register import Register
return Register()
- register = property(fget=_get_register)
+ register = property(fget=_get_register)
View
2 sneakylang/macro_caller.py
@@ -105,7 +105,7 @@ def parse_macro_arguments(argument_string, return_kwargs=False):
last_char = char
if len(buffer) > 0:
- # FIXME: This is cut& pasted from char == ARGUMENT_SEPARATOR
+ # FIXME: This is cut & pasted from char == ARGUMENT_SEPARATOR
if len(buffer) > 0:
if current_kwarg_name:
if kwargs.has_key(current_kwarg_name):
View
7 sneakylang/test/module_test.py
@@ -77,11 +77,9 @@ class ParagraphNode(Node): pass
class ParagraphMacro(Macro):
name = 'odstavec'
help = '((odstavec text odstavce))'
- parsersAllowed = ['Strong']
- @classmethod
- def get_argument_list(self, argument_string):
- return [argument_string]
+ def parse_argument_string(self, argument_string):
+ self.arguments = [argument_string]
def expand_to_nodes(self, *args):
if len(args) < 1:
@@ -151,7 +149,6 @@ def resolve_argument_string(self):
if not end:
logging.debug('End %s of macro %s not found, rolling back' % (self.__class__.end, self))
raise ParserRollback
- self.stream = s
self.argument_string = self.stream[0:end.start()]
self.stream = self.stream[end.end():]
View
0 sneakylang/test/test_macro.py 100644 → 100755
File mode changed.
View
0 sneakylang/test/test_macro_caller.py 100644 → 100755
File mode changed.
View
8 sneakylang/test/test_macro_syntax.py 100644 → 100755
@@ -78,14 +78,6 @@ def testProperNested(self):
self.assertEquals(o.children[0].children[1].__class__, TextNode)
self.assertEquals(o.children[0].children[1].content, ' text odstavce')
- def testProperNestedQuoted(self):
- s = '((odstavec "silne silny)) text odstavce"))'
- o = parse(s, self.register_map, document_root=True)
- self.assertEquals(len(o.children), 1)
- self.assertEquals(o.children[0].__class__, ParagraphNode)
- self.assertEquals(o.children[0].children[0].__class__, TextNode)
- self.assertEquals(o.children[0].children[0].content, 'silne silny)) text odstavce')
-
class TestKeywordMacroArguments(TestCase):
def setUp(self):
self.register_map = RegisterMap({
View
0 sneakylang/test/test_register.py 100644 → 100755
File mode changed.
View
1 sneakylang/test/test_regressions.py
@@ -79,4 +79,3 @@ def testExpandFromTreeWithEntitiesEnabled(self):
tn.content = '<b>not bold</b>'
p.children.append(tn)
self.assertEquals(expand(p, 'docbook5', node_map), '<para>&lt;b&gt;not bold&lt;/b&gt;</para>')
-

0 comments on commit 4a5cf14

Please sign in to comment.