##// END OF EJS Templates
minirst: support line blocks
Martin Geisler -
r10447:e957cc7c default
parent child Browse files
Show More
@@ -111,7 +111,7 b' def findliteralblocks(blocks):'
111 i += 1
111 i += 1
112 return blocks
112 return blocks
113
113
114 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)) ')
114 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
115 _optionre = re.compile(r'^(--[a-z-]+)((?:[ =][a-zA-Z][\w-]*)? +)(.*)$')
115 _optionre = re.compile(r'^(--[a-z-]+)((?:[ =][a-zA-Z][\w-]*)? +)(.*)$')
116 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
116 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
117 _definitionre = re.compile(r'[^ ]')
117 _definitionre = re.compile(r'[^ ]')
@@ -291,8 +291,13 b' def formatblock(block, width):'
291 subsequent_indent=defindent))
291 subsequent_indent=defindent))
292 initindent = subindent = indent
292 initindent = subindent = indent
293 if block['type'] == 'bullet':
293 if block['type'] == 'bullet':
294 m = _bulletre.match(block['lines'][0])
294 if block['lines'][0].startswith('| '):
295 subindent = indent + m.end() * ' '
295 # Remove bullet for line blocks and add no extra
296 # indention.
297 block['lines'][0] = block['lines'][0][2:]
298 else:
299 m = _bulletre.match(block['lines'][0])
300 subindent = indent + m.end() * ' '
296 elif block['type'] == 'field':
301 elif block['type'] == 'field':
297 keywidth = block['keywidth']
302 keywidth = block['keywidth']
298 key = block['key']
303 key = block['key']
@@ -106,6 +106,12 b' 2. Continuing with the second item.'
106
106
107 1) Another
107 1) Another
108 2) List
108 2) List
109
110 Line blocks are also a form of list:
111
112 | This is the first line.
113 The line continues here.
114 | This is the second line.
109 """
115 """
110
116
111 debugformat('lists', lists, 60)
117 debugformat('lists', lists, 60)
@@ -120,6 +120,11 b' 2. Continuing with the second item.'
120 (2) bar
120 (2) bar
121 1) Another
121 1) Another
122 2) List
122 2) List
123
124 Line blocks are also a form of list:
125
126 This is the first line. The line continues here.
127 This is the second line.
123 ----------------------------------------------------------------------
128 ----------------------------------------------------------------------
124
129
125 lists formatted to fit within 30 characters:
130 lists formatted to fit within 30 characters:
@@ -157,6 +162,13 b' 2. Continuing with the second'
157 (2) bar
162 (2) bar
158 1) Another
163 1) Another
159 2) List
164 2) List
165
166 Line blocks are also a form of
167 list:
168
169 This is the first line. The
170 line continues here.
171 This is the second line.
160 ----------------------------------------------------------------------
172 ----------------------------------------------------------------------
161
173
162 options formatted to fit within 60 characters:
174 options formatted to fit within 60 characters:
General Comments 0
You need to be logged in to leave comments. Login now