doc/runrst
changeset 10972 0a2c6948f5f4
parent 10971 cbe400a8e217
child 10974 854ac04d712c
equal deleted inserted replaced
10971:cbe400a8e217 10972:0a2c6948f5f4
    11 
    11 
    12 where WRITER is the name of a Docutils writer such as 'html' or 'manpage'
    12 where WRITER is the name of a Docutils writer such as 'html' or 'manpage'
    13 """
    13 """
    14 
    14 
    15 import sys
    15 import sys
       
    16 from docutils.parsers.rst import roles
    16 from docutils.core import publish_cmdline
    17 from docutils.core import publish_cmdline
       
    18 from docutils import nodes, utils
       
    19 
       
    20 def role_hg(name, rawtext, text, lineno, inliner,
       
    21             options={}, content=[]):
       
    22     node = nodes.literal(rawtext, "hg " + utils.unescape(text, True))
       
    23     return [node], []
       
    24 
       
    25 roles.register_local_role("hg", role_hg)
    17 
    26 
    18 if __name__ == "__main__":
    27 if __name__ == "__main__":
    19     if len(sys.argv) < 2:
    28     if len(sys.argv) < 2:
    20         sys.stderr.write(__doc__ % sys.argv[0])
    29         sys.stderr.write(__doc__ % sys.argv[0])
    21         sys.exit(1)
    30         sys.exit(1)