mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
* lyx_2_0.py:
- use predefined methods for getting length values. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30736 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6147d5f796
commit
e59b0d2c28
@ -1019,9 +1019,9 @@ def revert_percent_hspace_lengths(document):
|
|||||||
i = 0
|
i = 0
|
||||||
j = 0
|
j = 0
|
||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset space \hspace{}", i)
|
i = find_token(document.body, "\\begin_inset space \\hspace{}", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
j = find_token(document.body, "\\begin_inset space \hspace*{}", j)
|
j = find_token(document.body, "\\begin_inset space \\hspace*{}", j)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -1031,13 +1031,10 @@ def revert_percent_hspace_lengths(document):
|
|||||||
star = False
|
star = False
|
||||||
# only revert when a custom length was set and when
|
# only revert when a custom length was set and when
|
||||||
# it used a percent length
|
# it used a percent length
|
||||||
o = document.body[i+1].find("\\length")
|
length = get_value(document.body, '\\length', i+1)
|
||||||
if o == -1:
|
if length == '':
|
||||||
document.warning("Error: Cannot find lenght for \\hspace!")
|
document.warning("Malformed lyx document: Missing '\\length' in Space inset.")
|
||||||
break
|
return
|
||||||
# search for the beginning of the value via the space
|
|
||||||
k = document.body[i+1].find(" ")
|
|
||||||
length = document.body[i+1][k+1:]
|
|
||||||
# handle percent lengths
|
# handle percent lengths
|
||||||
length = latex_length(length)
|
length = latex_length(length)
|
||||||
# latex_length returns "bool,length"
|
# latex_length returns "bool,length"
|
||||||
@ -1060,9 +1057,9 @@ def revert_hspace_glue_lengths(document):
|
|||||||
i = 0
|
i = 0
|
||||||
j = 0
|
j = 0
|
||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset space \hspace{}", i)
|
i = find_token(document.body, "\\begin_inset space \\hspace{}", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
j = find_token(document.body, "\\begin_inset space \hspace*{}", j)
|
j = find_token(document.body, "\\begin_inset space \\hspace*{}", j)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -1070,13 +1067,10 @@ def revert_hspace_glue_lengths(document):
|
|||||||
i = j
|
i = j
|
||||||
else:
|
else:
|
||||||
star = False
|
star = False
|
||||||
o = document.body[i+1].find("\\length")
|
length = get_value(document.body, '\\length', i+1)
|
||||||
if o == -1:
|
if length == '':
|
||||||
document.warning("Error: Cannot find lenght for \\hspace!")
|
document.warning("Malformed lyx document: Missing '\\length' in Space inset.")
|
||||||
break
|
return
|
||||||
# search for the beginning of the value via the space
|
|
||||||
k = document.body[i+1].find(" ")
|
|
||||||
length = document.body[i+1][k+1:]
|
|
||||||
# only revert when the length contains a plus or minus
|
# only revert when the length contains a plus or minus
|
||||||
l = length.find("+")
|
l = length.find("+")
|
||||||
if l == -1:
|
if l == -1:
|
||||||
|
Loading…
Reference in New Issue
Block a user