# is_in_inset, set_bool_value
# find_tokens, find_token_exact, check_token
-from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble)
+from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble, revert_language)
# revert_font_attrs, insert_to_preamble, latex_length
# get_ert, lyx2latex, lyx2verbatim, length_in_bp, convert_info_insets
# revert_flex_inset, hex2ratio, str2bool
j = find_token(document.header, ft, 0)
if j != -1:
val = get_value(document.header, ft, j)
- vals = val.split()
- document.header[j] = ft + ' "' + fn + '" ' + vals[1]
+ words = val.split() # ! splits also values like '"DejaVu Sans"'
+ words[0] = '"' + fn + '"'
+ document.header[j] = ft + ' ' + ' '.join(words)
def revert_fonts(document, fm, fontmap):
" Revert native font definition to LaTeX "
continue
ft = mo.group(1) # 'roman', 'sans', 'typewriter', 'math'
val = get_value(document.header, ft, i)
- words = val.split()
- font = words[0].replace('"', '')
+ words = val.split(' ') # ! splits also values like '"DejaVu Sans"'
+ font = words[0].strip('"') # TeX font name has no whitespace
if not font in fm.font2pkgmap:
i += 1
continue
val = fontinfo.package
if not val in fontmap:
fontmap[val] = []
- document.header[i] = ft + ' "default" ' + words[1]
+ words[0] = '"default"'
+ document.header[i] = ft + ' ' + ' '.join(words)
if fontinfo.scaleopt != None:
xval = get_value(document.header, "\\font_" + fontinfo.scaletype + "_scale", 0)
mo = rscales.search(xval)
alcmd = put_cmd_in_ert("\\raggedleft{}")
if len(alcmd) > 0:
document.body[l+1:l+1] = alcmd
- i += 1
+ i += 1
def revert_tuftecite(document):
if vval != "":
needarray = True
vval += "V{\\linewidth}"
-
+
document.body[col_line] = document.body[col_line][:-1] + " special=\"" + vval + "\">"
# ERT newlines and linebreaks (since LyX < 2.4 automatically inserts parboxes
# with newlines, and we do not want that)
if engine in ["biblatex", "biblatex-natbib"]:
biblatex = True
- # Map lyx to latex encoding names
+ # Map lyx to latex encoding names
encodings = {
"utf8" : "utf8",
"utf8x" : "utf8x",
"lowersorbian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"macedonian" : ["%A, %d %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"magyar" : ["%Y. %B %d., %A", "%Y. %m. %d.", "%Y. %B %d.", "%Y. %b %d.", "%Y.%m.%d."],
+ "malayalam" : ["%A, %d %B, %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"marathi" : ["%A, %d %B, %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"mongolian" : ["%A, %Y оны %m сарын %d", "%Y-%m-%d", "%Y оны %m сарын %d", "%d-%m-%Y", "%d-%m-%Y"],
"naustrian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"lowersorbian" : ["%H:%M:%S %Z", "%H:%M"],
"macedonian" : ["%H:%M:%S %Z", "%H:%M"],
"magyar" : ["%H:%M:%S %Z", "%H:%M"],
+ "malayalam" : ["%p %I:%M:%S %Z", "%p %I:%M"],
"marathi" : ["%I:%M:%S %p %Z", "%I:%M %p"],
"mongolian" : ["%H:%M:%S %Z", "%H:%M"],
"naustrian" : ["%H:%M:%S %Z", "%H:%M"],
continue
arg = find_token(document.body, 'arg', i, j)
argv = get_quoted_value(document.body, "arg", arg)
- # remove trailing colons, menu accelerator (|...) and qt accelerator (&), while keeping literal " & "
+ # remove trailing colons, menu accelerator (|...) and qt accelerator (&), while keeping literal " & "
argv = argv.rstrip(':').split('|')[0].replace(" & ", "</amp;>").replace("&", "").replace("</amp;>", " & ")
document.body[i : j+1] = argv
i = i + 1
convert_hebrew_parentheses(document)
+def revert_malayalam(document):
+ " Set the document language to English but assure Malayalam output "
+
+ revert_language(document, "malayalam", "", "malayalam")
+
+
##
# Conversion hub
#
[564, []],
[565, [convert_AdobeFonts]], # Handle adobe fonts in GUI
[566, [convert_hebrew_parentheses]],
+ [567, []],
]
revert = [
+ [566, [revert_malayalam]],
[565, [revert_hebrew_parentheses]],
[564, [revert_AdobeFonts]],
[563, [revert_lformatinfo]],