]> git.lyx.org Git - features.git/commitdiff
When we use InPremable styles, we want to write as many versions
authorRichard Heck <rgheck@lyx.org>
Sun, 12 Jun 2016 04:58:33 +0000 (00:58 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 12 Jun 2016 05:00:01 +0000 (01:00 -0400)
to the premable as the user enters.

(cherry picked from commit fa190691a8e825d199845120ab23d2f8cde68500)

src/LaTeXFeatures.cpp
src/LaTeXFeatures.h
src/Paragraph.cpp
status.22x

index 4fa2c829412aee1bb826b189f0fa9a836d3dffe7..c66d66b3ed0143b9113de0a350e86313bd291b6a 100644 (file)
@@ -579,11 +579,12 @@ bool LaTeXFeatures::isAvailable(string const & name)
 }
 
 
-void LaTeXFeatures::addPreambleSnippet(string const & preamble)
+void LaTeXFeatures::addPreambleSnippet(string const & preamble,
+               bool allowdupes)
 {
        SnippetList::const_iterator begin = preamble_snippets_.begin();
        SnippetList::const_iterator end   = preamble_snippets_.end();
-       if (find(begin, end, preamble) == end)
+       if (allowdupes || find(begin, end, preamble) == end)
                preamble_snippets_.push_back(preamble);
 }
 
index 0d417bd9d2a02d9c233b546b25ec78f80fa2dcf9..38273e4fa2f85c42b5c57a80decb9ecac7867f3b 100644 (file)
@@ -88,7 +88,8 @@ public:
        /// Print requirements to lyxerr
        void showStruct() const;
        ///
-       void addPreambleSnippet(std::string const &);
+       void addPreambleSnippet(std::string const & snippet, 
+                               bool allowdupes = false);
        ///
        std::string getPreambleSnippets() const;
        ///
index a405b6a806d7d2fd8f49f8bbb08b339a16e2c73a..a396794ebd77c3681a0da0da858ad7be237533ca 100644 (file)
@@ -1397,7 +1397,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                                }
                        }
                        string const snippet = to_utf8(ods.str());
-                       features.addPreambleSnippet(snippet);
+                       features.addPreambleSnippet(snippet, true);
                }
        }
 
index e68ecf9aefd79258faae55838a7a7a393ada9c1d..06bda4a482d55d78910a5ba077f7e88dee9fb6c7 100644 (file)
@@ -37,6 +37,8 @@ What's new
 
 * DOCUMENT INPUT/OUTPUT
 
+- InPreamble styles should be written to the premable as many times as the
+  user requests them, even if it results in duplicate commands.
 
 
 * LYX2LYX