# -*- coding: utf-8 -*-
# This file is part of lyx2lyx
-# -*- coding: utf-8 -*-
# Copyright (C) 2016 The LyX team
#
# This program is free software; you can redistribute it and/or
return
if get_value(document.header, "\\inputencoding", i) == "pt254":
document.header[i] = "\\inputencoding pt154"
-
+
def convert_ibranches(document):
' Add "inverted 0" to branch insets'
else:
document.warning("Malformed LyX document: No selection indicator for branch " + branch)
selected = 1
-
+
# the value tells us whether the branch is selected
ourbranches[document.header[i][8:].strip()] = selected
i += 1
i += 1
# now we need to add the new branches to the header
- for old, new in ibranches.iteritems():
+ for old, new in ibranches.items():
i = find_token(document.header, "\\branch " + old, 0)
if i == -1:
document.warning("Can't find branch %s even though we found it before!" % (old))
replace = "'"
document.body[k:l+1] = [replace]
i = l
-
+
def revert_iopart(document):
" Input new styles via local layout "
def revert_crimson(document):
- " Revert native Cochineal/Crimson font definition to LaTeX "
+ " Revert native Cochineal/Crimson font definition to LaTeX "
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
preamble = ""
def revert_cochinealmath(document):
- " Revert cochineal newtxmath definitions to LaTeX "
+ " Revert cochineal newtxmath definitions to LaTeX "
- if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+ if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
i = find_token(document.header, "\\font_math \"cochineal-ntxm\"", 0)
if i != -1:
add_to_preamble(document, "\\usepackage[cochineal]{newtxmath}")
i = find_token(document.header, "\\use_microtype", 0)
if i != -1:
- if document.start > 474 and document.start < 509:
+ if document.initial_format > 474 and document.initial_format < 509:
# This was created by LyX 2.2
document.header[i+1:i+1] = ["\\use_dash_ligatures false"]
else:
document.body[i] = document.body[i][:j+1] + u"\u200B" + after
start = j+1
i += 1
-
+
+
+def revert_noto(document):
+ " Revert Noto font definitions to LaTeX "
+
+ if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+ preamble = ""
+ i = find_token(document.header, "\\font_roman \"NotoSerif-TLF\"", 0)
+ if i != -1:
+ add_to_preamble(document, ["\\renewcommand{\\rmdefault}{NotoSerif-TLF}"])
+ document.header[i] = document.header[i].replace("NotoSerif-TLF", "default")
+ i = find_token(document.header, "\\font_sans \"NotoSans-TLF\"", 0)
+ if i != -1:
+ add_to_preamble(document, ["\\renewcommand{\\sfdefault}{NotoSans-TLF}"])
+ document.header[i] = document.header[i].replace("NotoSans-TLF", "default")
+ i = find_token(document.header, "\\font_typewriter \"NotoMono-TLF\"", 0)
+ if i != -1:
+ add_to_preamble(document, ["\\renewcommand{\\ttdefault}{NotoMono-TLF}"])
+ document.header[i] = document.header[i].replace("NotoMono-TLF", "default")
+
##
# Conversion hub
[532, [convert_literalparam]],
[533, []],
[534, []],
- [535, [convert_dashligatures]]
+ [535, [convert_dashligatures]],
+ [536, []]
]
revert = [
+ [535, [revert_noto]],
[534, [revert_dashligatures]],
[533, [revert_chapterbib]],
[532, [revert_multibib]],