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
This commit is contained in:
Jean-Marc Lasgouttes 2010-08-09 21:20:29 +00:00
parent 920798c4d6
commit 6aa26820fd
11 changed files with 131 additions and 9 deletions

View File

@ -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

View File

@ -23,6 +23,7 @@ Style Scrap
AlignPossible Block,Left
FreeSpacing 1
PassThru 1
ParbreakIsNewline 1
LabelType Static
LabelFont
Color magenta

View File

@ -30,6 +30,7 @@ Style Scrap
AlignPossible Block,Left
FreeSpacing 1
PassThru 1
ParbreakIsNewline 1
LabelType Static
LabelFont
Color magenta

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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 {

View File

@ -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;

View File

@ -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?