From 0345bef67b701e54fd16d9336ec082b474c0146c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 7 Jun 2010 21:58:27 +0000 Subject: [PATCH] Renaming: \\begin_inset OptArg to \\begin_inset Argument. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34619 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/layouts/stdinsets.inc | 2 +- lib/lyx2lyx/lyx_2_0.py | 31 +++++++++++++++++++++++++++---- src/Buffer.cpp | 2 +- src/factory.cpp | 2 +- src/insets/InsetArgument.cpp | 2 +- src/insets/InsetArgument.h | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index fab6282d85..cfb0804f9d 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -285,7 +285,7 @@ InsetLayout URL HTMLIsBlock false End -InsetLayout OptArg +InsetLayout Argument LabelString opt LabelFont Color collapsable diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index fd815b3bcd..5b962e5128 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1481,8 +1481,8 @@ def revert_lyx_version(document): import lyx2lyx_version version = lyx2lyx_version.version except: - pass - + pass + i = 0 while 1: i = find_token(document.body, '\\begin_inset Info', i) @@ -1697,6 +1697,27 @@ def revert_align_decimal(document): document.body[l].replace('decimal', 'center') +def convert_optarg(document): + " Convert \\begin_inset OptArg to \\begin_inset Argument " + i = 0 + while 1: + i = find_token(document.body, '\\begin_inset OptArg', i) + if i == -1: + return + document.body[i] = "\\begin_inset Argument" + i += 1 + + +def revert_argument(document): + " Convert \\begin_inset Argument to \\begin_inset OptArg " + i = 0 + while 1: + i = find_token(document.body, '\\begin_inset Argument', i) + if i == -1: + return + document.body[i] = "\\begin_inset OptArg" + i += 1 + ## # Conversion hub # @@ -1748,10 +1769,12 @@ convert = [[346, []], [389, [convert_html_quotes]], [390, []], [391, []], - [392, [convert_beamer_args]] + [392, [convert_beamer_args]], + [393, [convert_optarg]] ] -revert = [[391, [revert_beamer_args]], +revert = [[392, [revert_argument]], + [391, [revert_beamer_args]], [390, [revert_align_decimal]], [389, [revert_output_sync]], [388, [revert_html_quotes]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index c4e457b8b6..fcbf23e24d 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -126,7 +126,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 392; // rgh: beamer layout change +int const LYX_FORMAT = 393; // rgh: rename OptArg to Argument in LyX format typedef map DepClean; typedef map > RefCache; diff --git a/src/factory.cpp b/src/factory.cpp index 4701f9a9ab..9f39a2d229 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -562,7 +562,7 @@ Inset * readInset(Lexer & lex, Buffer * buf) inset.reset(new InsetNewpage); } else if (tmptok == "Newline") { inset.reset(new InsetNewline); - } else if (tmptok == "OptArg") { + } else if (tmptok == "Argument") { inset.reset(new InsetArgument(buf)); } else if (tmptok == "Float") { inset.reset(new InsetFloat(buf, string())); diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 67e48b126f..55a97f3e5f 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -28,7 +28,7 @@ InsetArgument::InsetArgument(Buffer * buf) void InsetArgument::write(ostream & os) const { - os << "OptArg" << "\n"; + os << "Argument" << "\n"; InsetCollapsable::write(os); } diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h index 46157bd745..43000f9bc4 100644 --- a/src/insets/InsetArgument.h +++ b/src/insets/InsetArgument.h @@ -39,7 +39,7 @@ private: /// code of the inset InsetCode lyxCode() const { return ARG_CODE; } /// - docstring name() const { return from_ascii("OptArg"); } + docstring name() const { return from_ascii("Argument"); } /// Standard LaTeX output -- short-circuited int latex(odocstream &, OutputParams const &) const; /// Standard plain text output -- short-circuited