Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 756 Bytes

File metadata and controls

31 lines (26 loc) · 756 Bytes

Simple markup langage for python

import mrkev
code = '''
[Html :=[
    <html>[Header][Body]</html>
] Header=[
    <head><title>[#title]</title></head>
] Body=[
    <body>[@]</body>
]]
[Html [Hello world!]]
'''
print mrkev.Template(code).render(title=u'New Page')

is converted into

<html><head><title>New page</title></head><body>Hello world!</body></html>

Features

  • runtime safe - templates cannot run own python code
  • sandboxed function - template can be extended by new functions and syntax elements
  • simple syntax - only two characters to escape

Authors