]> git.lyx.org Git - features.git/commitdiff
Add a layout tag ForceOwnlines that assures an inset is started and terminated by...
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 1 Dec 2014 13:56:47 +0000 (14:56 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 1 Dec 2014 13:56:47 +0000 (14:56 +0100)
Fixes: #8875.
lib/doc/Customization.lyx
lib/layouts/litinsets.inc
lib/scripts/layout2layout.py
src/TextClass.cpp
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h
src/insets/InsetText.cpp

index 14199577f8474a2a82b23776ad3cdc9d5ca1f160..96f47300de8f2684ce3cf3881a45003711cc71cd 100644 (file)
@@ -1,5 +1,5 @@
-#LyX 2.1 created this file. For more info see http://www.lyx.org/
-\lyxformat 476
+#LyX 2.2 created this file. For more info see http://www.lyx.org/
+\lyxformat 479
 \begin_document
 \begin_header
 \textclass scrbook
 
 in TeX code or URL.
  A kludge.
+\change_inserted -712698321 1417441977
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -712698321 1417442090
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1417441983
+ForceOwnlines
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1417441978
+
+\emph on
+0
+\end_layout
+
+\end_inset
+
+,
+\begin_inset space \thinspace{}
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1417441978
+1
+\end_layout
+
+\end_inset
+
+] Force a a line break in the LaTeX output before the inset starts and after
+ the inset ends.
+ This assures the inset itself is output on its own lines, for parsing purposes.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Description
@@ -23533,7 +23586,7 @@ name "chap:List-of-functions"
 \align center
 \begin_inset Tabular
 <lyxtabular version="3" rows="11" columns="8">
-<features rotate="0" tabularvalignment="middle">
+<features tabularvalignment="middle">
 <column alignment="left" valignment="top">
 <column alignment="left" valignment="top">
 <column alignment="left" valignment="top">
index 05440cbfe2818710a58a72407f5de8f92f599be4..c83b6a3085c6e164dd53d8839552d6f1d4981ea3 100644 (file)
@@ -6,7 +6,7 @@
 # Note that this file is included in sweave.module,
 # knitr.module and noweb.module.
 
-Format 49
+Format 52
 
 Counter chunk
     PrettyFormat "Chunk ##"
@@ -23,15 +23,15 @@ InsetLayout "Flex:Chunk"
       Color              latex
       Family             typewriter
     EndFont
-    #LabelFont
-      #Color              latex
-      #Size               Small
-    #EndFont
-      MultiPar            true
+#   LabelFont
+#      Color              latex
+#      Size               Small
+#   EndFont
+    MultiPar              true
     CustomPars            false
     ForcePlain            true
-      PassThru            1
-      ParbreakIsNewline   1
+    PassThru              1
+    ParbreakIsNewline     1
     KeepEmpty             true
     Spellcheck            0
     FreeSpacing           true
@@ -43,5 +43,6 @@ InsetLayout "Flex:Chunk"
             LeftDelim     <<
             RightDelim    >>=<br/>
     EndArgument
-    ResetsFont false
+    ResetsFont            false
+    ForceOwnlines         true
 End
index d269d585d79c6a0441264ac2cbe9f64965da7b68..10811e73b4c00b71e60eeb858dc14a9532f0b1a0 100644 (file)
@@ -171,6 +171,9 @@ import os, re, string, sys
 # Incremented to format 51, 29 May 2014 by spitz
 # New Style tag "ToggleIndent"
 
+# Incremented to format 52, 1 December 2014 by spitz
+# New InsetLayout tag "ForceOwnlines"
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -178,7 +181,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.py script to update all
 # layout files to the new format.
 
-currentFormat = 51
+currentFormat = 52
 
 
 def usage(prog_name):
@@ -402,7 +405,7 @@ def convert(lines):
                 i += 1
             continue
 
-        if format == 50:
+        if format == 50 or format == 51:
             # nothing to do.
             i += 1
             continue
index e0e302a9acf0dfd0d1d287a0371e5467091ba6a3..113cddb7fd94e2c763379b90b85e7f60061e347f 100644 (file)
@@ -61,7 +61,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 51; //spitz: add ToggleIndent tag
+int const LAYOUT_FORMAT = 52; //spitz: add ForceOwnlines tag
 
 namespace {
 
index d579132a2129d5f2d3839461b830eff23f8414f9..4a6d0a822564b339f09882ed7905dccc5021190a 100644 (file)
@@ -89,6 +89,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                IL_FONT,
                IL_FORCE_LOCAL_FONT_SWITCH,
                IL_FORCELTR,
+               IL_FORCEOWNLINES,
                IL_FORCEPLAIN,
                IL_FREESPACING,
                IL_HTMLTAG,
@@ -139,6 +140,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                { "font", IL_FONT },
                { "forcelocalfontswitch", IL_FORCE_LOCAL_FONT_SWITCH },
                { "forceltr", IL_FORCELTR },
+               { "forceownlines", IL_FORCEOWNLINES },
                { "forceplain", IL_FORCEPLAIN },
                { "freespacing", IL_FREESPACING },
                { "htmlattr", IL_HTMLATTR },
@@ -256,6 +258,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                case IL_FORCELTR:
                        lex >> forceltr_;
                        break;
+               case IL_FORCEOWNLINES:
+                       lex >> forceownlines_;
+                       break;
                case IL_INTOC:
                        lex >> intoc_;
                        break;
index 9398e915822fc35b09f98dfb766e9a58cb228e7a..2ef6be4fdfb30f4a47dde10ebdcb9c7d6dbdf227 100644 (file)
@@ -164,6 +164,8 @@ public:
        ///
        bool forceLTR() const { return forceltr_; }
        ///
+       bool forceOwnlines() const { return forceownlines_; }
+       ///
        bool isInToc() const { return intoc_; }
        ///
        bool spellcheck() const { return spellcheck_; }
@@ -262,6 +264,8 @@ private:
        ///
        bool forceltr_;
        ///
+       bool forceownlines_;
+       ///
        bool needprotect_;
        /// should the contents be written to TOC strings?
        bool intoc_;
index de251e770b0a397e9916c909444b7189668392d9..e0cd894a4ae95ebe1ccf9cdedbe513e2caeac698 100644 (file)
@@ -433,6 +433,8 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
        // environment. Standard collapsable insets should not
        // redefine this, non-standard ones may call this.
        InsetLayout const & il = getLayout();
+       if (il.forceOwnlines())
+               os << breakln;
        if (!il.latexname().empty()) {
                if (il.latextype() == InsetLayout::COMMAND) {
                        // FIXME UNICODE
@@ -495,11 +497,13 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
                                os << breakln;
                        else
                                os << safebreakln;
-                       os << "\\end{" << from_utf8(il.latexname()) << "}\n";
+                       os << "\\end{" << from_utf8(il.latexname()) << "}" << breakln;
                        if (!il.isDisplay())
                                os.protectSpace(true);
                }
        }
+       if (il.forceOwnlines())
+               os << breakln;
 }