mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Slightly simplify revert_percent_skip_lengths.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36041 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4a1558855c
commit
dcc164407a
@ -275,7 +275,7 @@ def latex_length(string):
|
|||||||
"theight%":"\\textheight", "pheight%":"\\paperheight"}
|
"theight%":"\\textheight", "pheight%":"\\paperheight"}
|
||||||
for unit in units.keys():
|
for unit in units.keys():
|
||||||
i = string.find(unit)
|
i = string.find(unit)
|
||||||
if i != -1:
|
if i == -1:
|
||||||
percent = True
|
percent = True
|
||||||
minus = string.rfind("-", 1, i)
|
minus = string.rfind("-", 1, i)
|
||||||
plus = string.rfind("+", 0, i)
|
plus = string.rfind("+", 0, i)
|
||||||
@ -990,26 +990,24 @@ def revert_paragraph_indentation(document):
|
|||||||
|
|
||||||
def revert_percent_skip_lengths(document):
|
def revert_percent_skip_lengths(document):
|
||||||
" Revert relative lengths for paragraph skip separation to preamble code "
|
" Revert relative lengths for paragraph skip separation to preamble code "
|
||||||
i = 0
|
i = find_token(document.header, "\\defskip", i)
|
||||||
while True:
|
if i == -1:
|
||||||
i = find_token(document.header, "\\defskip", i)
|
return
|
||||||
if i == -1:
|
length = get_value(document.header, "\\defskip", i)
|
||||||
break
|
# only revert when a custom length was set and when
|
||||||
length = get_value(document.header, "\\defskip", i)
|
# it used a percent length
|
||||||
# only revert when a custom length was set and when
|
if length in ('smallskip', 'medskip', 'bigskip'):
|
||||||
# it used a percent length
|
return
|
||||||
if length not in ('smallskip', 'medskip', 'bigskip'):
|
# handle percent lengths
|
||||||
# handle percent lengths
|
length = latex_length(length)
|
||||||
length = latex_length(length)
|
# latex_length returns "bool,length"
|
||||||
# latex_length returns "bool,length"
|
percent = length.split(",")[0]
|
||||||
percent = length.split(",")[0]
|
length = length.split(",")[1]
|
||||||
length = length.split(",")[1]
|
if percent == "True":
|
||||||
if percent == "True":
|
add_to_preamble(document, ["% this command was inserted by lyx2lyx"])
|
||||||
add_to_preamble(document, ["% this command was inserted by lyx2lyx"])
|
add_to_preamble(document, ["\\setlength{\\parskip}{" + length + "}"])
|
||||||
add_to_preamble(document, ["\\setlength{\\parskip}{" + length + "}"])
|
# set defskip to medskip as default
|
||||||
# set defskip to medskip as default
|
document.header[i] = "\\defskip medskip"
|
||||||
document.header[i] = "\\defskip medskip"
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
|
|
||||||
def revert_percent_vspace_lengths(document):
|
def revert_percent_vspace_lengths(document):
|
||||||
|
Loading…
Reference in New Issue
Block a user