Details

Applies to
moin-1.5.5a
Purpose
Allow multiline macros in rst
Description

A simple modification, such that not only the first line is used with the .. macro:: directive in rst. I needed this, because I wanted to copy an rst-file with long "latex/itex" calls into moinmoin

Patch

   1 Index: rst.py
   2 ===================================================================
   3 RCS file: /cvs/TPS/moin/MoinMoin/parser/rst.py,v
   4 retrieving revision 1.1.1.4
   5 diff -u -r1.1.1.4 rst.py
   6 --- rst.py      16 Sep 2006 20:31:36 -0000      1.1.1.4
   7 +++ rst.py      16 Nov 2006 00:37:38 -0000
   8 @@ -586,11 +586,10 @@
   9                  content_offset, block_text, state, state_machine):
  10          # content contains macro to be called
  11          if len(content):
  12 +            macro = " ".join( content )
  13              # Allow either with or without brackets
  14 -            if content[0].startswith('[['):
  15 -                macro = content[0]
  16 -            else:
  17 -                macro = '[[%s]]' % content[0]
  18 +            if not content[0].startswith('[['):
  19 +                macro = '[[%s]]' % macro
  20              ref = reference(macro, refuri = macro)
  21              ref['name'] = macro
  22              return [ref]
macro.patch

Discussion

A comment/question regarding this patch ... I had hoped that this was to allow markup like this

[[MyMacroName(arg_on_first_line,
arg_on_second_line)]]

which is something I need to support.

It appears that this is something different. Is this patch just for multi-line macro names?

Any suggestions for supporting this sort of multi-line macro would be appreciated.

-- DavidMontgomery

I have no idea about rst and don't use it myself, so comments from other rst users about this patch are welcome. -- ThomasWaldmann 2006-12-23 16:55:51

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/RstParserMultilineMacros (last edited 2007-10-29 19:08:23 by localhost)