InsetInfo: lyx2lyx support

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20905 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-10-11 14:56:34 +00:00
parent 62c98f2ffc
commit 353aacab4b
4 changed files with 34 additions and 4 deletions

View File

@ -1,6 +1,9 @@
LyX file-format changes LyX file-format changes
----------------------- -----------------------
2007-10-11 Bo Peng <ben.bob@gmail.com>
* Format incremented to 293: Add InsetInfo.
2007-10-09 Uwe Stöhr Uwe Stöhr <uwestoehr@web.de> 2007-10-09 Uwe Stöhr Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 292: Support for Japanese without * Format incremented to 292: Support for Japanese without
using CJK and inputenc. (japanese-plain) using CJK and inputenc. (japanese-plain)

View File

@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
("1_3", [221], minor_versions("1.3" , 7)), ("1_3", [221], minor_versions("1.3" , 7)),
("1_4", range(222,246), minor_versions("1.4" , 5)), ("1_4", range(222,246), minor_versions("1.4" , 5)),
("1_5", range(246,277), minor_versions("1.5" , 1)), ("1_5", range(246,277), minor_versions("1.5" , 1)),
("1_6", range(277,293), minor_versions("1.6" , 0))] # Uwe Stöhr, Japanese ("1_6", range(277,294), minor_versions("1.6" , 0))]
def formats_list(): def formats_list():

View File

@ -455,6 +455,31 @@ def revert_japanese_encoding(document):
document.header[k] = "\\inputencoding UTF8" document.header[k] = "\\inputencoding UTF8"
def revert_inset_info(document):
'Replace info inset with its content'
i = 0
while 1:
i = find_token(document.body, '\\begin_inset Info', i)
if i == -1:
return
j = find_end_of_inset(document.body, i + 1)
if j == -1:
# should not happen
document.warning("Malformed LyX document: Could not find end of Info inset.")
type = 'unknown'
arg = ''
for k in range(i, j+1):
if document.body[k].startswith("arg"):
arg = document.body[k][3:].strip().strip('"')
if document.body[k].startswith("type"):
type = document.body[k][4:].strip().strip('"')
# I think there is a newline after \\end_inset, which should be removed.
if document.body[j + 1].strip() == "":
document.body[i : (j + 2)] = [type + ':' + arg]
else:
document.body[i : (j + 1)] = [type + ':' + arg]
## ##
# Conversion hub # Conversion hub
# #
@ -475,10 +500,12 @@ convert = [[277, [fix_wrong_tables]],
[289, [convert_latexcommand_index]], [289, [convert_latexcommand_index]],
[290, []], [290, []],
[291, []], [291, []],
[292, []] [292, []],
[293, []]
] ]
revert = [[291, [revert_japanese, revert_japanese_encoding]], revert = [[292, [revert_inset_info]],
[291, [revert_japanese, revert_japanese_encoding]],
[290, [revert_vietnamese]], [290, [revert_vietnamese]],
[289, [revert_wraptable]], [289, [revert_wraptable]],
[288, [revert_latexcommand_index]], [288, [revert_latexcommand_index]],

View File

@ -154,7 +154,7 @@ namespace fs = boost::filesystem;
namespace { namespace {
int const LYX_FORMAT = 292; //Uwe Stöhr, Japanese int const LYX_FORMAT = 293;
} // namespace anon } // namespace anon