Show More
@@ -452,7 +452,7 def findadmonitions(blocks, admonitions= | |||||
452 | } |
|
452 | } | |
453 |
|
453 | |||
454 | def formatoption(block, width): |
|
454 | def formatoption(block, width): | |
455 |
desc = ' '.join(map( |
|
455 | desc = ' '.join(map(bytes.strip, block['lines'])) | |
456 | colwidth = encoding.colwidth(block['optstr']) |
|
456 | colwidth = encoding.colwidth(block['optstr']) | |
457 | usablewidth = width - 1 |
|
457 | usablewidth = width - 1 | |
458 | hanging = block['optstrwidth'] |
|
458 | hanging = block['optstrwidth'] | |
@@ -474,7 +474,7 def formatblock(block, width): | |||||
474 | hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) |
|
474 | hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) | |
475 |
|
475 | |||
476 | defindent = indent + hang * ' ' |
|
476 | defindent = indent + hang * ' ' | |
477 |
text = ' '.join(map( |
|
477 | text = ' '.join(map(bytes.strip, block['lines'])) | |
478 | return '%s\n%s\n' % (indent + admonition, |
|
478 | return '%s\n%s\n' % (indent + admonition, | |
479 | util.wrap(text, width=width, |
|
479 | util.wrap(text, width=width, | |
480 | initindent=defindent, |
|
480 | initindent=defindent, | |
@@ -512,7 +512,7 def formatblock(block, width): | |||||
512 | term = indent + block['lines'][0] |
|
512 | term = indent + block['lines'][0] | |
513 | hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) |
|
513 | hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) | |
514 | defindent = indent + hang * ' ' |
|
514 | defindent = indent + hang * ' ' | |
515 |
text = ' '.join(map( |
|
515 | text = ' '.join(map(bytes.strip, block['lines'][1:])) | |
516 | return '%s\n%s\n' % (term, util.wrap(text, width=width, |
|
516 | return '%s\n%s\n' % (term, util.wrap(text, width=width, | |
517 | initindent=defindent, |
|
517 | initindent=defindent, | |
518 | hangindent=defindent)) |
|
518 | hangindent=defindent)) | |
@@ -567,7 +567,7 def formathtml(blocks): | |||||
567 |
|
567 | |||
568 | if btype == 'admonition': |
|
568 | if btype == 'admonition': | |
569 | admonition = escape(_admonitiontitles[b['admonitiontitle']]) |
|
569 | admonition = escape(_admonitiontitles[b['admonitiontitle']]) | |
570 |
text = escape(' '.join(map( |
|
570 | text = escape(' '.join(map(bytes.strip, lines))) | |
571 | out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text)) |
|
571 | out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text)) | |
572 | elif btype == 'paragraph': |
|
572 | elif btype == 'paragraph': | |
573 | out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines))) |
|
573 | out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines))) | |
@@ -597,7 +597,7 def formathtml(blocks): | |||||
597 | elif btype == 'definition': |
|
597 | elif btype == 'definition': | |
598 | openlist('dl', level) |
|
598 | openlist('dl', level) | |
599 | term = escape(lines[0]) |
|
599 | term = escape(lines[0]) | |
600 |
text = escape(' '.join(map( |
|
600 | text = escape(' '.join(map(bytes.strip, lines[1:]))) | |
601 | out.append(' <dt>%s\n <dd>%s\n' % (term, text)) |
|
601 | out.append(' <dt>%s\n <dd>%s\n' % (term, text)) | |
602 | elif btype == 'bullet': |
|
602 | elif btype == 'bullet': | |
603 | bullet, head = lines[0].split(' ', 1) |
|
603 | bullet, head = lines[0].split(' ', 1) | |
@@ -609,12 +609,12 def formathtml(blocks): | |||||
609 | elif btype == 'field': |
|
609 | elif btype == 'field': | |
610 | openlist('dl', level) |
|
610 | openlist('dl', level) | |
611 | key = escape(b['key']) |
|
611 | key = escape(b['key']) | |
612 |
text = escape(' '.join(map( |
|
612 | text = escape(' '.join(map(bytes.strip, lines))) | |
613 | out.append(' <dt>%s\n <dd>%s\n' % (key, text)) |
|
613 | out.append(' <dt>%s\n <dd>%s\n' % (key, text)) | |
614 | elif btype == 'option': |
|
614 | elif btype == 'option': | |
615 | openlist('dl', level) |
|
615 | openlist('dl', level) | |
616 | opt = escape(b['optstr']) |
|
616 | opt = escape(b['optstr']) | |
617 |
desc = escape(' '.join(map( |
|
617 | desc = escape(' '.join(map(bytes.strip, lines))) | |
618 | out.append(' <dt>%s\n <dd>%s\n' % (opt, desc)) |
|
618 | out.append(' <dt>%s\n <dd>%s\n' % (opt, desc)) | |
619 |
|
619 | |||
620 | # close lists if indent level of next block is lower |
|
620 | # close lists if indent level of next block is lower |
General Comments 0
You need to be logged in to leave comments.
Login now