MCPcopy
hub / github.com/apenwarr/redo / do

Function do

docs/md2man.py:196–231  ·  view source on GitHub ↗
(tag)

Source from the content-addressed store, hash-verified

194
195
196def do(tag):
197 name = getattr(tag, 'name', '').lower()
198 if not name:
199 text(tag)
200 elif name == 'h1':
201 macro('.SH', _force_string(tag, tag).upper())
202 w.started = True
203 elif name == 'h2':
204 macro('.SS', _force_string(tag, tag))
205 w.started = True
206 elif name.startswith('h') and len(name)==2:
207 raise ValueError('%r invalid - man page headers must be h1 or h2'
208 % name)
209 elif name == 'pre':
210 t = _force_string(tag.code, tag.code)
211 if t.strip():
212 macro('.RS', '+4n')
213 macro('.nf')
214 w.write(_clean(t).rstrip())
215 macro('.fi')
216 macro('.RE')
217 w.end_para()
218 elif name == 'p' or name == 'br':
219 g = re.match(re.compile(r'([^\n]*)\n *: +(.*)', re.S), str(tag))
220 if g:
221 # it's a definition list (which some versions of python-markdown
222 # don't support, including the one in Debian-lenny, so we can't
223 # enable that markdown extension). Fake it up.
224 do_definition(tag)
225 else:
226 text(tag)
227 w.end_para()
228 elif name == 'ul':
229 do_list(tag)
230 else:
231 raise ValueError('non-man-compatible html tag %r' % name)
232
233
234PROD='Untitled'

Callers 2

do_listFunction · 0.85
md2man.pyFile · 0.85

Calls 8

textFunction · 0.85
macroFunction · 0.85
_force_stringFunction · 0.85
_cleanFunction · 0.85
do_definitionFunction · 0.85
do_listFunction · 0.85
end_paraMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected