mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug 4927 again. The latex2ert routine was geared too much toward IndexInset, where
the initial backslash in a LaTeX command is escaped, which it is not in a subfigure. Note that we are NOT converting labels here into InsetLabel objects. That would not be all that hard to do. I've put a comment in about how we could do that. It would be fairly easy to do. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25581 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ec86523845
commit
f119b8f4de
@ -207,7 +207,11 @@ def latex2ert(line):
|
||||
|
||||
retval = ""
|
||||
## FIXME Escaped \ ??
|
||||
labelre = re.compile(r'(.*?)\\(\\(?:[a-zA-Z]+|.))(.*)')
|
||||
# This regex looks for a LaTeX command---i.e., something of the form
|
||||
# "\alPhaStuFF", or "\X", where X is any character---where the command
|
||||
# may also be preceded by an additional backslash, which is how it would
|
||||
# appear (e.g.) in an InsetIndex.
|
||||
labelre = re.compile(r'(.*?)\\?(\\(?:[a-zA-Z]+|.))(.*)')
|
||||
|
||||
m = labelre.match(line)
|
||||
while m != None:
|
||||
@ -221,6 +225,10 @@ def latex2ert(line):
|
||||
break
|
||||
cmd += arg
|
||||
end = rest
|
||||
# If we wanted to put labels into an InsetLabel, for example, then we
|
||||
# would just need to test here for cmd == "label" and then take some
|
||||
# appropriate action, i.e., to use arg to get the content and then
|
||||
# wrap it appropriately.
|
||||
cmd = put_cmd_in_ert(cmd)
|
||||
retval += "\n" + cmd + "\n"
|
||||
line = end
|
||||
@ -241,7 +249,7 @@ def latex2lyx(data):
|
||||
# Commands of this sort need to be checked to make sure they are
|
||||
# followed by a non-alpha character, lest we replace too much.
|
||||
hardone = re.compile(r'^\\\\[a-zA-Z]+$')
|
||||
|
||||
|
||||
for rep in reps:
|
||||
if hardone.match(rep[0]):
|
||||
pos = 0
|
||||
|
Loading…
Reference in New Issue
Block a user