def sub_notes(docs):
def substitute(match):<EOL><INDENT>ret = "<STR_LIT>""<STR_LIT>".format(NOTE_TYPE[match.group(<NUM_LIT:1>).lower()],<EOL>match.group(<NUM_LIT:1>).capitalize(), match.group(<NUM_LIT:2>))<EOL>if len(match.groups()) >= <NUM_LIT:4> and not match.group(<NUM_LIT:4>): ret += '<STR_LIT>'<EOL>return ret<EOL><DEDENT>for regex in NOTE_RE:<EOL><INDENT>docs = regex.sub(substitute,docs)<EOL><DEDENT>return docs<EOL>
Substitutes the special controls for notes, warnings, todos, and bugs with
the corresponding div.