document and convert eqref fileformat change

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9657 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2005-02-21 12:04:23 +00:00
parent cd1dbc6fed
commit 8193290f0d
3 changed files with 48 additions and 1 deletions

View File

@ -320,6 +320,11 @@ Paragraph text.
ERT: "\ " could be converted to InsetSpace \<space>
ERT: "\," could be converted to InsetSpace \,
2003-04-24 André Pönitz <poenitz@gmx.net>
* Added eqref support:
\begin_inset LatexCommand \eqref{label}
2003-03-12 John Levon <levon@movementarian.org>
* Added \\end_header to signify the end of the header in a

View File

@ -1,3 +1,10 @@
2005-02-20 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* lyx_1_4.py (lyx_support_escape): new
* lyx_1_4.py (revert_eqref): new, convert
'\begin_inset LatexCommand \eqref{label}' to ERT
* lyx_1_4.py (revert): call revert_eqref in step 223 -> 221
2005-02-17 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* lyx_1_4.py (convert_table_valignment_middle,

View File

@ -69,6 +69,41 @@ def revert_spaces(file):
file.body[i] = replace(file.body[i],"\\InsetSpace ~", "\\SpecialChar ~")
##
# equivalent to lyx::support::escape()
#
def lyx_support_escape(lab):
hexdigit = ['0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
enc = ""
for c in lab:
o = ord(c)
if o >= 128 or c == '=' or c == '%':
enc = enc + '='
enc = enc + hexdigit[o >> 4]
enc = enc + hexdigit[o & 15]
else:
enc = enc + c
return enc;
##
# \begin_inset LatexCommand \eqref -> ERT
#
def revert_eqref(file):
regexp = re.compile(r'^\\begin_inset\s+LatexCommand\s+\\eqref')
i = 0
while 1:
i = find_re(file.body, regexp, i)
if i == -1:
break
eqref = lyx_support_escape(regexp.sub("", file.body[i]))
file.body[i:i+1] = ["\\begin_inset ERT", "status Collapsed", "",
"\\layout Standard", "", "\\backslash ",
"eqref" + eqref]
i = i + 7
##
# BibTeX changes
#
@ -1834,7 +1869,7 @@ revert = [[240, [revert_ert_paragraphs]],
[225, [revert_note]],
[224, [rm_end_layout, begin_layout2layout, revert_end_document,
revert_valignment_middle, convert_vspace, convert_frameless_box]],
[223, [revert_external_2, revert_comment]],
[223, [revert_external_2, revert_comment, revert_eqref]],
[221, [rm_end_header, revert_spaces, revert_bibtex,
rm_tracking_changes, rm_body_changes]]]