+def language_package(line):
+ return simple_renaming(line, "\\language_package", "\\language_custom_package")
+
+lfre = re.compile(r'^\\converter\s+"?(\w+)"?\s+"?(\w+)"?\s+"([^"]*?)"\s+"latex"')
+def latex_flavor(line):
+ if not line.startswith("\\converter"):
+ return no_match
+ m = lfre.match(line)
+ if not m:
+ return no_match
+ conv = m.group(1)
+ fmat = m.group(2)
+ args = m.group(3)
+ conv2fl = {
+ "luatex": "lualatex",
+ "pplatex": "latex",
+ "xetex": "xelatex",
+ }
+ if conv in conv2fl.keys():
+ flavor = conv2fl[conv]
+ else:
+ flavor = conv
+ if flavor == "latex":
+ return no_match
+ return (True,
+ "\\converter \"%s\" \"%s\" \"%s\" \"latex=%s\"" % (conv, fmat, args, flavor))
+
+emre = re.compile(r'^\\[Ff]ormat\s+(.*)\s+"(document[^"]*?)"')
+def export_menu(line):
+ if not line.lower().startswith("\\format"):
+ return no_match
+ m = emre.match(line)
+ if not m:
+ return no_match
+ fmat = m.group(1)
+ opts = m.group(2)
+ return (True,
+ "\\Format %s \"%s,menu=export\"" % (fmat, opts))
+
+zipre = re.compile(r'^\\[Ff]ormat\s+("?dia"?\s+.*)\s+"([^"]*?)"')
+def zipped_native(line):
+ if not line.lower().startswith("\\format"):
+ return no_match
+ m = zipre.match(line)
+ if not m:
+ return no_match
+ fmat = m.group(1)
+ opts = m.group(2)
+ return (True,
+ "\\Format %s \"%s,zipped=native\"" % (fmat, opts))
+
+def remove_default_papersize(line):
+ if not line.startswith("\\default_papersize"):
+ return no_match
+ return (True, "")
+
+
+########################
+
+