mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
use revert_language in more cases
This commit is contained in:
parent
6d6eda3950
commit
4bd065f871
@ -30,7 +30,7 @@ from parser_tools import del_complete_lines, \
|
|||||||
|
|
||||||
from lyx2lyx_tools import add_to_preamble, insert_to_preamble, \
|
from lyx2lyx_tools import add_to_preamble, insert_to_preamble, \
|
||||||
put_cmd_in_ert, lyx2latex, latex_length, revert_flex_inset, \
|
put_cmd_in_ert, lyx2latex, latex_length, revert_flex_inset, \
|
||||||
revert_font_attrs, hex2ratio, str2bool
|
revert_font_attrs, hex2ratio, str2bool, revert_language
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Private helper functions
|
# Private helper functions
|
||||||
@ -1281,19 +1281,7 @@ def revert_notefontcolor(document):
|
|||||||
def revert_turkmen(document):
|
def revert_turkmen(document):
|
||||||
"Set language Turkmen to English"
|
"Set language Turkmen to English"
|
||||||
|
|
||||||
if document.language == "turkmen":
|
revert_language(document, "turkmen", "turkmen", "turkmen")
|
||||||
document.language = "english"
|
|
||||||
i = find_token(document.header, "\\language", 0)
|
|
||||||
if i != -1:
|
|
||||||
document.header[i] = "\\language english"
|
|
||||||
|
|
||||||
j = 0
|
|
||||||
while True:
|
|
||||||
j = find_token(document.body, "\\lang turkmen", j)
|
|
||||||
if j == -1:
|
|
||||||
return
|
|
||||||
document.body[j] = document.body[j].replace("\\lang turkmen", "\\lang english")
|
|
||||||
j += 1
|
|
||||||
|
|
||||||
|
|
||||||
def revert_fontcolor(document):
|
def revert_fontcolor(document):
|
||||||
|
@ -34,7 +34,7 @@ from parser_tools import count_pars_in_inset, del_complete_lines, del_token, \
|
|||||||
#find_end_of_inset, find_end_of_layout, \
|
#find_end_of_inset, find_end_of_layout, \
|
||||||
#is_in_inset, del_token, check_token
|
#is_in_inset, del_token, check_token
|
||||||
|
|
||||||
from lyx2lyx_tools import add_to_preamble, put_cmd_in_ert, get_ert
|
from lyx2lyx_tools import add_to_preamble, put_cmd_in_ert, get_ert, revert_language
|
||||||
|
|
||||||
#from lyx2lyx_tools import insert_to_preamble, \
|
#from lyx2lyx_tools import insert_to_preamble, \
|
||||||
# lyx2latex, latex_length, revert_flex_inset, \
|
# lyx2latex, latex_length, revert_flex_inset, \
|
||||||
@ -1169,24 +1169,16 @@ def revert_ancientgreek(document):
|
|||||||
def revert_languages(document):
|
def revert_languages(document):
|
||||||
"Set the document language for new supported languages to English"
|
"Set the document language for new supported languages to English"
|
||||||
|
|
||||||
languages = [
|
# polyglossia-only
|
||||||
"coptic", "divehi", "hindi", "kurmanji", "lao", "marathi", "occitan", "sanskrit",
|
polyglossia_languages = ["coptic", "divehi", "hindi", "lao", "marathi",
|
||||||
"syriac", "tamil", "telugu", "urdu"
|
"occitan", "sanskrit", "syriac", "tamil",
|
||||||
]
|
"telugu", "urdu"]
|
||||||
for n in range(len(languages)):
|
# babel-only
|
||||||
if document.language == languages[n]:
|
babel_languages = ["kurmanji"]
|
||||||
document.language = "english"
|
for lang in polyglossia_languages:
|
||||||
i = find_token(document.header, "\\language", 0)
|
revert_language(document, lang, "", lang)
|
||||||
if i != -1:
|
for lang in babel_languages:
|
||||||
document.header[i] = "\\language english"
|
revert_language(document, lang, lang, "")
|
||||||
j = 0
|
|
||||||
while j < len(document.body):
|
|
||||||
j = find_token(document.body, "\\lang " + languages[n], j)
|
|
||||||
if j != -1:
|
|
||||||
document.body[j] = document.body[j].replace("\\lang " + languages[n], "\\lang english")
|
|
||||||
j += 1
|
|
||||||
else:
|
|
||||||
j = len(document.body)
|
|
||||||
|
|
||||||
|
|
||||||
def convert_armenian(document):
|
def convert_armenian(document):
|
||||||
@ -4561,19 +4553,7 @@ def revert_aa2(document):
|
|||||||
def revert_tibetan(document):
|
def revert_tibetan(document):
|
||||||
"Set the document language for Tibetan to English"
|
"Set the document language for Tibetan to English"
|
||||||
|
|
||||||
if document.language == "tibetan":
|
revert_language(document, "tibetan", "", "tibetan")
|
||||||
document.language = "english"
|
|
||||||
i = find_token(document.header, "\\language", 0)
|
|
||||||
if i != -1:
|
|
||||||
document.header[i] = "\\language english"
|
|
||||||
j = 0
|
|
||||||
while j < len(document.body):
|
|
||||||
j = find_token(document.body, "\\lang tibetan", j)
|
|
||||||
if j != -1:
|
|
||||||
document.body[j] = document.body[j].replace("\\lang tibetan", "\\lang english")
|
|
||||||
j += 1
|
|
||||||
else:
|
|
||||||
j = len(document.body)
|
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
|
@ -25,7 +25,8 @@ import sys, os
|
|||||||
# Uncomment only what you need to import, please.
|
# Uncomment only what you need to import, please.
|
||||||
|
|
||||||
from lyx2lyx_tools import (add_to_preamble, put_cmd_in_ert, get_ert,
|
from lyx2lyx_tools import (add_to_preamble, put_cmd_in_ert, get_ert,
|
||||||
lyx2latex, lyx2verbatim, length_in_bp, convert_info_insets, insert_document_option)
|
lyx2latex, lyx2verbatim, length_in_bp, convert_info_insets, insert_document_option,
|
||||||
|
revert_language)
|
||||||
|
|
||||||
from parser_tools import (check_token, del_complete_lines,
|
from parser_tools import (check_token, del_complete_lines,
|
||||||
find_end_of_inset, find_end_of_layout, find_nonempty_line, find_re,
|
find_end_of_inset, find_end_of_layout, find_nonempty_line, find_re,
|
||||||
@ -852,15 +853,7 @@ def revert_specialchar(document):
|
|||||||
def revert_georgian(document):
|
def revert_georgian(document):
|
||||||
"Set the document language to English but assure Georgian output"
|
"Set the document language to English but assure Georgian output"
|
||||||
|
|
||||||
if document.language == "georgian":
|
revert_language(document, "georgian", "georgian", "")
|
||||||
document.language = "english"
|
|
||||||
i = find_token(document.header, "\\language georgian", 0)
|
|
||||||
if i != -1:
|
|
||||||
document.header[i] = "\\language english"
|
|
||||||
j = find_token(document.header, "\\language_package default", 0)
|
|
||||||
if j != -1:
|
|
||||||
document.header[j] = "\\language_package babel"
|
|
||||||
insert_document_option(document, "georgian")
|
|
||||||
|
|
||||||
|
|
||||||
def revert_sigplan_doi(document):
|
def revert_sigplan_doi(document):
|
||||||
|
Loading…
Reference in New Issue
Block a user