From 82765345acde2d8cbcc3f700f97ef312aaa1b120 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 28 Sep 2005 09:40:50 +0000 Subject: [PATCH] fix space insets, increase version to 244. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10490 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/ChangeLog | 4 ++++ development/FORMAT | 7 +++++++ lib/doc/ChangeLog | 5 +++++ lib/doc/Extended.lyx | 24 +++++++++++------------- lib/doc/UserGuide.lyx | 17 ++++++++--------- lib/lyx2lyx/ChangeLog | 8 ++++++++ lib/lyx2lyx/LyX.py | 2 +- lib/lyx2lyx/lyx_1_4.py | 38 +++++++++++++++++++++++++++++++++++--- src/ChangeLog | 4 ++++ src/buffer.C | 2 +- src/insets/ChangeLog | 5 +++++ src/insets/insetspace.C | 9 ++++----- 12 files changed, 93 insertions(+), 32 deletions(-) diff --git a/development/ChangeLog b/development/ChangeLog index b5823cfced..dcf6b65536 100644 --- a/development/ChangeLog +++ b/development/ChangeLog @@ -1,3 +1,7 @@ +2005-09-28 Jürgen Spitzmüller + + * FORMAT: document format change to 244. + 2005-09-21 Bennett Helm * MacOSX/LyX.app/Contents/Info.plist: change description of .lyx diff --git a/development/FORMAT b/development/FORMAT index 9d331f1879..65164a079a 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,13 @@ LyX file-format changes ----------------------- +2005-09-24 Jürgen Spitzmüller + + * format incremented to 244. Rename '\InsetSpace \,' + to '\InsetSpace \thinspace{}', because the comma was + not parsed by lyxlex, and '\InsetSpace \space' to + '\InsetSpace \space{}' in favour of consistency. + 2005-07-18 José Matos * format incremented to 243. diff --git a/lib/doc/ChangeLog b/lib/doc/ChangeLog index 821ff6b9d2..1b7378a619 100644 --- a/lib/doc/ChangeLog +++ b/lib/doc/ChangeLog @@ -1,3 +1,8 @@ +2005-09-28 Jürgen Spitzmüller + + * UserGuide.lyx: + * Extended.lyx: fix broken space insets. Format is now 244. + 2005-09-19 Jürgen Spitzmüller * UserGuide.lyx: document new space inset, correct some diff --git a/lib/doc/Extended.lyx b/lib/doc/Extended.lyx index 67a5804f67..138fc3a8bf 100644 --- a/lib/doc/Extended.lyx +++ b/lib/doc/Extended.lyx @@ -1,5 +1,5 @@ #LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/ -\lyxformat 243 +\lyxformat 244 \begin_document \begin_header \textclass book @@ -2078,8 +2078,8 @@ Alternative Citation Styles \end_layout \begin_layout Standard -Standard BibTeX uses numbers (e.\InsetSpace \, -g.\InsetSpace \space +Standard BibTeX uses numbers (e.\InsetSpace \thinspace{} +g.\InsetSpace \space{} \begin_inset Quotes eld \end_inset @@ -2090,8 +2090,8 @@ g.\InsetSpace \space ) to refer to a cited work. However, in many scientific disciplines, other citation styles are in use. - The most common one is the author-year style (e.\InsetSpace \, -g.\InsetSpace \space + The most common one is the author-year style (e.\InsetSpace \thinspace{} +g.\InsetSpace \space{} \begin_inset Quotes eld \end_inset @@ -2287,8 +2287,8 @@ Scientific works \begin_inset Quotes erd \end_inset -, you first need to create two bibliographic databases, e.\InsetSpace \, -g.\InsetSpace \space +, you first need to create two bibliographic databases, e.\InsetSpace \thinspace{} +g.\InsetSpace \space{} \family typewriter sources.bib @@ -2412,8 +2412,8 @@ Multiple Bibliographies \end_layout \begin_layout Standard -Multiple bibliographies, e.\InsetSpace \, -g.\InsetSpace \space +Multiple bibliographies, e.\InsetSpace \thinspace{} +g.\InsetSpace \space{} a bibliography for each section or chapter of the document, are not supported by BibTeX itself. But the @@ -2502,7 +2502,7 @@ end{btUnit} (those commands have to be inserted as ERT). The bibliography will contain all references which have been cited in the current btUnit. - N.\InsetSpace + N.\InsetSpace \thinspace{} B.: If you are using this approach, then \emph on every @@ -2543,7 +2543,6 @@ In the \emph default \bar default \noun default -\color default Outputs\SpecialChar \menuseparator LaT\SpecialChar \textcompwordmark{} eX @@ -2554,7 +2553,6 @@ eX \emph off \bar no \noun off -\color none section of the preferences dialog, however, you can customize the index command, if you prefer an alternative program like \family typewriter @@ -2564,7 +2562,7 @@ eX \emph default \bar default \noun default -\color default +\color none xindy \family roman \series medium diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx index 63ac716154..21308ab867 100644 --- a/lib/doc/UserGuide.lyx +++ b/lib/doc/UserGuide.lyx @@ -1,5 +1,5 @@ #LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/ -\lyxformat 243 +\lyxformat 244 \begin_document \begin_header \textclass scrbook @@ -12401,8 +12401,8 @@ With the corrections, our earlier examples look like this: \end_layout \begin_layout Itemize -e.\InsetSpace \, -g.\InsetSpace \space +e.\InsetSpace \thinspace{} +g.\InsetSpace \space{} this is too much space! \end_layout @@ -22015,9 +22015,8 @@ Inter-word Space \end_layout \begin_layout Standard -Some languages (e.\InsetSpace -\InsetSpace \, -g.\InsetSpace \space +Some languages (e.\InsetSpace \thinspace{} +g.\InsetSpace \space{} English) have the typographical convention to add extra space after an end-of-sentence punctuation mark, and LyX honors those conventio ns (see section\InsetSpace ~ @@ -22148,10 +22147,10 @@ protected \end_layout \begin_layout Quote -D.\InsetSpace \, +D.\InsetSpace \thinspace{} E. - Knuth has developped our beloved typesetting program, i.\InsetSpace \, -e.\InsetSpace \space + Knuth has developped our beloved typesetting program, i.\InsetSpace \thinspace{} +e.\InsetSpace \space{} TeX. \end_layout diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index 28078bb021..3975d9cfcc 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,11 @@ +2005-09-28 Jürgen Spitzmüller + + * 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 * parser_tools.py (get_paragraph, get_next_paragraph): add format diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index e71822c4dd..3bf90bca5e 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -46,7 +46,7 @@ format_relation = [("0_10", [210], ["0.10.7","0.10"]), ("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]), ("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]), ("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3"]), - ("1_4", range(222,244), ["1.4.0cvs","1.4"])] + ("1_4", range(222,245), ["1.4.0cvs","1.4"])] def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_4.py b/lib/lyx2lyx/lyx_1_4.py index 26f174c5b5..05a0102ac7 100644 --- a/lib/lyx2lyx/lyx_1_4.py +++ b/lib/lyx2lyx/lyx_1_4.py @@ -65,8 +65,38 @@ def convert_spaces(file): def revert_spaces(file): + regexp = re.compile(r'(.*)(\\InsetSpace\s+)(\S+)') + i = 0 + while 1: + i = find_re(file.body, regexp, i) + if i == -1: + break + space = regexp.match(file.body[i]).group(3) + prepend = regexp.match(file.body[i]).group(1) + if space == '~': + file.body[i] = regexp.sub(prepend + '\\SpecialChar ~', file.body[i]) + i = i + 1 + else: + file.body[i] = regexp.sub(prepend, file.body[i]) + file.body[i+1:i+1] = '' + if space == "\\space": + space = "\\ " + i = insert_ert(file.body, i+1, 'Collapsed', space, file.format - 1) + +## +# \InsetSpace \, -> \InsetSpace \thinspace{} +# \InsetSpace \space -> \InsetSpace \space{} +# +def rename_spaces(file): + for i in range(len(file.body)): + file.body[i] = replace(file.body[i],"\\InsetSpace \\space","\\InsetSpace \\space{}") + file.body[i] = replace(file.body[i],"\\InsetSpace \,","\\InsetSpace \\thinspace{}") + + +def revert_space_names(file): for i in range(len(file.body)): - file.body[i] = replace(file.body[i],"\\InsetSpace ~", "\\SpecialChar ~") + file.body[i] = replace(file.body[i],"\\InsetSpace \\space{}","\\InsetSpace \\space") + file.body[i] = replace(file.body[i],"\\InsetSpace \\thinspace{}","\\InsetSpace \\,") ## @@ -2255,9 +2285,11 @@ convert = [[222, [insert_tracking_changes, add_end_header]], [240, [convert_output_changes]], [241, [convert_ert_paragraphs]], [242, [convert_french]], - [243, [remove_paperpackage]]] + [243, [remove_paperpackage]], + [244, [rename_spaces]]] -revert = [[242, []], +revert = [[243, [revert_space_names]], + [242, []], [241, []], [240, [revert_ert_paragraphs]], [239, [revert_output_changes]], diff --git a/src/ChangeLog b/src/ChangeLog index 64b850b8ac..32655b8321 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-09-28 Jürgen Spitzmüller + + * buffer.C: format is up to 244. + 2005-09-27 Jürgen Spitzmüller * text.C (redoParagraph): fix calcultation of inset width wrt diff --git a/src/buffer.C b/src/buffer.C index 0239130227..a62baf1fae 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -144,7 +144,7 @@ extern BufferList bufferlist; namespace { -int const LYX_FORMAT = 243; +int const LYX_FORMAT = 244; } // namespace anon diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 89ec83996f..9b79976ce3 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2005-09-28 Jürgen Spitzmüller + + * insetspace.C: rename '\,' to '\thinspace{}' (avoid parsing error) + and '\space' to '\space{}' (consistency). + 2005-09-19 Jürgen Spitzmüller * insettabular.C (tabularFeatures): validate cursor after diff --git a/src/insets/insetspace.C b/src/insets/insetspace.C index ef95d15d79..1eed8c05cd 100644 --- a/src/insets/insetspace.C +++ b/src/insets/insetspace.C @@ -106,13 +106,13 @@ void InsetSpace::write(Buffer const &, ostream & os) const string command; switch (kind_) { case NORMAL: - command = "\\space"; + command = "\\space{}"; break; case PROTECTED: command = "~"; break; case THIN: - command = "\\,"; + command = "\\thinspace{}"; break; case QUAD: command = "\\quad{}"; @@ -134,17 +134,16 @@ void InsetSpace::write(Buffer const &, ostream & os) const } -// This function will not be necessary when lyx3 void InsetSpace::read(Buffer const &, LyXLex & lex) { lex.next(); string const command = lex.getString(); - if (command == "\\space") + if (command == "\\space{}") kind_ = NORMAL; else if (command == "~") kind_ = PROTECTED; - else if (command == "\\,") + else if (command == "\\thinspace{}") kind_ = THIN; else if (command == "\\quad{}") kind_ = QUAD; -- 2.39.2