comparison mercurial/minirst.py @ 9291:cd5b6a11b607

minirst: indent literal blocks with two spaces The vast majority* of them are formatted like this in the source, so this basically reverts the output to how it looked before we got the minirst parser. *: the help on templating use four spaces for some examples and will now shown with an indentation of just two spaces.
author Martin Geisler <mg@lazybytes.net>
date Sun, 02 Aug 2009 17:17:17 +0200
parents c9c7e8cdac9c
children 01e580143423
comparison
equal deleted inserted replaced
9290:26fb5b0a4424 9291:cd5b6a11b607
241 def formatblock(block, width): 241 def formatblock(block, width):
242 """Format a block according to width.""" 242 """Format a block according to width."""
243 indent = ' ' * block['indent'] 243 indent = ' ' * block['indent']
244 if block['type'] == 'margin': 244 if block['type'] == 'margin':
245 return '' 245 return ''
246 elif block['type'] in ('literal', 'section'): 246 elif block['type'] == 'literal':
247 indent += ' '
248 return indent + ('\n' + indent).join(block['lines'])
249 elif block['type'] == 'section':
247 return indent + ('\n' + indent).join(block['lines']) 250 return indent + ('\n' + indent).join(block['lines'])
248 elif block['type'] == 'definition': 251 elif block['type'] == 'definition':
249 term = indent + block['lines'][0] 252 term = indent + block['lines'][0]
250 defindent = indent + block['hang'] * ' ' 253 defindent = indent + block['hang'] * ' '
251 text = ' '.join(map(str.strip, block['lines'][1:])) 254 text = ' '.join(map(str.strip, block['lines'][1:]))