parse few macros
This commit is contained in:
parent
a8d4d3b191
commit
a7759d6974
1 changed files with 21 additions and 0 deletions
|
@ -11,6 +11,7 @@ from xml.sax import saxutils
|
||||||
from MoinMoin.formatter.base import FormatterBase
|
from MoinMoin.formatter.base import FormatterBase
|
||||||
from MoinMoin import config
|
from MoinMoin import config
|
||||||
from MoinMoin.Page import Page
|
from MoinMoin.Page import Page
|
||||||
|
from types import *
|
||||||
|
|
||||||
# TODO: let base class MoinMoin/formatter/base.py handle not implemented methods
|
# TODO: let base class MoinMoin/formatter/base.py handle not implemented methods
|
||||||
|
|
||||||
|
@ -246,3 +247,23 @@ class Formatter(FormatterBase):
|
||||||
def code_token(self, on, tok_type):
|
def code_token(self, on, tok_type):
|
||||||
# not supported
|
# not supported
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
def macro(self, macro_obj, name, args):
|
||||||
|
def email(args):
|
||||||
|
mail = args.replace(' AT ', '@')
|
||||||
|
mail = mail.replace(' DOT ', '.')
|
||||||
|
return '[[mailto:%s|%s]]' % (mail, args)
|
||||||
|
|
||||||
|
try:
|
||||||
|
lookup = {
|
||||||
|
'BR' : '\\\\',
|
||||||
|
'MailTo' : email,
|
||||||
|
}[name]
|
||||||
|
except KeyError:
|
||||||
|
lookup = '/* UndefinedMacro: %s(%s) */' % (name, args)
|
||||||
|
|
||||||
|
if type(lookup) == FunctionType:
|
||||||
|
text = lookup(args)
|
||||||
|
else:
|
||||||
|
text = lookup
|
||||||
|
return text
|
||||||
|
|
Loading…
Reference in a new issue