Implement PassThruChars to Argument

Closes: #9535.
This commit is contained in:
Juergen Spitzmueller 2015-05-08 09:32:31 +02:00
parent 16bfcc0e91
commit 5b03ae11a0
5 changed files with 13 additions and 1 deletions

View File

@ -994,6 +994,9 @@ void Layout::readArgument(Lexer & lex)
arg.font = lyxRead(lex, arg.font); arg.font = lyxRead(lex, arg.font);
} else if (tok == "labelfont") { } else if (tok == "labelfont") {
arg.labelfont = lyxRead(lex, arg.labelfont); arg.labelfont = lyxRead(lex, arg.labelfont);
} else if (tok == "passthruchars") {
lex.next();
arg.pass_thru_chars = lex.getDocString();
} else { } else {
lex.printError("Unknown tag"); lex.printError("Unknown tag");
error = true; error = true;

View File

@ -104,6 +104,7 @@ public:
FontInfo font; FontInfo font;
FontInfo labelfont; FontInfo labelfont;
bool autoinsert; bool autoinsert;
docstring pass_thru_chars;
}; };
/// ///
typedef std::map<std::string, latexarg> LaTeXArgMap; typedef std::map<std::string, latexarg> LaTeXArgMap;

View File

@ -39,7 +39,7 @@ namespace lyx {
InsetArgument::InsetArgument(Buffer * buf, string const & name) InsetArgument::InsetArgument(Buffer * buf, string const & name)
: InsetCollapsable(buf), name_(name), labelstring_(docstring()), : InsetCollapsable(buf), name_(name), labelstring_(docstring()),
font_(inherit_font), labelfont_(inherit_font), decoration_(string()), font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
pass_thru_(false) pass_thru_(false), pass_thru_chars_(docstring())
{} {}
@ -112,6 +112,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
font_ = (*lait).second.font; font_ = (*lait).second.font;
labelfont_ = (*lait).second.labelfont; labelfont_ = (*lait).second.labelfont;
decoration_ = (*lait).second.decoration; decoration_ = (*lait).second.decoration;
pass_thru_chars_ = (*lait).second.pass_thru_chars;
} else { } else {
labelstring_ = _("Unknown Argument"); labelstring_ = _("Unknown Argument");
tooltip_ = _("Argument not known in this Layout. Will be supressed in the output."); tooltip_ = _("Argument not known in this Layout. Will be supressed in the output.");
@ -268,6 +269,8 @@ void InsetArgument::latexArgument(otexstream & os,
odocstringstream ss; odocstringstream ss;
otexstream ots(ss, texrow); otexstream ots(ss, texrow);
OutputParams runparams = runparams_in; OutputParams runparams = runparams_in;
if (!pass_thru_chars_.empty())
runparams.pass_thru_chars += pass_thru_chars_;
InsetText::latex(ots, runparams); InsetText::latex(ots, runparams);
docstring str = ss.str(); docstring str = ss.str();
docstring const sep = str.empty() ? docstring() : from_ascii(", "); docstring const sep = str.empty() ? docstring() : from_ascii(", ");

View File

@ -97,6 +97,8 @@ private:
std::string decoration_; std::string decoration_;
/// ///
bool pass_thru_; bool pass_thru_;
///
docstring pass_thru_chars_;
protected: protected:
/// \name Protected functions inherited from Inset class /// \name Protected functions inherited from Inset class

View File

@ -620,6 +620,9 @@ void InsetLayout::readArgument(Lexer & lex)
arg.font = lyxRead(lex, arg.font); arg.font = lyxRead(lex, arg.font);
} else if (tok == "labelfont") { } else if (tok == "labelfont") {
arg.labelfont = lyxRead(lex, arg.labelfont); arg.labelfont = lyxRead(lex, arg.labelfont);
} else if (tok == "passthruchars") {
lex.next();
arg.pass_thru_chars = lex.getDocString();
} else { } else {
lex.printError("Unknown tag"); lex.printError("Unknown tag");
error = true; error = true;