mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Move compatility code for old style (0.10 !) latex accents to lyx2lyx.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9331 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e78648a4f5
commit
bd6cb0ad58
@ -1,3 +1,7 @@
|
||||
2004-12-02 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_0_12.py (update_latexaccents): convert old style latexaccents.
|
||||
|
||||
2004-11-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_2.py (convert): rename opt to file, as in all other files.
|
||||
|
@ -236,6 +236,29 @@ def header_update(lines, file):
|
||||
i = i + 1
|
||||
|
||||
|
||||
def update_latexaccents(body):
|
||||
i = 1
|
||||
while 1:
|
||||
i = find_token(body, '\\i ', i)
|
||||
if i == -1:
|
||||
return
|
||||
|
||||
contents = string.strip(body[i][2:])
|
||||
|
||||
if len(contents) == 2:
|
||||
contents = contents + '{}'
|
||||
elif len(contents) == 3:
|
||||
contents = contents[:2] + '{' + contents[2] + '}'
|
||||
elif len(contents) == 4:
|
||||
if contents[2] == ' ':
|
||||
contents = contents[:2] + '{' + contents[3] + '}'
|
||||
elif contents[2:4] == '\\i' or contents[2:4] == '\\j':
|
||||
contents = contents[:2] + '{' + contents[2:] + '}'
|
||||
|
||||
body[i] = '\\i ' + contents
|
||||
i = i + 1
|
||||
|
||||
|
||||
def convert(file):
|
||||
header_update(file.header, file)
|
||||
add_end_document(file.body)
|
||||
@ -251,6 +274,7 @@ def convert(file):
|
||||
update_vfill(file.body)
|
||||
remove_empty_insets(file.body)
|
||||
remove_formula_latex(file.body)
|
||||
update_latexaccents(file.body)
|
||||
file.format = 215
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-12-02 José Matos <jamatos@lyx.org>
|
||||
|
||||
* insetlatexaccent.C (checkContents): remove compatibility code,
|
||||
moved to lyx2lyx.
|
||||
|
||||
2004-11-30 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* insetbase.h (getStatus): add better comment from src/cursor.C
|
||||
|
@ -65,44 +65,7 @@ void InsetLatexAccent::checkContents()
|
||||
return;
|
||||
}
|
||||
|
||||
// REMOVE IN 0.13
|
||||
// Dirty Hack for backward compability. remove in 0.13 (Lgb)
|
||||
contents = trim(contents);
|
||||
if (!contains(contents, '{') && !contains(contents, '}')) {
|
||||
if (contents.length() == 2) {
|
||||
string tmp;
|
||||
tmp += contents[0];
|
||||
tmp += contents[1];
|
||||
tmp += "{}";
|
||||
contents = tmp;
|
||||
} else if (contents.length() == 3) {
|
||||
string tmp;
|
||||
tmp += contents[0];
|
||||
tmp += contents[1];
|
||||
tmp += '{';
|
||||
tmp += contents[2];
|
||||
tmp += '}';
|
||||
contents = tmp;
|
||||
} else if (contents.length() == 4 && contents[2] == ' ') {
|
||||
string tmp;
|
||||
tmp += contents[0];
|
||||
tmp += contents[1];
|
||||
tmp += '{';
|
||||
tmp += contents[3];
|
||||
tmp += '}';
|
||||
contents = tmp;
|
||||
} else if (contents.length() == 4 && contents[2] == '\\'
|
||||
&& (contents[3] == 'i' || contents[3] == 'j')) {
|
||||
string tmp;
|
||||
tmp += contents[0];
|
||||
tmp += contents[1];
|
||||
tmp += '{';
|
||||
tmp += contents[2];
|
||||
tmp += contents[3];
|
||||
tmp += '}';
|
||||
contents = tmp;
|
||||
}
|
||||
}
|
||||
if (contents[0] != '\\') { // demand that first char is a '\\'
|
||||
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user