The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 9c4929ca406091267dafa40f5e083a27db046bf6 Merge: 6f08676 89c60f3 Author: Juergen Spitzmueller <[email protected]> Date: Sun Nov 25 19:10:40 2012 +0100 Merge branch 'master' of git.lyx.org:lyx commit 6f086763ae543b7e221c17b243bb777b36829023 Author: Juergen Spitzmueller <[email protected]> Date: Sun Nov 25 19:10:16 2012 +0100 Add LeftDelim and RightDelim to the Style and InsetLayout repertoire diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index b4f0e42..e733e8f 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -12443,6 +12443,35 @@ depending upon the LaTeX type. \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 @@ -13443,6 +13472,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 @@ -16422,6 +16488,39 @@ depending upon the LaTeX type. \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 diff --git a/src/Layout.cpp b/src/Layout.cpp index a2c98ac..a5d3550 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -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; diff --git a/src/Layout.h b/src/Layout.h index 469cbf0..45bdf46 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -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) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index ee80b94..c7a39b6 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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; diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index 53f56ae..8081766 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -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, """, "\""); break; + case IL_LEFTDELIM: + lex >> leftdelim_; + break; + case IL_RIGHTDELIM: + lex >> rightdelim_; + break; case IL_LABELFONT: labelfont_ = lyxRead(lex, inherit_font); break; diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h index 3ddee16..4f5a6b8 100644 --- a/src/insets/InsetLayout.h +++ b/src/insets/InsetLayout.h @@ -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_; diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 04bee82..4760df5 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -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 << "}"; ----------------------------------------------------------------------- Summary of changes: lib/doc/Customization.lyx | 134 +++++++++++++++++++++++++++++++++++++++++++- src/Layout.cpp | 12 ++++ src/Layout.h | 8 +++ src/Paragraph.cpp | 14 +++++ src/insets/InsetLayout.cpp | 10 +++ src/insets/InsetLayout.h | 8 +++ src/insets/InsetText.cpp | 7 ++ 7 files changed, 192 insertions(+), 1 deletions(-) hooks/post-receive -- The LyX Source Repository
