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);
} else if (tok == "labelfont") {
arg.labelfont = lyxRead(lex, arg.labelfont);
} else if (tok == "passthruchars") {
lex.next();
arg.pass_thru_chars = lex.getDocString();
} else {
lex.printError("Unknown tag");
error = true;

View File

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

View File

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

View File

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

View File

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