mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
Update lyx2lyx to 1.6.0 level
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@27348 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4197840f43
commit
12d77c2a8f
@ -1,665 +0,0 @@
|
||||
2006-03-14 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_5.py: new file, handle new format 246
|
||||
* LyX.py: handle new format 246
|
||||
* lyx_1_4.py (revert_booktabs): move to lyx_1_5.py
|
||||
|
||||
2006-03-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (remove_paperpackage): Only reset the papersize for
|
||||
a4* paperpackages.
|
||||
|
||||
2006-02-22 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_amsmath, revert_amsmath): new, convert ams math
|
||||
settings.
|
||||
|
||||
2006-02-05 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* LyX.py: new member is_default_layout()
|
||||
* LyX.py: new member default_layout
|
||||
* parser_tools.py (get_layout): new, extract layout name from line
|
||||
* lyx_1_1_5.py, lyx_1_1_6.py, lyx_1_2.py, lyx_1_4.py: Replace all
|
||||
occurences of the "Standard" layout with file.default_layout (bug 2026)
|
||||
|
||||
2006-02-02 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (remove_branches): new, remove branch insets
|
||||
|
||||
2005-12-01 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (choose_io): replace open and make the choice more transparent.
|
||||
|
||||
2005-11-24 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_0_0.py (obsolete_latex_title): "LaTeX Title" -> "Title"
|
||||
* (update_tabular): update from tabular format 3 to 4 if necessary.
|
||||
|
||||
2005-11-20 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_frameless_box): fix file format argument of
|
||||
insert_ert
|
||||
|
||||
2005-10-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* LyX.py: enlarge range to current format (245);
|
||||
do not use \quotes_times anymore on NewFile.
|
||||
* lyx_1_4.py (remove_quotestimes): remove param \quotes_times (bug 2090).
|
||||
|
||||
2005-09-28 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py: fix relation_format reversion
|
||||
|
||||
2005-09-28 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* LyX.py: enlarge range to current format (244).
|
||||
* lyx_1_4.py (revert_spaces): fix so that new space insets are reverted
|
||||
to ERT.
|
||||
* lyx_1_4.py (rename_spaces, revert_space_names): some InsetSpace types
|
||||
had to be renamed; conversion takes place between 243<->244.
|
||||
|
||||
2005-09-19 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* parser_tools.py (get_paragraph, get_next_paragraph): add format
|
||||
argument and make them work with formats newer than 220
|
||||
* lyx_1_2.py (remove_oldfloat, remove_pextra, remove_oldertinset,
|
||||
combine_ert): adjust to the changes above
|
||||
* lyx_1_4.py (convert_breaks, revert_breaks): better conversion of
|
||||
lyxlines
|
||||
* lyx_1_4.py (convert_ertbackslash, convert_ertlen, insert_ert):
|
||||
add format argument and make it work with formats newer than 240
|
||||
* lyx_1_4.py (convert_frameless_box): adjust to the changes above
|
||||
* lyx_1_4.py (ert2latex): new, convert ERT code to LaTeX
|
||||
* lyx_1_4.py (lyxsize2latexsize): new, convert LyX font size to LaTeX
|
||||
|
||||
2005-09-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* LyX.py (LyX_Base): fix paragraph parameter check
|
||||
* LyX.py (NewFile): remove paperpackage from header
|
||||
|
||||
2005-09-09 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_1_6fix3.py (update_tabular): fix vertical alignment convertion.
|
||||
|
||||
2005-08-28 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_vspace): rename to revert_breaks and revert
|
||||
\lyxline and \newpage, too
|
||||
|
||||
2005-08-30 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (add_to_preamble): fix invocation of find_token (bug 2004)
|
||||
|
||||
2005-08-18 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (remove_paperpackage): fix bug 2001.
|
||||
|
||||
2005-08-18 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (read, write): add preamble as data member of LyX_Base,
|
||||
remove if from the header.
|
||||
|
||||
* lyx_0_12.py (header_update):
|
||||
* lyx_1_1_5.py (remove_space_in_units):
|
||||
* lyx_1_4.py (add_to_preamble, convert_frameless_box): use the new scheme.
|
||||
|
||||
* lyx_1_2.py (change_header): change name to reflect its content.
|
||||
|
||||
2005-07-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py:
|
||||
* LyX.py: add \leftindent to the list of allowed paragraph parameters.
|
||||
|
||||
2005-07-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (remove_paperpackage): Take into account the lines
|
||||
added to preamble.
|
||||
|
||||
2005-07-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py: Fix a4 package removal when the preamble is already there.
|
||||
|
||||
2005-07-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py: Fix widemarginsa4 convertion.
|
||||
|
||||
2005-07-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py: \end_header was added in 222, not 223
|
||||
|
||||
2005-07-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py:
|
||||
* LyX.py: do not ignore format 222.
|
||||
|
||||
2005-07-22 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_paperpackage, revert_paperpackage):
|
||||
remove wrong comments
|
||||
|
||||
* LyX.py : add 1.3.6 to the releases list
|
||||
|
||||
2005-07-18 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_minipage, convert_frameless_box): small
|
||||
fixes to minipages convertions and retroversions.
|
||||
|
||||
2005-07-18 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_french): fix two typos (Thanks to Georg Baum).
|
||||
|
||||
2005-07-18 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_french): convert language also in the body.
|
||||
|
||||
2005-07-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* Makefile.am: new file for correct dealing with python scripts.
|
||||
* .cvsignore: ignore Makefile(.in) files.
|
||||
|
||||
2005-07-12 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (add_to_preamble): Make it more robust.
|
||||
(convert_frameless_box): Fix wrong type for parameter.
|
||||
(revert_paperpackage): Consider empty paper package case.
|
||||
|
||||
2005-07-08 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_0_12.py (update_tabular): Support old tables format 1.
|
||||
|
||||
2005-07-08 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_1_5.py (latexdel_getargs, update_ref, update_latexdel):
|
||||
Remove latexdel insets comming from sgml2lyx (ref, url and htmlurl).
|
||||
|
||||
2005-06-21 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_french): change language frenchb to french
|
||||
for format 242.
|
||||
|
||||
2005-07-07 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (read): Ignore whitelines on header. Fix reading the
|
||||
first body line.
|
||||
|
||||
2005-07-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_1_5.py (replace_protected_separator): Make it robust
|
||||
to layout name absence.
|
||||
|
||||
2005-07-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (read): Add support for cases where the body begins
|
||||
without a whiteline before.
|
||||
|
||||
2005-07-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (paperpackage): Fix empty paperpackage case.
|
||||
|
||||
2005-07-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (warning): Prefix warnings with label "Warning: ".
|
||||
* lyx_1_4.py (add_end_layout): Handle truncated files.
|
||||
|
||||
2005-07-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_paperpackage): older tex2lyx generated files
|
||||
had \paperpackage with 'default' instead of 'none'.
|
||||
|
||||
2005-07-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (LyX_Base):
|
||||
* LyX.py (error):
|
||||
* LyX.py (convert):
|
||||
* lyx2lyx: Implement return codes consistently:
|
||||
0 - OK.
|
||||
1 - Irrecoverable error.
|
||||
2 - Recovered from error(s).
|
||||
|
||||
2005-07-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (LyX_Base):
|
||||
* LyX.py (File):
|
||||
* lyx2lyx (usage):
|
||||
* lyx2lyx (parse_options):
|
||||
* lyx2lyx (main): Add support for ignoring any errors during the
|
||||
file convertion.
|
||||
|
||||
2005-07-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_0_12.py (obsolete_latex_title): Obsolote old style.
|
||||
|
||||
2005-05-18 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx2lyx (parse_options): Add the description of the '-f' option
|
||||
back again.
|
||||
|
||||
2005-05-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_breaks): Don't treat every token that starts
|
||||
with '\\' as paragraph parameter
|
||||
|
||||
2005-05-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_breaks): put all paragraph parameters into a
|
||||
single line.
|
||||
|
||||
2005-05-04 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py: fix allowed parameters for paragraphs.
|
||||
|
||||
2005-04-26 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_breaks): fix spelling
|
||||
* lyx_1_4.py (convert_breaks): fix copy-and-paste error
|
||||
|
||||
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,
|
||||
revert_valignment_middle): use regex to recognize
|
||||
'\\begin_inset Tabular' and '\\begin_inset Tabular'
|
||||
* lyx_1_2.py (update_tabular, update_longtables): ditto
|
||||
* lyx_1_1_6fix3.py (update_tabular): ditto
|
||||
|
||||
2005-02-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_2.py (remove_pextra): fix bug 1816.
|
||||
|
||||
2005-02-06 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_ertbackslash): convert '\n', too
|
||||
* lyx_1_4.py (convert_len): new, split from convert_ertlen
|
||||
* lyx_1_4.py (insert_ert): new
|
||||
* lyx_1_4.py (add_to_preamble): new
|
||||
* lyx_1_4.py (convert_frameless_box): better conversion of parboxes
|
||||
and minipages with unsupported parameters
|
||||
|
||||
2005-02-03 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* LyX.py: format up to 241
|
||||
* lyx_1_4.py (convert_ert_paragraphs, revert_ert_paragraphs): new
|
||||
* lyx_1_4.py, LyX.py: handle new format 241
|
||||
|
||||
2005-01-24 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* LyX.py: format up to 240.
|
||||
* lyx_1_4.py (convert_output_changes, revert_output_changes): new
|
||||
|
||||
2005-01-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (normalize_paragraph_params): add start_of_appendix
|
||||
to the allowed parameters list.
|
||||
|
||||
2005-01-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (normalize_paragraph_params): update file format to 239.
|
||||
|
||||
* LyX.py (convert): simplify code and add running times
|
||||
information for higher debug levels.
|
||||
|
||||
2005-01-04 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_0_12.py:
|
||||
* lyx_1_0_0.py:
|
||||
* lyx_1_0_1.py:
|
||||
* lyx_1_1_4.py:
|
||||
* lyx_1_1_5.py:
|
||||
* lyx_1_1_6.py:
|
||||
* lyx_1_1_6fix3.py:
|
||||
* lyx_1_2.py:
|
||||
* lyx_1_3.py:
|
||||
* lyx_1_4.py: convert and revert change from functions to lists.
|
||||
|
||||
* LyX.py:
|
||||
* lyx2lyx: version -> version_lyx2lyx
|
||||
|
||||
* LyX.py (convert): put all the convertion logic here.
|
||||
|
||||
2005-01-04 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py (set_format): fix typo.
|
||||
|
||||
* lyx_0_12.py:
|
||||
* lyx_1_0_0.py:
|
||||
* lyx_1_0_1.py:
|
||||
* lyx_1_1_4.py:
|
||||
* lyx_1_1_5.py:
|
||||
* lyx_1_1_6.py:
|
||||
* lyx_1_1_6fix3.py:
|
||||
* lyx_1_2.py:
|
||||
* lyx_1_3.py:
|
||||
* lyx_1_4.py: unify the call convention of convertion
|
||||
functions. Now they all accept a file.
|
||||
|
||||
2004-12-06 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py, LyX.py: handle new format 239
|
||||
* lyx_1_4.py (revert_booktabs): move to 239 -> 238 conversion
|
||||
|
||||
2004-12-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py: format up to 238.
|
||||
* lyx_1_4.py:
|
||||
* lyx_0_12.py (update_latexaccents): consider the cases where the
|
||||
inset is updated.
|
||||
|
||||
2004-12-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_2.py (update_longtable): Update longtables to table format 3.
|
||||
|
||||
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.
|
||||
|
||||
2004-12-06 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py, LyX.py: handle new format 238
|
||||
* lyx_1_4.py (revert_booktabs): new
|
||||
|
||||
2004-10-28 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.pm: add internal documentation.
|
||||
|
||||
2004-10-17 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx2lyx: moved code to LyX module making effectively lyx2lyx and
|
||||
interface to the LyX module.
|
||||
|
||||
* LyX.py: white space changes. New class that serves as the basis
|
||||
to two derived classes. One for reading and another for new files.
|
||||
New function get_toc, to be used in Doc_toc.py in the
|
||||
documentation directory.
|
||||
New class paragraph, to read paragraphs from the lyx file.
|
||||
|
||||
2004-10-10 José Matos <jamatos@lyx.org>
|
||||
|
||||
* .cvsignore: add entries related with profiling lyx2lyx.
|
||||
* lyx2lyx (main): place all program inside this function, to allow
|
||||
it to be called from profiling.
|
||||
* profiling.py: new file to profile lyx2lyx.
|
||||
|
||||
2004-10-09 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py: add support for format 237, fix variables type,
|
||||
new function formats_list().
|
||||
|
||||
* lyx2lyx: print list of available formats on request.
|
||||
|
||||
* lyx_1_4.py: add support for 237, reorganize directory functions.
|
||||
|
||||
2004-09-29 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (get_end_format): simplify index.
|
||||
|
||||
2004-09-12 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_ertbackslash): insert the new line after the
|
||||
backslash, this did only work by accident in most cases
|
||||
|
||||
* lyx_1_4.py: unify warning messages
|
||||
|
||||
2004-08-19 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.lyx (add_end_layout): fix \end_layout interaction with
|
||||
\end_deeper.
|
||||
|
||||
2004-08-16 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.lyx (convert_comment, convert_breaks, convert_frameless_box):
|
||||
(convert_names, add_begin_body, strip_end_space): use the same policy
|
||||
of lyx of not using spaces as the last character in a line that starts
|
||||
with a command token (\xxxxx).
|
||||
|
||||
2004-08-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (normalize_papersize, denormalize_papersize):
|
||||
\papersize Default -> \papersize default
|
||||
\papersize Custom -> \papersize custom
|
||||
|
||||
2004-08-15 José Matos <jamatos@lyx.org>
|
||||
|
||||
* LyX.py: new file that gathers all the knowleadge of the LyX file
|
||||
format. This can be used as library.
|
||||
|
||||
* parser_tools.py: moved all the functions that are not related
|
||||
with the parser to LyX.py.
|
||||
|
||||
* lyx2lyx: is just a client of the LyX.py library.
|
||||
|
||||
* lyx_.py (convert, revert): renamed previous opt to file. Change
|
||||
the arguments since now file contains both the header and the
|
||||
body.
|
||||
|
||||
2004-08-14 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py:
|
||||
* parser_tools.py: up the format to 236.
|
||||
|
||||
2004-08-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1.4.py (remove_color_default): move
|
||||
\color default -> \color inherit
|
||||
|
||||
2004-08-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* parser_tools.py (read_file): remove \r from line's end when present.
|
||||
|
||||
2004-07-01 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_paperpackage): new, convert paperpackage setting
|
||||
* lyx_1_4.py (revert_paperpackage): new, revert paperpackage setting
|
||||
* lyx_1_4.py (revert, convert): handle format 235
|
||||
* parser_tools.py: up the format to 235.
|
||||
|
||||
2004-05-12 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_cite_engine, revert_cite_engine): new functions
|
||||
to convert the code that specifies the type of the citation engine
|
||||
(basic, natbib or jurabib).
|
||||
|
||||
* parser_tools.py: up the format to 234.
|
||||
|
||||
2004-05-11 José Matos <jamatos@lyx.org>
|
||||
|
||||
* parser_tools.py (get_backend): get the document backend.
|
||||
* lyx2lyx (main): new member of the document structure,
|
||||
the textclass and backend, that default to article and latex.
|
||||
* lyx_1_4.py (add_end_layout): fix bug of mixed \begin_deeper
|
||||
and \end_layout
|
||||
(insert_tracking_changes): insert \tracking_changes 0, if not present
|
||||
in the header.
|
||||
(convert_names, revert_names): for docbook documents transform
|
||||
the styles FirstName and Surname into character styles.
|
||||
|
||||
2004-05-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_graphics):
|
||||
* lyx2lyx: introduce new member of the structure class, dir which
|
||||
carries the directory of the converted file.
|
||||
* lyx2lyx: move default warning level to 1.
|
||||
|
||||
2004-04-29 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_graphics): new, convert graphics filenames
|
||||
* lyx_1_4.py (revert, convert): handle format 233
|
||||
* lyx2lyx: up the format to 233.
|
||||
|
||||
2004-04-19 José Matos <jamatos@lyx.orrg>
|
||||
|
||||
* parser_tools.py (chain): fix the detection of the last format for
|
||||
revertions.
|
||||
|
||||
2004-04-19 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* lyx_1_4.py (convert_frameless_box): Replace instead of adding
|
||||
new code.
|
||||
|
||||
2004-04-14 José Matos <jamatos@lyx.org>
|
||||
|
||||
* error.py
|
||||
* lyxconvert_*
|
||||
* lyxrevert_*: removed
|
||||
|
||||
* lyx_0_12.py
|
||||
* lyx_1_0_0.py
|
||||
* lyx_1_0_1.py
|
||||
+ lyx_1_1_4.py
|
||||
* lyx_1_1_5.py
|
||||
* lyx_1_1_6.py
|
||||
* lyx_1_1_6fix3.py
|
||||
* lyx_1_2.py
|
||||
* lyx_1_3.py
|
||||
* lyx_1_4.py: Added file with the same content as the previous that
|
||||
were removed.
|
||||
|
||||
* lyx2lyx
|
||||
* parser_tools.py: reworked for better modularity.
|
||||
|
||||
2004-03-31 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyxconvert_229.py (convert_jurabib): new, add use_jurabib flag
|
||||
* lyxrevert_230.py (convert_jurabib): new, remove use_jurabib flag
|
||||
* lyxconvert_230.py (convert_float): new, add sideways flag
|
||||
* lyxrevert_231.py (convert_float): new, remove sideways flag
|
||||
* lyxconvert_231.py (convert_bibtopic): new, add use_bibtopic flag
|
||||
* lyxrevert_232.py (convert_bibtopic): new, remove use_bibtopic flag
|
||||
|
||||
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* lyx2lyx: up the format to 232.
|
||||
|
||||
* lyx2lyx: up the format to 231.
|
||||
|
||||
2004-03-26 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyxrevert_225.py (convert_frameless_box): fix minipage ERT output
|
||||
|
||||
2004-02-25 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* lyx2lyx: up the format to 230.
|
||||
|
||||
2004-02-04 José Matos <jamatos@lyx.org>
|
||||
* lyxconvert_210.py: add two new transforms:
|
||||
remove_empty_insets and remove_formula_latex
|
||||
little fix to existing transformations.
|
||||
|
||||
2004-02-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxconvert216.py: one line fix for out of range error.
|
||||
|
||||
2004-02-01 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyxconvert2*.py: quiet encoding warning in python 2.3
|
||||
* lyxrevert_22[3-9].py: quiet encoding warning in python 2.3
|
||||
|
||||
2004-01-06 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyxrevert_228.py: convert ERT status, too
|
||||
* lyxconvert_227.py: ditto, also stop at \\begin_alyout and not
|
||||
\\layout in convert_collapsable()
|
||||
* lyxconvert_228.py (convert_minipage): Add status tag conversion
|
||||
* lyxrevert_225.py: Convert vspace and frameless box insets
|
||||
* lyxrevert_22[3-8].py: fix the 'é' in José's name
|
||||
|
||||
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* lyx2lyx: up the format to 229.
|
||||
* lyxconvert_224.py (convert_minipage): remove function...
|
||||
* lyxconvert_228.py: ...and place it here.
|
||||
* lyxrevert_229.py: new file (bare bones).
|
||||
|
||||
2003-12-19 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyxconvert_227.py (convert_collapsable):
|
||||
* lyxrevert_228.py (convert_collapsable): a more robust method of
|
||||
finding the collapsed status.
|
||||
|
||||
2003-12-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyxrevert_228.py: fix box status conversion
|
||||
* lyxconvert_227.py: ditto
|
||||
|
||||
2003-12-16 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxrevert_228.py: fix sys import.
|
||||
|
||||
2003-12-16 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxconvert_227.py: fix sys import.
|
||||
|
||||
2003-12-15 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx2lyx:
|
||||
* lyxconvert_227.py:
|
||||
* lyxrevert_228.py: convert the InsetCollapsable format between
|
||||
formats 227 and 228.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyxrevert_227.py: InsetExternal gains a 'draft' option, so remove
|
||||
this when reverting to format 226.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx2lyx: up the format to 227.
|
||||
(lyxformat): squash latent bug when reporting an inability to convert
|
||||
to the desired format.
|
||||
|
||||
* lyxconvert_226.py:
|
||||
* lyxrevert_227.py: convert the Box inset between formats 226 and 227.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx2lyx: up the format to 226.
|
||||
|
||||
* lyxconvert_225.py:
|
||||
* lyxrevert_226.py: convert the Note inset between formats 225 and 226.
|
||||
|
||||
2003-12-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* error.py:
|
||||
* parser_tools.py: quiet encoding warning in python 2.3.
|
||||
|
||||
* lyx2lyx: add logfile as an option.
|
||||
|
||||
2003-12-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx2lyx: update copyright date
|
||||
* lyxconvert_224.py (convert_breaks): add vertical space convertion.
|
||||
|
||||
2003-11-14 Kornel Benko <kornel.benko@berlin.de>
|
||||
|
||||
* lyxconvert_224.py (convert_minipage): fix convertion of minipages
|
||||
from lyx 1.3.x.
|
||||
|
||||
2003-11-14 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxconvert_224.py (convert_breaks): avoid removal of paragraph
|
||||
arguments when a page breake or a line were present.
|
||||
|
||||
2003-11-07 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxconvert_224.py (convert_minipage): deal better with default
|
||||
parameter of minipages from lyx 1.3.x
|
||||
|
||||
2003-11-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxconvert_224.py (convert_breaks): Create an empty paragraph for
|
||||
possible upper page and line breaks, if necessary.
|
||||
|
||||
2003-10-27 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyxconvert_223.py:
|
||||
* lyxconvert_224.py (convert_minipage): move funtion to its right place.
|
||||
(convert_breaks): convert line and page break, at bottom and top.
|
@ -17,7 +17,9 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
from parser_tools import get_value, check_token, find_token,\
|
||||
" The LyX module has all the rules related with different lyx file formats."
|
||||
|
||||
from parser_tools import get_value, check_token, find_token, \
|
||||
find_tokens, find_end_of
|
||||
import os.path
|
||||
import gzip
|
||||
@ -28,11 +30,11 @@ import time
|
||||
|
||||
try:
|
||||
import lyx2lyx_version
|
||||
version_lyx2lyx = lyx2lyx_version.version
|
||||
version__ = lyx2lyx_version.version
|
||||
except: # we are running from build directory so assume the last version
|
||||
version_lyx2lyx = '1.5.0svn'
|
||||
version__ = '1.6.xsvn'
|
||||
|
||||
default_debug_level = 2
|
||||
default_debug__ = 2
|
||||
|
||||
####################################################################
|
||||
# Private helper functions
|
||||
@ -41,13 +43,13 @@ def find_end_of_inset(lines, i):
|
||||
" Find beginning of inset, where lines[i] is included."
|
||||
return find_end_of(lines, i, "\\begin_inset", "\\end_inset")
|
||||
|
||||
def generate_minor_versions(major, last_minor_version):
|
||||
def minor_versions(major, last_minor_version):
|
||||
""" Generate minor versions, using major as prefix and minor
|
||||
versions from 0 until last_minor_version, plus the generic version.
|
||||
|
||||
Example:
|
||||
|
||||
generate_minor_versions("1.2", 4) ->
|
||||
minor_versions("1.2", 4) ->
|
||||
[ "1.2", "1.2.0", "1.2.1", "1.2.2", "1.2.3"]
|
||||
"""
|
||||
return [major] + [major + ".%d" % i for i in range(last_minor_version + 1)]
|
||||
@ -65,20 +67,32 @@ original_version = re.compile(r".*?LyX ([\d.]*)")
|
||||
##
|
||||
# file format information:
|
||||
# file, supported formats, stable release versions
|
||||
format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)),
|
||||
("0_08", [210], generate_minor_versions("0.8" , 6) + ["0.7"]),
|
||||
("0_10", [210], generate_minor_versions("0.10", 7) + ["0.9"]),
|
||||
("0_12", [215], generate_minor_versions("0.12", 1) + ["0.11"]),
|
||||
("1_0", [215], generate_minor_versions("1.0" , 4)),
|
||||
("1_1", [215], generate_minor_versions("1.1" , 4)),
|
||||
format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
|
||||
("0_08", [210], minor_versions("0.8" , 6) + ["0.7"]),
|
||||
("0_10", [210], minor_versions("0.10", 7) + ["0.9"]),
|
||||
("0_12", [215], minor_versions("0.12", 1) + ["0.11"]),
|
||||
("1_0", [215], minor_versions("1.0" , 4)),
|
||||
("1_1", [215], minor_versions("1.1" , 4)),
|
||||
("1_1_5", [216], ["1.1.5","1.1.5.1","1.1.5.2","1.1"]),
|
||||
("1_1_6_0", [217], ["1.1.6","1.1.6.1","1.1.6.2","1.1"]),
|
||||
("1_1_6_3", [218], ["1.1.6.3","1.1.6.4","1.1"]),
|
||||
("1_2", [220], generate_minor_versions("1.2" , 4)),
|
||||
("1_3", [221], generate_minor_versions("1.3" , 7)),
|
||||
("1_4", range(222,246), generate_minor_versions("1.4" , 5)),
|
||||
("1_5", range(246,277), generate_minor_versions("1.5" , 0))]
|
||||
("1_2", [220], minor_versions("1.2" , 4)),
|
||||
("1_3", [221], minor_versions("1.3" , 7)),
|
||||
("1_4", range(222,246), minor_versions("1.4" , 5)),
|
||||
("1_5", range(246,277), minor_versions("1.5" , 6)),
|
||||
("1_6", range(277,346), minor_versions("1.6" , 0))]
|
||||
|
||||
####################################################################
|
||||
# This is useful just for development versions #
|
||||
# if the list of supported formats is empty get it from last step #
|
||||
if not format_relation[-1][1]:
|
||||
step, mode = format_relation[-1][0], "convert"
|
||||
convert = getattr(__import__("lyx_" + step), mode)
|
||||
format_relation[-1] = (step,
|
||||
[conv[0] for conv in convert],
|
||||
format_relation[-1][2])
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
def formats_list():
|
||||
" Returns a list with supported file formats."
|
||||
@ -99,7 +113,7 @@ def get_backend(textclass):
|
||||
" For _textclass_ returns its backend."
|
||||
if textclass == "linuxdoc" or textclass == "manpage":
|
||||
return "linuxdoc"
|
||||
if textclass[:7] == "docbook":
|
||||
if textclass.startswith("docbook") or textclass.startswith("agu-"):
|
||||
return "docbook"
|
||||
return "latex"
|
||||
|
||||
@ -113,6 +127,7 @@ def trim_eol(line):
|
||||
|
||||
|
||||
def get_encoding(language, inputencoding, format, cjk_encoding):
|
||||
" Returns enconding of the lyx file"
|
||||
if format > 248:
|
||||
return "utf8"
|
||||
# CJK-LyX encodes files using the current locale encoding.
|
||||
@ -121,7 +136,7 @@ def get_encoding(language, inputencoding, format, cjk_encoding):
|
||||
# argument.
|
||||
if cjk_encoding == 'auto':
|
||||
return locale.getpreferredencoding()
|
||||
elif cjk_encoding != '':
|
||||
elif cjk_encoding:
|
||||
return cjk_encoding
|
||||
from lyx2lyx_lang import lang
|
||||
if inputencoding == "auto" or inputencoding == "default":
|
||||
@ -138,11 +153,11 @@ def get_encoding(language, inputencoding, format, cjk_encoding):
|
||||
##
|
||||
# Class
|
||||
#
|
||||
class LyX_Base:
|
||||
class LyX_base:
|
||||
"""This class carries all the information of the LyX file."""
|
||||
|
||||
def __init__(self, end_format = 0, input = "", output = "", error
|
||||
= "", debug = default_debug_level, try_hard = 0, cjk_encoding = '',
|
||||
|
||||
def __init__(self, end_format = 0, input = "", output = "", error = "",
|
||||
debug = default_debug__, try_hard = 0, cjk_encoding = '',
|
||||
language = "english", encoding = "auto"):
|
||||
|
||||
"""Arguments:
|
||||
@ -182,8 +197,9 @@ class LyX_Base:
|
||||
self.language = language
|
||||
|
||||
|
||||
def warning(self, message, debug_level= default_debug_level):
|
||||
" Emits warning to self.error, if the debug_level is less than the self.debug."
|
||||
def warning(self, message, debug_level= default_debug__):
|
||||
""" Emits warning to self.error, if the debug_level is less
|
||||
than the self.debug."""
|
||||
if debug_level <= self.debug:
|
||||
self.err.write("Warning: " + message + "\n")
|
||||
|
||||
@ -199,9 +215,10 @@ class LyX_Base:
|
||||
|
||||
|
||||
def read(self):
|
||||
"""Reads a file into the self.header and self.body parts, from self.input."""
|
||||
"""Reads a file into the self.header and
|
||||
self.body parts, from self.input."""
|
||||
|
||||
while 1:
|
||||
while True:
|
||||
line = self.input.readline()
|
||||
if not line:
|
||||
self.error("Invalid LyX file.")
|
||||
@ -216,10 +233,14 @@ class LyX_Base:
|
||||
line = trim_eol(line)
|
||||
if check_token(line, '\\end_preamble'):
|
||||
break
|
||||
|
||||
if line.split()[:0] in ("\\layout", "\\begin_layout", "\\begin_body"):
|
||||
self.warning("Malformed LyX file: Missing '\\end_preamble'.")
|
||||
self.warning("Adding it now and hoping for the best.")
|
||||
|
||||
if line.split()[:0] in ("\\layout",
|
||||
"\\begin_layout", "\\begin_body"):
|
||||
|
||||
self.warning("Malformed LyX file:"
|
||||
"Missing '\\end_preamble'."
|
||||
"\nAdding it now and hoping"
|
||||
"for the best.")
|
||||
|
||||
self.preamble.append(line)
|
||||
|
||||
@ -230,7 +251,8 @@ class LyX_Base:
|
||||
if not line:
|
||||
continue
|
||||
|
||||
if line.split()[0] in ("\\layout", "\\begin_layout", "\\begin_body", "\\begin_deeper"):
|
||||
if line.split()[0] in ("\\layout", "\\begin_layout",
|
||||
"\\begin_body", "\\begin_deeper"):
|
||||
self.body.append(line)
|
||||
break
|
||||
|
||||
@ -245,9 +267,13 @@ class LyX_Base:
|
||||
self.textclass = get_value(self.header, "\\textclass", 0)
|
||||
self.backend = get_backend(self.textclass)
|
||||
self.format = self.read_format()
|
||||
self.language = get_value(self.header, "\\language", 0, default = "english")
|
||||
self.inputencoding = get_value(self.header, "\\inputencoding", 0, default = "auto")
|
||||
self.encoding = get_encoding(self.language, self.inputencoding, self.format, self.cjk_encoding)
|
||||
self.language = get_value(self.header, "\\language", 0,
|
||||
default = "english")
|
||||
self.inputencoding = get_value(self.header, "\\inputencoding",
|
||||
0, default = "auto")
|
||||
self.encoding = get_encoding(self.language,
|
||||
self.inputencoding, self.format,
|
||||
self.cjk_encoding)
|
||||
self.initial_version = self.read_version()
|
||||
|
||||
# Second pass over header and preamble, now we know the file encoding
|
||||
@ -270,8 +296,8 @@ class LyX_Base:
|
||||
self.set_format()
|
||||
self.set_textclass()
|
||||
if self.encoding == "auto":
|
||||
self.encoding = get_encoding(self.language, self.encoding, self.format, self.cjk_encoding)
|
||||
|
||||
self.encoding = get_encoding(self.language, self.encoding,
|
||||
self.format, self.cjk_encoding)
|
||||
if self.preamble:
|
||||
i = find_token(self.header, '\\textclass', 0) + 1
|
||||
preamble = ['\\begin_preamble'] + self.preamble + ['\\end_preamble']
|
||||
@ -323,8 +349,9 @@ class LyX_Base:
|
||||
|
||||
|
||||
def read_version(self):
|
||||
""" Searchs for clues of the LyX version used to write the file, returns the
|
||||
most likely value, or None otherwise."""
|
||||
""" Searchs for clues of the LyX version used to write the
|
||||
file, returns the most likely value, or None otherwise."""
|
||||
|
||||
for line in self.header:
|
||||
if line[0] != "#":
|
||||
return None
|
||||
@ -347,7 +374,8 @@ class LyX_Base:
|
||||
|
||||
def set_version(self):
|
||||
" Set the header with the version used."
|
||||
self.header[0] = "#LyX %s created this file. For more info see http://www.lyx.org/" % version_lyx2lyx
|
||||
self.header[0] = " ".join(["#LyX %s created this file." % version__,
|
||||
"For more info see http://www.lyx.org/"])
|
||||
if self.header[1][0] == '#':
|
||||
del self.header[1]
|
||||
|
||||
@ -378,6 +406,56 @@ class LyX_Base:
|
||||
self.header[i] = "\\textclass %s" % self.textclass
|
||||
|
||||
|
||||
#Note that the module will be added at the END of the extant ones
|
||||
def add_module(self, module):
|
||||
i = find_token(self.header, "\\begin_modules", 0)
|
||||
if i == -1:
|
||||
#No modules yet included
|
||||
i = find_token(self.header, "\\textclass", 0)
|
||||
if i == -1:
|
||||
self.warning("Malformed LyX document: No \\textclass!!")
|
||||
return
|
||||
modinfo = ["\\begin_modules", module, "\\end_modules"]
|
||||
self.header[i + 1: i + 1] = modinfo
|
||||
return
|
||||
j = find_token(self.header, "\\end_modules", i)
|
||||
if j == -1:
|
||||
self.warning("(add_module)Malformed LyX document: No \\end_modules.")
|
||||
return
|
||||
k = find_token(self.header, module, i)
|
||||
if k != -1 and k < j:
|
||||
return
|
||||
self.header.insert(j, module)
|
||||
|
||||
|
||||
def get_module_list(self):
|
||||
i = find_token(self.header, "\\begin_modules", 0)
|
||||
if (i == -1):
|
||||
return []
|
||||
j = find_token(self.header, "\\end_modules", i)
|
||||
return self.header[i + 1 : j]
|
||||
|
||||
|
||||
def set_module_list(self, mlist):
|
||||
modbegin = find_token(self.header, "\\begin_modules", 0)
|
||||
newmodlist = ['\\begin_modules'] + mlist + ['\\end_modules']
|
||||
if (modbegin == -1):
|
||||
#No modules yet included
|
||||
tclass = find_token(self.header, "\\textclass", 0)
|
||||
if tclass == -1:
|
||||
self.warning("Malformed LyX document: No \\textclass!!")
|
||||
return
|
||||
modbegin = tclass + 1
|
||||
self.header[modbegin:modbegin] = newmodlist
|
||||
return
|
||||
modend = find_token(self.header, "\\end_modules", modbegin)
|
||||
if modend == -1:
|
||||
self.warning("(set_module_list)Malformed LyX document: No \\end_modules.")
|
||||
return
|
||||
newmodlist = ['\\begin_modules'] + mlist + ['\\end_modules']
|
||||
self.header[modbegin:modend + 1] = newmodlist
|
||||
|
||||
|
||||
def set_parameter(self, param, value):
|
||||
" Set the value of the header parameter."
|
||||
i = find_token(self.header, '\\' + param, 0)
|
||||
@ -403,9 +481,11 @@ class LyX_Base:
|
||||
for step in convertion_chain:
|
||||
steps = getattr(__import__("lyx_" + step), mode)
|
||||
|
||||
self.warning("Convertion step: %s - %s" % (step, mode), default_debug_level + 1)
|
||||
self.warning("Convertion step: %s - %s" % (step, mode),
|
||||
default_debug__ + 1)
|
||||
if not steps:
|
||||
self.error("The convertion to an older format (%s) is not implemented." % self.format)
|
||||
self.error("The convertion to an older "
|
||||
"format (%s) is not implemented." % self.format)
|
||||
|
||||
multi_conv = len(steps) != 1
|
||||
for version, table in steps:
|
||||
@ -419,24 +499,26 @@ class LyX_Base:
|
||||
try:
|
||||
conv(self)
|
||||
except:
|
||||
self.warning("An error ocurred in %s, %s" % (version, str(conv)),
|
||||
default_debug_level)
|
||||
self.warning("An error ocurred in %s, %s" %
|
||||
(version, str(conv)),
|
||||
default_debug__)
|
||||
if not self.try_hard:
|
||||
raise
|
||||
self.status = 2
|
||||
else:
|
||||
self.warning("%lf: Elapsed time on %s" % (time.time() - init_t, str(conv)),
|
||||
default_debug_level + 1)
|
||||
|
||||
self.warning("%lf: Elapsed time on %s" %
|
||||
(time.time() - init_t,
|
||||
str(conv)), default_debug__ +
|
||||
1)
|
||||
self.format = version
|
||||
if self.end_format == self.format:
|
||||
return
|
||||
|
||||
|
||||
def chain(self):
|
||||
""" This is where all the decisions related with the convertion are taken.
|
||||
It returns a list of modules needed to convert the LyX file from
|
||||
self.format to self.end_format"""
|
||||
""" This is where all the decisions related with the
|
||||
convertion are taken. It returns a list of modules needed to
|
||||
convert the LyX file from self.format to self.end_format"""
|
||||
|
||||
self.start = self.format
|
||||
format = self.format
|
||||
@ -451,7 +533,9 @@ class LyX_Base:
|
||||
|
||||
if not correct_version:
|
||||
if format <= 215:
|
||||
self.warning("Version does not match file format, discarding it. (Version %s, format %d)" %(self.initial_version, self.format))
|
||||
self.warning("Version does not match file format, "
|
||||
"discarding it. (Version %s, format %d)" %
|
||||
(self.initial_version, self.format))
|
||||
for rel in format_relation:
|
||||
if format in rel[1]:
|
||||
initial_step = rel[0]
|
||||
@ -493,15 +577,18 @@ class LyX_Base:
|
||||
if last_step[1][-1] == self.end_format:
|
||||
steps.pop()
|
||||
|
||||
self.warning("Convertion mode: %s\tsteps%s" %(mode, steps), 10)
|
||||
return mode, steps
|
||||
|
||||
|
||||
def get_toc(self, depth = 4):
|
||||
" Returns the TOC of this LyX document."
|
||||
paragraphs_filter = {'Title' : 0,'Chapter' : 1, 'Section' : 2, 'Subsection' : 3, 'Subsubsection': 4}
|
||||
paragraphs_filter = {'Title' : 0,'Chapter' : 1, 'Section' : 2,
|
||||
'Subsection' : 3, 'Subsubsection': 4}
|
||||
allowed_insets = ['Quotes']
|
||||
allowed_parameters = '\\paragraph_spacing', '\\noindent', '\\align', '\\labelwidthstring', "\\start_of_appendix", "\\leftindent"
|
||||
|
||||
allowed_parameters = ('\\paragraph_spacing', '\\noindent',
|
||||
'\\align', '\\labelwidthstring',
|
||||
"\\start_of_appendix", "\\leftindent")
|
||||
sections = []
|
||||
for section in paragraphs_filter.keys():
|
||||
sections.append('\\begin_layout %s' % section)
|
||||
@ -526,8 +613,9 @@ class LyX_Base:
|
||||
|
||||
k = i + 1
|
||||
# skip paragraph parameters
|
||||
while not self.body[k].strip() or self.body[k].split()[0] in allowed_parameters:
|
||||
k = k +1
|
||||
while not self.body[k].strip() or self.body[k].split()[0] \
|
||||
in allowed_parameters:
|
||||
k += 1
|
||||
|
||||
while k < j:
|
||||
if check_token(self.body[k], '\\begin_inset'):
|
||||
@ -541,7 +629,7 @@ class LyX_Base:
|
||||
k = end + 1
|
||||
else:
|
||||
par.append(self.body[k])
|
||||
k = k + 1
|
||||
k += 1
|
||||
|
||||
# trim empty lines in the end.
|
||||
while par and par[-1].strip() == '':
|
||||
@ -554,19 +642,23 @@ class LyX_Base:
|
||||
return toc_par
|
||||
|
||||
|
||||
class File(LyX_Base):
|
||||
class File(LyX_base):
|
||||
" This class reads existing LyX files."
|
||||
def __init__(self, end_format = 0, input = "", output = "", error = "", debug = default_debug_level, try_hard = 0, cjk_encoding = ''):
|
||||
LyX_Base.__init__(self, end_format, input, output, error, debug, try_hard, cjk_encoding)
|
||||
|
||||
def __init__(self, end_format = 0, input = "", output = "", error = "",
|
||||
debug = default_debug__, try_hard = 0, cjk_encoding = ''):
|
||||
LyX_base.__init__(self, end_format, input, output, error,
|
||||
debug, try_hard, cjk_encoding)
|
||||
self.read()
|
||||
|
||||
|
||||
class NewFile(LyX_Base):
|
||||
class NewFile(LyX_base):
|
||||
" This class is to create new LyX files."
|
||||
def set_header(self, **params):
|
||||
# set default values
|
||||
self.header.extend([
|
||||
"#LyX xxxx created this file. For more info see http://www.lyx.org/",
|
||||
"#LyX xxxx created this file."
|
||||
"For more info see http://www.lyx.org/",
|
||||
"\\lyxformat xxx",
|
||||
"\\begin_document",
|
||||
"\\begin_header",
|
||||
@ -615,7 +707,8 @@ class NewFile(LyX_Base):
|
||||
|
||||
|
||||
class Paragraph:
|
||||
# unfinished implementation, it is missing the Text and Insets representation.
|
||||
# unfinished implementation, it is missing the Text and Insets
|
||||
# representation.
|
||||
" This class represents the LyX paragraphs."
|
||||
def __init__(self, name, body=[], settings = [], child = []):
|
||||
""" Parameters:
|
||||
@ -629,7 +722,9 @@ class Paragraph:
|
||||
self.child = child
|
||||
|
||||
def asLines(self):
|
||||
" Converts the paragraph to a list of strings, representing it in the LyX file."
|
||||
""" Converts the paragraph to a list of strings, representing
|
||||
it in the LyX file."""
|
||||
|
||||
result = ['','\\begin_layout %s' % self.name]
|
||||
result.extend(self.settings)
|
||||
result.append('')
|
||||
@ -645,13 +740,3 @@ class Paragraph:
|
||||
result.append('\\end_deeper')
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class Inset:
|
||||
" This class represents the LyX insets."
|
||||
pass
|
||||
|
||||
|
||||
class Text:
|
||||
" This class represents simple chuncks of text."
|
||||
pass
|
||||
|
@ -27,6 +27,7 @@ dist_lyx2lyx_PYTHON = \
|
||||
lyx_1_3.py \
|
||||
lyx_1_4.py \
|
||||
lyx_1_5.py \
|
||||
lyx_1_6.py \
|
||||
profiling.py \
|
||||
test_parser_tools.py
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
|
||||
# Copyright (C) 2002-2007 José Matos <jamatos@lyx.org>
|
||||
# Copyright (C) 2002-2004 Dekel Tsur <dekel@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -16,86 +17,67 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
import getopt
|
||||
" Program used to convert between different versions of the lyx file format."
|
||||
import optparse
|
||||
import sys
|
||||
import LyX
|
||||
|
||||
def usage():
|
||||
print """Usage: lyx2lyx [options] [file]
|
||||
Convert old lyx file <file> to newer format, files can be compressed with gzip.
|
||||
If there no file is specified then the standard input is assumed, in this case
|
||||
gziped files are not handled.
|
||||
Options:
|
||||
-h, --help this information
|
||||
-v, --version output version information and exit
|
||||
-l, --list list all available formats
|
||||
-d, --debug level level=0..2 (O_ no debug information, 2_verbose)
|
||||
default: level=1
|
||||
-e, --err error_file name of the error file or else goes to stderr
|
||||
-f, --from version initial version (optional)
|
||||
-t, --to version final version (optional)
|
||||
-o, --output name name of the output file or else goes to stdout
|
||||
-n, --try-hard try hard (ignore any convertion errors)
|
||||
-c, --cjk [encoding] files in format 248 and lower are read and
|
||||
written in the format of CJK-LyX.
|
||||
If encoding is not given or 'auto' the encoding
|
||||
is determined from the locale.
|
||||
-q, --quiet same as --debug=0"""
|
||||
def main():
|
||||
args = {}
|
||||
args["usage"] = "usage: %prog [options] [file]"
|
||||
|
||||
args["version"] = """lyx2lyx, version %s
|
||||
Copyright (C) 2007 José Matos and Dekel Tsur""" % LyX.version__
|
||||
|
||||
def parse_options(argv):
|
||||
_options = ["help", "version", "list", "debug=", "err=", "from=", "to=", "output=", "try-hard", "cjk", "quiet"]
|
||||
try:
|
||||
opts, args = getopt.getopt(argv[1:], "c:d:e:f:hlno:qt:v", _options)
|
||||
except getopt.error:
|
||||
usage()
|
||||
sys.exit(2)
|
||||
args["description"] = """Convert old lyx file <file> to newer format,
|
||||
files can be compressed with gzip. If there no file is specified then
|
||||
the standard input is assumed, in this case gziped files are not
|
||||
handled."""
|
||||
|
||||
end_format, input, output, error, debug, try_hard = 0, "", "", "", LyX.default_debug_level, 0
|
||||
cjk_encoding = ''
|
||||
for o, a in opts:
|
||||
if o in ("-h", "--help"):
|
||||
usage()
|
||||
sys.exit()
|
||||
if o in ("-v", "--version"):
|
||||
print "lyx2lyx, version %s" %(LyX.version_lyx2lyx)
|
||||
print "Copyright (C) 2002-2004 José Matos and Dekel Tsur"
|
||||
sys.exit()
|
||||
if o in ("-d", "--debug"):
|
||||
debug = int(a)
|
||||
if o in ("-q", "--quiet"):
|
||||
debug = 0
|
||||
if o in ("-l", "--list"):
|
||||
print LyX.formats_list()
|
||||
sys.exit()
|
||||
if o in ("-o", "--output"):
|
||||
output = a
|
||||
if o in ("-t", "--to"):
|
||||
end_format = a
|
||||
if o in ("-e","--err"):
|
||||
error = a
|
||||
if o in ("-n", "--try-hard"):
|
||||
try_hard = 1
|
||||
if o in ("-c", "--cjk"):
|
||||
if a == '':
|
||||
cjk_encoding = 'auto'
|
||||
else:
|
||||
cjk_encoding = a
|
||||
parser = optparse.OptionParser(**args)
|
||||
|
||||
parser.set_defaults(debug=LyX.default_debug__, cjk_encoding = '')
|
||||
parser.add_option("-d", "--debug", type="int",
|
||||
help="level=0..2 (O_ quiet, 2_verbose) default: 1")
|
||||
parser.add_option("-q", "--quiet",
|
||||
action="store_const", const=0, dest="debug")
|
||||
parser.add_option("-v", "--verbose",
|
||||
action="store_const", const=1, dest="debug")
|
||||
parser.add_option("--noisy",
|
||||
action="store_const", const=2, dest="debug")
|
||||
parser.add_option("-c", "--encoding", dest="cjk_encoding",
|
||||
help="files in format 248 and lower are read and"
|
||||
" written in the format of CJK-LyX."
|
||||
"If encoding is not given or 'auto' the encoding"
|
||||
"is determined from the locale.")
|
||||
parser.add_option("-e", "--err", dest="error",
|
||||
help= "file name of the error file else goes to stderr")
|
||||
parser.add_option("-o", "--output",
|
||||
help= "name of the output file else goes to stdout")
|
||||
parser.add_option("-t", "--to", dest= "end_format",
|
||||
help= "destination file format, default (latest)")
|
||||
parser.add_option("-l", "--list", action="store_true",
|
||||
help = "list all available formats")
|
||||
parser.add_option("-n", "--try-hard", action="store_true",
|
||||
help = "try hard (ignore any convertion errors)")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
if args:
|
||||
input = args[0]
|
||||
options.input = args[0]
|
||||
else:
|
||||
options.input = None
|
||||
|
||||
return end_format, input, output, error, debug, try_hard, cjk_encoding
|
||||
if options.list:
|
||||
print LyX.formats_list()
|
||||
sys.exit()
|
||||
else:
|
||||
del options.list
|
||||
|
||||
doc = LyX.File(**options.__dict__)
|
||||
doc.convert()
|
||||
doc.write()
|
||||
|
||||
def main(argv):
|
||||
end_format, input, output, error, debug, try_hard, cjk_encoding = parse_options(argv)
|
||||
file = LyX.File(end_format, input, output, error, debug, try_hard, cjk_encoding)
|
||||
|
||||
file.convert()
|
||||
file.write()
|
||||
|
||||
return file.status
|
||||
|
||||
sys.exit(doc.status)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
main()
|
||||
|
@ -2448,7 +2448,7 @@ def convert_sgml_paragraphs(document):
|
||||
i = i + 10
|
||||
|
||||
##
|
||||
# Convertion hub
|
||||
# Conversion hub
|
||||
#
|
||||
|
||||
supported_versions = ["1.4.%d" % i for i in range(3)] + ["1.4"]
|
||||
|
@ -287,7 +287,7 @@ necessary parsing in modern formats than in ancient ones.
|
||||
inset_result = inset_re.match(document.body[i])
|
||||
if inset_result:
|
||||
insets.append(inset_result.group(1))
|
||||
else:
|
||||
else:
|
||||
insets.append("")
|
||||
elif find_token(document.body, "\\end_inset", i, i + 1) == i:
|
||||
del insets[-1]
|
||||
@ -445,7 +445,7 @@ implemented.'''
|
||||
insets.append(line[13:].split()[0])
|
||||
if line.find('\\end_inset') > -1:
|
||||
del insets[-1]
|
||||
|
||||
|
||||
# Try to write the line
|
||||
try:
|
||||
# If all goes well the line is written here
|
||||
@ -676,7 +676,7 @@ def revert_commandparams(document):
|
||||
if i == -1:
|
||||
break
|
||||
name = document.body[i].split()[2]
|
||||
j = find_end_of_inset(document.body, i + 1)
|
||||
j = find_end_of_inset(document.body, i)
|
||||
preview_line = ""
|
||||
option1 = ""
|
||||
option2 = ""
|
||||
@ -721,7 +721,7 @@ def revert_commandparams(document):
|
||||
lines.append('')
|
||||
lines.append('\\end_inset')
|
||||
document.body[i:j+1] = lines
|
||||
i = j + 1
|
||||
i += len(lines) + 1
|
||||
|
||||
|
||||
def revert_nomenclature(document):
|
||||
@ -1287,7 +1287,7 @@ def normalize_font_whitespace_259(document):
|
||||
""" Before format 259 the font changes were ignored if a
|
||||
whitespace was the first or last character in the sequence, this function
|
||||
transfers the whitespace outside."""
|
||||
|
||||
|
||||
char_properties = {"\\series": "default",
|
||||
"\\emph": "default",
|
||||
"\\color": "none",
|
||||
@ -1298,8 +1298,8 @@ def normalize_font_whitespace_259(document):
|
||||
|
||||
def normalize_font_whitespace_274(document):
|
||||
""" Before format 259 (sic) the font changes were ignored if a
|
||||
whitespace was the first or last character in the sequence. This was
|
||||
corrected for most font properties in format 259, but the language
|
||||
whitespace was the first or last character in the sequence. This was
|
||||
corrected for most font properties in format 259, but the language
|
||||
was forgotten then. This function applies the same conversion done
|
||||
there (namely, transfers the whitespace outside) for font language
|
||||
changes, as well."""
|
||||
@ -1310,11 +1310,11 @@ def normalize_font_whitespace_274(document):
|
||||
def get_paragraph_language(document, i):
|
||||
""" Return the language of the paragraph in which line i of the document
|
||||
body is. If the first thing in the paragraph is a \\lang command, that
|
||||
is the paragraph's langauge; otherwise, the paragraph's language is the
|
||||
is the paragraph's langauge; otherwise, the paragraph's language is the
|
||||
document's language."""
|
||||
|
||||
lines = document.body
|
||||
|
||||
|
||||
first_nonempty_line = \
|
||||
find_nonempty_line(lines, find_beginning_of_layout(lines, i) + 1)
|
||||
|
||||
@ -1324,7 +1324,7 @@ def get_paragraph_language(document, i):
|
||||
return words[1]
|
||||
else:
|
||||
return document.language
|
||||
|
||||
|
||||
def normalize_font_whitespace(document, char_properties):
|
||||
""" Before format 259 the font changes were ignored if a
|
||||
whitespace was the first or last character in the sequence, this function
|
||||
@ -1623,13 +1623,13 @@ def revert_tableborder(document):
|
||||
|
||||
|
||||
def revert_armenian(document):
|
||||
|
||||
# set inputencoding from armscii8 to auto
|
||||
|
||||
# set inputencoding from armscii8 to auto
|
||||
if document.inputencoding == "armscii8":
|
||||
i = find_token(document.header, "\\inputencoding", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\inputencoding auto"
|
||||
# check if preamble exists, if not k is set to -1
|
||||
# check if preamble exists, if not k is set to -1
|
||||
i = 0
|
||||
k = -1
|
||||
while i < len(document.preamble):
|
||||
@ -1646,7 +1646,7 @@ def revert_armenian(document):
|
||||
# create the preamble when it doesn't exist
|
||||
else:
|
||||
document.preamble.append('\\usepackage{armtex}')
|
||||
# Set document language from armenian to english
|
||||
# Set document language from armenian to english
|
||||
if document.language == "armenian":
|
||||
document.language = "english"
|
||||
i = find_token(document.header, "\\language", 0)
|
||||
@ -1686,10 +1686,10 @@ def revert_preamble_listings_params(document):
|
||||
|
||||
|
||||
def revert_listings_inset(document):
|
||||
r''' Revert listings inset to \lstinline or \begin, \end lstlisting, translate
|
||||
r''' Revert listings inset to \lstinline or \begin, \end lstlisting, translate
|
||||
FROM
|
||||
|
||||
\begin_inset
|
||||
\begin_inset
|
||||
lstparams "language=Delphi"
|
||||
inline true
|
||||
status open
|
||||
@ -1787,7 +1787,7 @@ after label
|
||||
k = cap_end + 1
|
||||
inlinecode = ''
|
||||
# looking for the oneline code for lstinline
|
||||
inlinecode = document.body[find_end_of_layout(document.body,
|
||||
inlinecode = document.body[find_end_of_layout(document.body,
|
||||
find_token(document.body, '\\begin_layout %s' % document.default_layout, i + 1) +1 ) - 1]
|
||||
if len(caption) > 0:
|
||||
if len(params) == 0:
|
||||
@ -1806,7 +1806,7 @@ after label
|
||||
document.body[i:(j+1)] = [r'\begin_inset ERT',
|
||||
'status %s' % status,
|
||||
r'\begin_layout %s' % document.default_layout,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
r'\backslash',
|
||||
'lstinline%s{%s}' % (params, inlinecode),
|
||||
@ -1834,7 +1834,7 @@ after label
|
||||
r'\end_layout',
|
||||
'',
|
||||
r'\end_inset']
|
||||
|
||||
|
||||
|
||||
def revert_include_listings(document):
|
||||
r''' Revert lstinputlisting Include option , translate
|
||||
@ -1873,7 +1873,7 @@ lstinputlisting{file}[opt]
|
||||
# find command line lstinputlisting{file}[options]
|
||||
cmd, file, option = '', '', ''
|
||||
if re.match(r'\\(lstinputlisting){([.\w]*)}(.*)', document.body[i].split()[2]):
|
||||
cmd, file, option = re.match(r'\\(lstinputlisting){([.\w]*)}(.*)', document.body[i].split()[2]).groups()
|
||||
cmd, file, option = re.match(r'\\(lstinputlisting){([.\w]*)}(.*)', document.body[i].split()[2]).groups()
|
||||
option = option.replace('\\', '\\backslash\n')
|
||||
document.body[i : j + 1] = [r'\begin_inset ERT',
|
||||
'status open',
|
||||
|
3229
lib/lyx2lyx/lyx_1_6.py
Normal file
3229
lib/lyx2lyx/lyx_1_6.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -156,6 +156,27 @@ def get_value(lines, token, start, end = 0, default = ""):
|
||||
return default
|
||||
|
||||
|
||||
def get_value_string(lines, token, start, end = 0, trim = False, default = ""):
|
||||
""" get_value_string(lines, token, start[[, end], trim, default]) -> string
|
||||
|
||||
Return tokens after token as string, in lines, where
|
||||
token is the first element. When trim is used, the first and last character
|
||||
of the string is trimmed."""
|
||||
|
||||
i = find_token_exact(lines, token, start, end)
|
||||
if i == -1:
|
||||
return default
|
||||
if len(lines[i].split()) > 1:
|
||||
for k in range (0, len(lines[i])):
|
||||
if lines[i][k] == ' ':
|
||||
if trim ==False:
|
||||
return lines[i][k+1:len(lines[i])]
|
||||
else:
|
||||
return lines[i][k+2:len(lines[i])-1]
|
||||
else:
|
||||
return default
|
||||
|
||||
|
||||
def del_token(lines, token, start, end):
|
||||
""" del_token(lines, token, start, end) -> int
|
||||
|
||||
|
@ -35,11 +35,10 @@ Example:
|
||||
./profiling.py -ou.lyx ../doc/UserGuide.lyx
|
||||
"""
|
||||
|
||||
def main(argv):
|
||||
def main():
|
||||
# This will only work with python >= 2.2, the version where this module was added
|
||||
prof = hotshot.Profile("lyx2lyx.prof") # Use temporary file, here?
|
||||
benchtime = prof.runcall(
|
||||
lambda : lyx2lyx.main(argv))
|
||||
benchtime = prof.runcall(lyx2lyx.main)
|
||||
prof.close()
|
||||
|
||||
# After the tests, show the profile analysis.
|
||||
@ -52,4 +51,4 @@ def main(argv):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
||||
main()
|
||||
|
@ -22,6 +22,12 @@ What's new
|
||||
** Updates:
|
||||
***********
|
||||
|
||||
* IMPORTING LyX 1.6.x DOCUMENTS
|
||||
|
||||
- The lyx2lyx framework has been updated to be the same as LyX 1.6.0.
|
||||
This means that now all documents from version 1.6.x can be imported
|
||||
directly.
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
- Updated localization of the user interface for Catalan, Czech, French,
|
||||
@ -136,7 +142,7 @@ What's new
|
||||
|
||||
- Fix LaTeX errors in Latvian and Lithuanian documents (bug 5323, bug 5324).
|
||||
|
||||
- If "Do not use amsmath" is selected in the document settings, really do
|
||||
- If "Do not use amsmath" is selected in the document settings, really do
|
||||
not use it (bug 5350).
|
||||
|
||||
- Fix the output of IPA symbols with the encoding "utf8".
|
||||
|
Loading…
Reference in New Issue
Block a user