mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-31 07:45:44 +00:00
Do a little more work towards making subcaptions work.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25497 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dbc577700a
commit
77581b5c0d
@ -125,7 +125,7 @@ def read_unicodesymbols():
|
|||||||
# as: \"u.
|
# as: \"u.
|
||||||
r = re.compile(r'\\\\(\W)\{(\w)\}')
|
r = re.compile(r'\\\\(\W)\{(\w)\}')
|
||||||
for line in fp.readlines():
|
for line in fp.readlines():
|
||||||
if line[0] != '#' and line.strip() != "":
|
if line[0] != '#' and line.strip() != "" and line.find("\\") != -1:
|
||||||
line=line.replace(' "',' ') # remove all quotation marks with spaces before
|
line=line.replace(' "',' ') # remove all quotation marks with spaces before
|
||||||
line=line.replace('" ',' ') # remove all quotation marks with spaces after
|
line=line.replace('" ',' ') # remove all quotation marks with spaces after
|
||||||
line=line.replace(r'\"','"') # replace \" by " (for characters with diaeresis)
|
line=line.replace(r'\"','"') # replace \" by " (for characters with diaeresis)
|
||||||
@ -173,20 +173,28 @@ def latex2lyx(data):
|
|||||||
#document.warning(str(i) + ":" + document.body[i])
|
#document.warning(str(i) + ":" + document.body[i])
|
||||||
#document.warning("LAST: " + document.body[-1])
|
#document.warning("LAST: " + document.body[-1])
|
||||||
g = line
|
g = line
|
||||||
while mathre.match(g):
|
m = mathre.match(g)
|
||||||
m = mathre.match(g)
|
if m == None:
|
||||||
|
g = wrap_into_ert(g, '\\', '\\backslash')
|
||||||
|
g = wrap_into_ert(g, '{', '{')
|
||||||
|
g = wrap_into_ert(g, '}', '}')
|
||||||
|
subst = g.split('\n')
|
||||||
|
retval += subst
|
||||||
|
continue
|
||||||
|
while m != None:
|
||||||
s = m.group(1)
|
s = m.group(1)
|
||||||
f = m.group(2).replace('\\\\', '\\')
|
f = m.group(2).replace('\\\\', '\\')
|
||||||
g = m.group(3)
|
g = m.group(3)
|
||||||
if s:
|
if s:
|
||||||
# this is non-math!
|
# this is non-math!
|
||||||
s = wrap_into_ert(s, r'\\', '\\backslash')
|
s = wrap_into_ert(s, '\\', '\\backslash')
|
||||||
s = wrap_into_ert(s, '{', '{')
|
s = wrap_into_ert(s, '{', '{')
|
||||||
s = wrap_into_ert(s, '}', '}')
|
s = wrap_into_ert(s, '}', '}')
|
||||||
subst = s.split('\n')
|
subst = s.split('\n')
|
||||||
retval += subst
|
retval += subst
|
||||||
retval.append("\\begin_inset Formula " + f)
|
retval.append("\\begin_inset Formula " + f)
|
||||||
retval.append("\\end_inset")
|
retval.append("\\end_inset")
|
||||||
|
m = mathre.match(g)
|
||||||
# Generic, \\ -> \backslash:
|
# Generic, \\ -> \backslash:
|
||||||
g = wrap_into_ert(g, r'\\', '\\backslash')
|
g = wrap_into_ert(g, r'\\', '\\backslash')
|
||||||
g = wrap_into_ert(g, '{', '{')
|
g = wrap_into_ert(g, '{', '{')
|
||||||
@ -1918,8 +1926,8 @@ def convert_subfig(document):
|
|||||||
addedLines = -2
|
addedLines = -2
|
||||||
subst = ['\\begin_inset Float figure', 'wide false', 'sideways false',
|
subst = ['\\begin_inset Float figure', 'wide false', 'sideways false',
|
||||||
'status open', '', '\\begin_layout Plain Layout', '\\begin_inset Caption',
|
'status open', '', '\\begin_layout Plain Layout', '\\begin_inset Caption',
|
||||||
'', '\\begin_layout Plain Layout',
|
'', '\\begin_layout Plain Layout'] + latex2lyx(caption) + \
|
||||||
caption, '\\end_layout', '', '\\end_inset', '',
|
[ '\\end_layout', '', '\\end_inset', '',
|
||||||
'\\end_layout', '', '\\begin_layout Plain Layout']
|
'\\end_layout', '', '\\begin_layout Plain Layout']
|
||||||
document.body[i : i] = subst
|
document.body[i : i] = subst
|
||||||
addedLines += len(subst)
|
addedLines += len(subst)
|
||||||
|
Loading…
Reference in New Issue
Block a user