mercurial/minirst.py
changeset 11192 babf9a5f5528
parent 11189 3ef2572de32f
child 11297 d320e70442a5
equal deleted inserted replaced
11191:c45a47bc4114 11192:babf9a5f5528
   255         if b['type'] in ('paragraph', 'section'):
   255         if b['type'] in ('paragraph', 'section'):
   256             b['lines'] = [l.replace('``', '"') for l in b['lines']]
   256             b['lines'] = [l.replace('``', '"') for l in b['lines']]
   257     return blocks
   257     return blocks
   258 
   258 
   259 
   259 
   260 _hgrolere = re.compile(r':hg:`([^`]+)`')
       
   261 
       
   262 def hgrole(blocks):
   260 def hgrole(blocks):
   263     for b in blocks:
   261     for b in blocks:
   264         if b['type'] in ('paragraph', 'section'):
   262         if b['type'] in ('paragraph', 'section'):
   265             b['lines'] = [_hgrolere.sub(r'"hg \1"', l) for l in b['lines']]
   263             # Turn :hg:`command` into "hg command". This also works
       
   264             # when there is a line break in the command and relies on
       
   265             # the fact that we have no stray back-quotes in the input
       
   266             # (run the blocks through inlineliterals first).
       
   267             b['lines'] = [l.replace(':hg:`', '"hg ').replace('`', '"')
       
   268                           for l in b['lines']]
   266     return blocks
   269     return blocks
   267 
   270 
   268 
   271 
   269 def addmargins(blocks):
   272 def addmargins(blocks):
   270     """Adds empty blocks for vertical spacing.
   273     """Adds empty blocks for vertical spacing.