+doctitle_re = re.compile (r'(doctitle[a-zA-Z_]{0,6}\s*=\s*")((?:\\"|[^"\n])*)"')
+texinfo_q_re = re.compile (r'@q{(.*?)}')
+texinfo_qq_re = re.compile (r'@qq{(.*?)}')
+def doctitle_sub (title_match):
+ # Comma forbidden in Texinfo node name
+ title = title_match.group (2).replace (',', '')
+ title = texinfo_q_re.sub (r"`\1'", title)
+ title = texinfo_qq_re.sub (r'\"\1\"', title)
+ return title_match.group (1) + title + '"'
+