From 6aa26820fd2fc809c2928f7d1f52d9ee3ef9fb18 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 9 Aug 2010 21:20:29 +0000 Subject: [PATCH] Introduce new tag ParbreakIsNewline in Layout and InsetLayout (not yet used) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35110 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/doc/Customization.lyx | 100 ++++++++++++++++++++++++++++++++- lib/layouts/literate-scrap.inc | 1 + lib/layouts/noweb.module | 1 + lib/layouts/stdinsets.inc | 2 + lib/layouts/sweave.module | 2 +- lib/scripts/layout2layout.py | 7 ++- src/Layout.cpp | 7 +++ src/Layout.h | 2 + src/TextClass.cpp | 2 +- src/insets/InsetLayout.cpp | 10 +++- src/insets/InsetLayout.h | 6 +- 11 files changed, 131 insertions(+), 9 deletions(-) diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index 01a0673280..114587c7ca 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -11761,6 +11761,59 @@ at least, not without ERT (with which you can have anything). \begin_inset Flex CharStyle:Code status collapsed +\begin_layout Plain Layout +ParbreakIsNewline +\end_layout + +\end_inset + + +\begin_inset CommandInset label +LatexCommand label +name "des:ParbreakIsNewline" + +\end_inset + + [ +\begin_inset Flex CharStyle:Code +status collapsed + +\begin_layout Plain Layout + +\emph on +0 +\end_layout + +\end_inset + +, +\begin_inset Flex CharStyle:Code +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +] Indicates that paragraphs will not be separated by an empty line in LaTeX + output, but only by a line break; together with +\begin_inset Flex CharStyle:Code +status collapsed + +\begin_layout Plain Layout +PassThru 1 +\end_layout + +\end_inset + +, this allows to emulate a plain text editor (like the ERT inset). +\end_layout + +\begin_layout Description +\begin_inset Flex CharStyle:Code +status collapsed + \begin_layout Plain Layout ParIndent \end_layout @@ -11942,7 +11995,7 @@ PassThru \begin_inset CommandInset label LatexCommand label -name "des:PathThru" +name "des:PassThru" \end_inset @@ -14627,6 +14680,49 @@ not \begin_inset Flex CharStyle:Code status collapsed +\begin_layout Plain Layout +ParbreakIsNewline +\end_layout + +\end_inset + + [ +\begin_inset Flex CharStyle:Code +status collapsed + +\begin_layout Plain Layout + +\emph on +0 +\end_layout + +\end_inset + +, +\begin_inset Flex CharStyle:Code +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + +] As with paragraph styles (see page +\begin_inset CommandInset ref +LatexCommand pageref +reference "des:ParbreakIsNewline" + +\end_inset + +). + Default is false. +\end_layout + +\begin_layout Description +\begin_inset Flex CharStyle:Code +status collapsed + \begin_layout Plain Layout PassThru \end_layout @@ -14658,7 +14754,7 @@ status collapsed ] As with paragraph styles (see page \begin_inset CommandInset ref LatexCommand pageref -reference "des:PathThru" +reference "des:PassThru" \end_inset diff --git a/lib/layouts/literate-scrap.inc b/lib/layouts/literate-scrap.inc index 1c3086cac9..7db784c306 100644 --- a/lib/layouts/literate-scrap.inc +++ b/lib/layouts/literate-scrap.inc @@ -23,6 +23,7 @@ Style Scrap AlignPossible Block,Left FreeSpacing 1 PassThru 1 + ParbreakIsNewline 1 LabelType Static LabelFont Color magenta diff --git a/lib/layouts/noweb.module b/lib/layouts/noweb.module index d26b6ae74a..ca657b17db 100644 --- a/lib/layouts/noweb.module +++ b/lib/layouts/noweb.module @@ -30,6 +30,7 @@ Style Scrap AlignPossible Block,Left FreeSpacing 1 PassThru 1 + ParbreakIsNewline 1 LabelType Static LabelFont Color magenta diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index cfb0804f9d..f275b371e7 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -146,6 +146,7 @@ InsetLayout ERT CustomPars false ForcePlain true PassThru true + ParbreakIsNewline true KeepEmpty true FreeSpacing true ForceLTR true @@ -175,6 +176,7 @@ InsetLayout Listings BgColor listingsbg MultiPar true PassThru true + ParbreakIsNewline true KeepEmpty true FreeSpacing true ForceLTR true diff --git a/lib/layouts/sweave.module b/lib/layouts/sweave.module index cc3f2990b6..08b3067d82 100644 --- a/lib/layouts/sweave.module +++ b/lib/layouts/sweave.module @@ -4,7 +4,6 @@ #DescriptionEnd #Category: literate -# Within the chunk, lines are separated by newlines (Ctrl-Return)! # To add : # - \setkeys{Gin}{width=0.8\textwidth} How to add such a "beast"? This is used to define @@ -32,6 +31,7 @@ Style Chunk NewLine 0 FreeSpacing 1 PassThru 1 + ParbreakIsNewline 1 ## What is LabelType used for? LabelType Static TextFont diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index 0c85e57ad7..9c7129d7ca 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -97,6 +97,9 @@ import os, re, string, sys # Incremented to format 27, 4 June 2010 by rgh # Added RequiredArgs tag. +# Incremented to format 28, 6 August 2010 by lasgouttes +# Added ParbreakIsNewline tag for Layout and InsetLayout. + # Do not forget to document format change in Customization # Manual (section "Declaring a new text class"). @@ -104,7 +107,7 @@ import os, re, string, sys # development/tools/updatelayouts.sh script to update all # layout files to the new format. -currentFormat = 27 +currentFormat = 28 def usage(prog_name): @@ -277,7 +280,7 @@ def convert(lines): continue # Only new features - if format >= 24 and format <= 26: + if format >= 24 and format <= 27: i += 1 continue diff --git a/src/Layout.cpp b/src/Layout.cpp index 1f68979dd4..86755e7099 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -55,6 +55,7 @@ enum LayoutTags { LT_FONT, LT_FREE_SPACING, LT_PASS_THRU, + LT_PARBREAK_IS_NEWLINE, //LT_HEADINGS, LT_ITEMSEP, LT_KEEPEMPTY, @@ -143,6 +144,7 @@ Layout::Layout() newline_allowed = true; free_spacing = false; pass_thru = false; + parbreak_is_newline = false; toclevel = NOT_IN_TOC; commanddepth = 0; htmllabelfirst_ = false; @@ -210,6 +212,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass) { "nextnoindent", LT_NEXTNOINDENT }, { "obsoletedby", LT_OBSOLETEDBY }, { "optionalargs", LT_OPTARGS }, + { "parbreakisnewline", LT_PARBREAK_IS_NEWLINE }, { "parindent", LT_PARINDENT }, { "parsep", LT_PARSEP }, { "parskip", LT_PARSKIP }, @@ -495,6 +498,10 @@ bool Layout::read(Lexer & lex, TextClass const & tclass) lex >> pass_thru; break; + case LT_PARBREAK_IS_NEWLINE: + lex >> parbreak_is_newline; + break; + case LT_SPACING: // setspace.sty readSpacing(lex); break; diff --git a/src/Layout.h b/src/Layout.h index 0a398d31c2..a809997018 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -225,6 +225,8 @@ public: bool free_spacing; /// bool pass_thru; + /// + bool parbreak_is_newline; /// show this in toc int toclevel; /// special value of toclevel for non-section layouts diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 73ad37c409..fad437724e 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -60,7 +60,7 @@ namespace lyx { // development/updatelayouts.sh script, to update the format of // all of our layout files. // -int const LAYOUT_FORMAT = 27; +int const LAYOUT_FORMAT = 28; namespace { diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index 0a02c739c4..5433db83d9 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -36,8 +36,9 @@ InsetLayout::InsetLayout() : labelfont_(sane_font), bgcolor_(Color_error), htmlforcecss_ (false), htmlisblock_(true), multipar_(true), custompars_(true), forceplain_(false), - passthru_(false), needprotect_(false), freespacing_(false), - keepempty_(false), forceltr_(false), intoc_(false), spellcheck_(true) + passthru_(false), parbreakisnewline_(false), freespacing_(false), + keepempty_(false), forceltr_(false), + needprotect_(false), intoc_(false), spellcheck_(true) { labelfont_.setColor(Color_error); } @@ -103,6 +104,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass) IL_MULTIPAR, IL_NEEDPROTECT, IL_PASSTHRU, + IL_PARBREAKISNEWLINE, IL_PREAMBLE, IL_REQUIRES, IL_SPELLCHECK, @@ -142,6 +144,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass) { "lyxtype", IL_LYXTYPE }, { "multipar", IL_MULTIPAR }, { "needprotect", IL_NEEDPROTECT }, + { "parbreakisnewline", IL_PARBREAKISNEWLINE }, { "passthru", IL_PASSTHRU }, { "preamble", IL_PREAMBLE }, { "refprefix", IL_REFPREFIX }, @@ -239,6 +242,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass) case IL_PASSTHRU: lex >> passthru_; break; + case IL_PARBREAKISNEWLINE: + lex >> parbreakisnewline_; + break; case IL_KEEPEMPTY: lex >> keepempty_; break; diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 3fdc17f8ce..82fbe75edc 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -129,6 +129,8 @@ public: /// bool isPassThru() const { return passthru_; } /// + bool parbreakIsNewline() const { return parbreakisnewline_; } + /// bool isNeedProtect() const { return needprotect_; } /// bool isFreeSpacing() const { return freespacing_; } @@ -213,13 +215,15 @@ private: /// bool passthru_; /// - bool needprotect_; + bool parbreakisnewline_; /// bool freespacing_; /// bool keepempty_; /// bool forceltr_; + /// + bool needprotect_; /// should the contents be written to TOC strings? bool intoc_; /// check spelling of this inset? -- 2.39.2