mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
Some python cleanup from Thibault.
This commit is contained in:
parent
95eccf0c53
commit
6f084c4c30
@ -1747,11 +1747,13 @@ ruby_inset_def = [
|
|||||||
r'End',
|
r'End',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def convert_ruby_module(document):
|
def convert_ruby_module(document):
|
||||||
"""Use ruby module instead of local module definition"""
|
"""Use ruby module instead of local module definition"""
|
||||||
if document.del_local_layout(ruby_inset_def):
|
if document.del_local_layout(ruby_inset_def):
|
||||||
document.add_module("ruby")
|
document.add_module("ruby")
|
||||||
|
|
||||||
|
|
||||||
def revert_ruby_module(document):
|
def revert_ruby_module(document):
|
||||||
"""Replace ruby module with local module definition"""
|
"""Replace ruby module with local module definition"""
|
||||||
if document.del_module("ruby"):
|
if document.del_module("ruby"):
|
||||||
@ -1768,6 +1770,7 @@ def convert_utf8_japanese(document):
|
|||||||
or (lang == "japanese-cjk" and inputenc == "utf8-cjk")):
|
or (lang == "japanese-cjk" and inputenc == "utf8-cjk")):
|
||||||
document.set_parameter("inputencoding", "utf8")
|
document.set_parameter("inputencoding", "utf8")
|
||||||
|
|
||||||
|
|
||||||
def revert_utf8_japanese(document):
|
def revert_utf8_japanese(document):
|
||||||
"""Use Japanese utf8 variants with Japanese documents."""
|
"""Use Japanese utf8 variants with Japanese documents."""
|
||||||
inputenc = get_value(document.header, "\\inputencoding")
|
inputenc = get_value(document.header, "\\inputencoding")
|
||||||
|
@ -392,7 +392,7 @@ def convert(lines, end_format):
|
|||||||
# for categories
|
# for categories
|
||||||
re_Declaration = re.compile(b'^#\\s*\\Declare\\w+Class.*$')
|
re_Declaration = re.compile(b'^#\\s*\\Declare\\w+Class.*$')
|
||||||
re_ExtractCategory = re.compile(b'^(#\\s*\\Declare\\w+Class(?:\\[[^]]*?\\])?){([^(]+?)\\s+\\(([^)]+?)\\)\\s*}\\s*$')
|
re_ExtractCategory = re.compile(b'^(#\\s*\\Declare\\w+Class(?:\\[[^]]*?\\])?){([^(]+?)\\s+\\(([^)]+?)\\)\\s*}\\s*$')
|
||||||
ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports", \
|
ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports",
|
||||||
"presentation" : "Presentations", "curriculum vitae" : "Curricula Vitae", "handout" : "Handouts"}
|
"presentation" : "Presentations", "curriculum vitae" : "Curricula Vitae", "handout" : "Handouts"}
|
||||||
# Arguments
|
# Arguments
|
||||||
re_OptArgs = re.compile(b'^(\\s*)OptionalArgs(\\s+)(\\d+)\\D*$', re.IGNORECASE)
|
re_OptArgs = re.compile(b'^(\\s*)OptionalArgs(\\s+)(\\d+)\\D*$', re.IGNORECASE)
|
||||||
@ -485,12 +485,12 @@ def convert(lines, end_format):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# insert file format if not already there
|
# insert file format if not already there
|
||||||
if (only_comment):
|
if only_comment:
|
||||||
match = re_Format.match(lines[i])
|
match = re_Format.match(lines[i])
|
||||||
if match:
|
if match:
|
||||||
formatline = i
|
formatline = i
|
||||||
format = int(match.group(4))
|
format = int(match.group(4))
|
||||||
if format > 1 and format < end_format:
|
if 1 < format < end_format:
|
||||||
lines[i] = b"Format %d" % (format + 1)
|
lines[i] = b"Format %d" % (format + 1)
|
||||||
only_comment = 0
|
only_comment = 0
|
||||||
elif format == end_format:
|
elif format == end_format:
|
||||||
@ -545,7 +545,7 @@ def convert(lines, end_format):
|
|||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if format >= 60 and format <= 62:
|
if 60 <= format <= 62:
|
||||||
# nothing to do.
|
# nothing to do.
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
@ -578,7 +578,7 @@ def convert(lines, end_format):
|
|||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if format >= 50 and format <= 56:
|
if 50 <= format <= 56:
|
||||||
# nothing to do.
|
# nothing to do.
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
@ -676,7 +676,7 @@ def convert(lines, end_format):
|
|||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if format >= 44 and format <= 47:
|
if 44 <= format <= 47:
|
||||||
# nothing to do.
|
# nothing to do.
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
@ -795,7 +795,7 @@ def convert(lines, end_format):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if format == 36:
|
if format == 36:
|
||||||
match = re_CiteFormat.match(lines[i]);
|
match = re_CiteFormat.match(lines[i])
|
||||||
if match and match.group(4) == b"":
|
if match and match.group(4) == b"":
|
||||||
lines[i] = match.group(0) + b" default"
|
lines[i] = match.group(0) + b" default"
|
||||||
i += 1
|
i += 1
|
||||||
@ -864,7 +864,7 @@ def convert(lines, end_format):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Only new features
|
# Only new features
|
||||||
if format >= 29 and format <= 31:
|
if 29 <= format <= 31:
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -888,7 +888,7 @@ def convert(lines, end_format):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Only new features
|
# Only new features
|
||||||
if format >= 24 and format <= 27:
|
if 24 <= format <= 27:
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -934,7 +934,7 @@ def convert(lines, end_format):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# This just involved new features, not any changes to old ones
|
# This just involved new features, not any changes to old ones
|
||||||
if format >= 14 and format <= 22:
|
if 14 <= format <= 22:
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -1011,7 +1011,7 @@ def convert(lines, end_format):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# These just involved new features, not any changes to old ones
|
# These just involved new features, not any changes to old ones
|
||||||
if format >= 5 and format <= 7:
|
if 5 <= format <= 7:
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user