Add LeftDelim and RightDelim to the Style and InsetLayout repertoire

This commit is contained in:
Juergen Spitzmueller 2012-11-25 19:10:16 +01:00
parent b1ce750589
commit 6f086763ae
7 changed files with 192 additions and 1 deletions

View File

@ -12442,6 +12442,35 @@ depending upon the LaTeX type.
\end_layout
\end_deeper
\begin_layout Description
\change_inserted -712698321 1353866861
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866852
LeftDelim
\end_layout
\end_inset
[
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866852
string
\end_layout
\end_inset
] A string that is put at the beginning of the style content.
\end_layout
\begin_layout Description
\begin_inset Flex Code
status collapsed
@ -13442,6 +13471,35 @@ CopyStyle
\end_layout
\begin_layout Description
\change_inserted -712698321 1353866881
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866876
RightDelim
\end_layout
\end_inset
[
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866873
string
\end_layout
\end_inset
] A string that is put at the end of the layout content.
\end_layout
\begin_layout Description
\begin_inset Flex Code
status collapsed
@ -15178,7 +15236,15 @@ Note:Greyedout
status collapsed
\begin_layout Plain Layout
OptArg
\change_deleted -712698321 1353866704
Opt
\change_unchanged
Arg
\change_inserted -712698321 1353866707
ument
\change_unchanged
\end_layout
\end_inset
@ -16421,6 +16487,39 @@ depending upon the LaTeX type.
\end_layout
\end_deeper
\begin_layout Description
\change_inserted -712698321 1353866797
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866742
LeftDelim
\change_unchanged
\end_layout
\end_inset
[
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866752
string
\end_layout
\end_inset
] A string that is put at the beginning of the layout content.
\change_unchanged
\end_layout
\begin_layout Description
\begin_inset Flex Code
status collapsed
@ -16884,6 +16983,39 @@ status collapsed
] Whether this inset should use the font of its surrounding environment
or uses its own.
Default is true: uses its own.
\change_inserted -712698321 1353866806
\end_layout
\begin_layout Description
\change_inserted -712698321 1353866814
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866810
RightDelim
\end_layout
\end_inset
[
\begin_inset Flex Code
status collapsed
\begin_layout Plain Layout
\change_inserted -712698321 1353866806
string
\end_layout
\end_inset
] A string that is put at the end of the layout content.
\change_unchanged
\end_layout
\begin_layout Description

View File

@ -69,6 +69,7 @@ enum LayoutTags {
LT_LATEXNAME,
LT_LATEXPARAM,
LT_LATEXTYPE,
LT_LEFTDELIM,
LT_LEFTMARGIN,
LT_NEED_PROTECT,
LT_NEWLINE,
@ -102,6 +103,7 @@ enum LayoutTags {
LT_SPELLCHECK,
LT_REFPREFIX,
LT_RESETARGS,
LT_RIGHTDELIM,
LT_INTITLE // keep this last!
};
@ -194,6 +196,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
{ "latexname", LT_LATEXNAME },
{ "latexparam", LT_LATEXPARAM },
{ "latextype", LT_LATEXTYPE },
{ "leftdelim", LT_LEFTDELIM },
{ "leftmargin", LT_LEFTMARGIN },
{ "margin", LT_MARGIN },
{ "needprotect", LT_NEED_PROTECT },
@ -209,6 +212,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
{ "refprefix", LT_REFPREFIX },
{ "requires", LT_REQUIRES },
{ "resetargs", LT_RESETARGS },
{ "rightdelim", LT_RIGHTDELIM },
{ "rightmargin", LT_RIGHTMARGIN },
{ "spacing", LT_SPACING },
{ "spellcheck", LT_SPELLCHECK },
@ -364,6 +368,14 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
latexparam_ = subst(latexparam_, """, "\"");
break;
case LT_LEFTDELIM:
lex >> leftdelim_;
break;
case LT_RIGHTDELIM:
lex >> rightdelim_;
break;
case LT_INNERTAG:
lex >> innertag_;
break;

View File

@ -124,6 +124,10 @@ public:
///
std::string const & latexparam() const { return latexparam_; }
///
docstring leftdelim() const { return leftdelim_; }
///
docstring rightdelim() const { return rightdelim_; }
///
std::string const & innertag() const { return innertag_; }
///
std::string const & labeltag() const { return labeltag_; }
@ -314,6 +318,10 @@ private:
docstring labelstring_appendix_;
/// LaTeX parameter for environment
std::string latexparam_;
/// Left delimiter of the content
docstring leftdelim_;
/// Right delimiter of the content
docstring rightdelim_;
/// Internal tag to use (e.g., <title></title> for sect header)
std::string innertag_;
/// Internal tag to use (e.g. to surround varentrylist label)

View File

@ -2428,6 +2428,10 @@ void Paragraph::latex(BufferParams const & bparams,
os << '{';
++column;
}
if (!style.leftdelim().empty()) {
os << style.leftdelim();
column += style.leftdelim().size();
}
if (allowcust)
column += d->startTeXParParams(bparams, os, runparams);
}
@ -2458,6 +2462,11 @@ void Paragraph::latex(BufferParams const & bparams,
++column;
}
if (!style.leftdelim().empty()) {
os << style.leftdelim();
column += style.leftdelim().size();
}
if (allowcust)
column += d->startTeXParParams(bparams, os,
runparams);
@ -2648,6 +2657,11 @@ void Paragraph::latex(BufferParams const & bparams,
os << "}]~";
}
if (!style.rightdelim().empty()) {
os << style.rightdelim();
column += style.rightdelim().size();
}
if (allowcust && d->endTeXParParams(bparams, os, runparams)
&& runparams.encoding != prev_encoding) {
runparams.encoding = prev_encoding;

View File

@ -106,6 +106,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
IL_LATEXNAME,
IL_LATEXPARAM,
IL_LATEXTYPE,
IL_LEFTDELIM,
IL_LYXTYPE,
IL_KEEPEMPTY,
IL_MULTIPAR,
@ -114,6 +115,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
IL_PARBREAKISNEWLINE,
IL_PREAMBLE,
IL_REQUIRES,
IL_RIGHTDELIM,
IL_SPELLCHECK,
IL_REFPREFIX,
IL_RESETSFONT,
@ -153,6 +155,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
{ "latexname", IL_LATEXNAME },
{ "latexparam", IL_LATEXPARAM },
{ "latextype", IL_LATEXTYPE },
{ "leftdelim", IL_LEFTDELIM },
{ "lyxtype", IL_LYXTYPE },
{ "multipar", IL_MULTIPAR },
{ "needprotect", IL_NEEDPROTECT },
@ -162,6 +165,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
{ "refprefix", IL_REFPREFIX },
{ "requires", IL_REQUIRES },
{ "resetsfont", IL_RESETSFONT },
{ "rightdelim", IL_RIGHTDELIM },
{ "spellcheck", IL_SPELLCHECK }
};
@ -229,6 +233,12 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
lex >> tmp;
latexparam_ = support::subst(tmp, "&quot;", "\"");
break;
case IL_LEFTDELIM:
lex >> leftdelim_;
break;
case IL_RIGHTDELIM:
lex >> rightdelim_;
break;
case IL_LABELFONT:
labelfont_ = lyxRead(lex, inherit_font);
break;

View File

@ -76,6 +76,10 @@ public:
///
std::string latexparam() const { return latexparam_; }
///
docstring leftdelim() const { return leftdelim_; }
///
docstring rightdelim() const { return rightdelim_; }
///
FontInfo font() const { return font_; }
///
FontInfo labelfont() const { return labelfont_; }
@ -188,6 +192,10 @@ private:
///
std::string latexparam_;
///
docstring leftdelim_;
///
docstring rightdelim_;
///
FontInfo font_;
///
FontInfo labelfont_;

View File

@ -459,6 +459,10 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
if (!il.latexparam().empty())
os << from_utf8(il.latexparam());
}
if (!il.leftdelim().empty())
os << il.leftdelim();
OutputParams rp = runparams;
if (il.isPassThru())
rp.pass_thru = true;
@ -471,6 +475,9 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
latexParagraphs(buffer(), text_, os, rp);
runparams.encoding = rp.encoding;
if (!il.rightdelim().empty())
os << il.rightdelim();
if (!il.latexname().empty()) {
if (il.latextype() == InsetLayout::COMMAND) {
os << "}";