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"}
|
||||
for unit in units.keys():
|
||||
i = string.find(unit)
|
||||
if i != -1:
|
||||
if i == -1:
|
||||
percent = True
|
||||
minus = string.rfind("-", 1, i)
|
||||
plus = string.rfind("+", 0, i)
|
||||
@ -990,15 +990,14 @@ def revert_paragraph_indentation(document):
|
||||
|
||||
def revert_percent_skip_lengths(document):
|
||||
" Revert relative lengths for paragraph skip separation to preamble code "
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.header, "\\defskip", i)
|
||||
if i == -1:
|
||||
break
|
||||
return
|
||||
length = get_value(document.header, "\\defskip", i)
|
||||
# only revert when a custom length was set and when
|
||||
# it used a percent length
|
||||
if length not in ('smallskip', 'medskip', 'bigskip'):
|
||||
if length in ('smallskip', 'medskip', 'bigskip'):
|
||||
return
|
||||
# handle percent lengths
|
||||
length = latex_length(length)
|
||||
# latex_length returns "bool,length"
|
||||
@ -1009,7 +1008,6 @@ def revert_percent_skip_lengths(document):
|
||||
add_to_preamble(document, ["\\setlength{\\parskip}{" + length + "}"])
|
||||
# set defskip to medskip as default
|
||||
document.header[i] = "\\defskip medskip"
|
||||
i = i + 1
|
||||
|
||||
|
||||
def revert_percent_vspace_lengths(document):
|
||||
|
Loading…
Reference in New Issue
Block a user