]> git.lyx.org Git - features.git/commitdiff
Verbatim for URL inset, \protect for special phrases (index inset)
authorMartin Vermeer <martin.vermeer@hut.fi>
Sat, 20 Oct 2007 17:05:28 +0000 (17:05 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Sat, 20 Oct 2007 17:05:28 +0000 (17:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21083 a592a061-630c-0410-9148-cb99ea01b6c8

lib/layouts/url.module
src/OutputParams.cpp
src/OutputParams.h
src/Paragraph.cpp
src/insets/InsetCollapsable.cpp

index 09eba0f5a73678a86f19fb951208d77c61e85e8c..c8d9576e91fce0e3dc80c748f2dc879c9b193b68 100644 (file)
@@ -8,11 +8,15 @@ InsetLayout URL
   LatexName url
   Decoration minimalistic
   LabelString URL
+  Verbatim true
   Font
     Family Typewriter
+    Color Blue
   EndFont
   LabelFont
     Family Typewriter
+    Color Blue
+    Size Small
   EndFont
   Preamble
     \usepackage{url}
index 0d4dae0e29b4d21d52c6d79b16e6560e48b2f58d..85775dc0f2c29545af0dd1eaf86df5bfc7ca9ed5 100644 (file)
@@ -25,7 +25,7 @@ OutputParams::OutputParams(Encoding const * enc)
          inComment(false),
          inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED),
          par_begin(0), par_end(0),
-         dryrun(false)
+         dryrun(false), verbatim(false)
 {}
 
 
index c45c1092299c3b605290d84f014bc57159e54680..dc2bc365f7da19987c096e76bd99132674703e2a 100644 (file)
@@ -146,6 +146,8 @@ public:
         *  This mode will be used to preview the source code
         */
        bool dryrun;
+       /// Should we output verbatim or escape LaTeX's special chars?
+       bool verbatim;
 };
 
 
index 9e8483432d0a6905924f4c62d55b1c18a23929fe..db753e91c9d1aa27078e74d4a10c50320b437ce3 100644 (file)
@@ -186,10 +186,10 @@ struct special_phrase {
 };
 
 special_phrase const special_phrases[] = {
-       { "LyX", from_ascii("\\LyX{}"), false },
-       { "TeX", from_ascii("\\TeX{}"), true },
-       { "LaTeX2e", from_ascii("\\LaTeXe{}"), true },
-       { "LaTeX", from_ascii("\\LaTeX{}"), true },
+       { "LyX", from_ascii("\\protect\\LyX{}"), false },
+       { "TeX", from_ascii("\\protect\\TeX{}"), true },
+       { "LaTeX2e", from_ascii("\\protect\\LaTeXe{}"), true },
+       { "LaTeX", from_ascii("\\protect\\LaTeX{}"), true },
 };
 
 size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase);
@@ -775,6 +775,11 @@ void Paragraph::Private::simpleTeXSpecialChar(
                                             unsigned int & column,
                                             value_type const c)
 {
+       if (runparams.verbatim) {
+               os.put(c);
+               return;
+       }
+
        switch (c) {
        case '\\':
                os << "\\textbackslash{}";
index 4159ff36a7469d65e592bd2fa58f4aff1faa49e7..d9355d870a9bddaf5ebf0b3a100359bf041b9dc9 100644 (file)
@@ -634,7 +634,10 @@ int InsetCollapsable::latex(Buffer const & buf, odocstream & os,
                                os << from_utf8(layout_.latexparam);
                }
        }
-       int i = InsetText::latex(buf, os, runparams);
+       OutputParams rp = runparams;
+       if (layout_.verbatim)
+               rp.verbatim = true;
+       int i = InsetText::latex(buf, os, rp);
        if (!layout_.latexname.empty()) {
                if (layout_.latextype == "command") {
                        os << "}";