\html_math_output 0
\html_css_as_file 0
\html_be_strict true
+\author -712698321 "Jürgen Spitzmüller"
\author 2089657418 "Usti"
\end_header
, this argument will be inserted with a copy of the co-text (either selected
text or the whole paragraph) as content.
+\change_inserted -712698321 1477038290
+
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted -712698321 1477038425
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1477038295
+PassThru
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1477038311
+
+\emph on
+inherited
+\emph default
+, true, false
+\end_layout
+
+\end_inset
+
+] Whether the contents of this argument should be output in raw form, meaning
+ without special translations that \SpecialChar LaTeX
+ would require.
+ By default, the
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1477038356
+PassThru
+\end_layout
+
+\end_inset
+
+ status is inherited by the inset or paragraph layout the argument belongs
+ to, true and false change the status for the given argument only.
+\change_unchanged
+
\end_layout
\begin_layout Itemize
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 61
+currentFormat = 62
# Incremented to format 4, 6 April 2007, lasgouttes
# Incremented to format 61, 14 October 2016 by spitz
# New Layout tags "ResumeCounter", "StepMasterCounter"
+# Incremented to format 62, 21 October 2016 by spitz
+# New Layout argument tag "PassThru"
+
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
i += 1
continue
- if format == 60:
+ if format >= 60 and format <= 61:
# nothing to do.
i += 1
continue
arg.font = inherit_font;
arg.labelfont = inherit_font;
arg.is_toc_caption = false;
+ arg.passthru = PT_INHERITED;
string id;
lex >> id;
bool const itemarg = prefixIs(id, "item:");
} else if (tok == "passthruchars") {
lex.next();
arg.pass_thru_chars = lex.getDocString();
+ } else if (tok == "passthru") {
+ lex.next();
+ docstring value = lex.getDocString();
+ if (value == "true" || value == "1")
+ arg.passthru = PT_TRUE;
+ else if (value == "false" || value == "0")
+ arg.passthru = PT_FALSE;
+ else
+ arg.passthru = PT_INHERITED;
} else if (tok == "istoccaption") {
lex.next();
arg.is_toc_caption = lex.getBool();
lyxWrite(os, arg.font, "Font", 2);
if (arg.labelfont != inherit_font)
lyxWrite(os, arg.labelfont, "LabelFont", 2);
+ switch (arg.passthru) {
+ case PT_TRUE:
+ os << "\t\tPassThru true\n";
+ break;
+ case PT_FALSE:
+ os << "\t\tPassThru false\n";
+ break;
+ case PT_INHERITED:
+ os << "\t\tPassThru inherited\n";
+ break;
+ }
if (!arg.pass_thru_chars.empty())
os << "\t\tPassThruChars \"" << to_utf8(arg.pass_thru_chars) << "\"\n";
os << "\tEndArgument\n";
FontInfo labelfont;
bool autoinsert;
bool insertcotext;
+ ArgPassThru passthru;
docstring pass_thru_chars;
bool is_toc_caption;
};
END_LABEL_STATIC
};
+///
+enum ArgPassThru {
+ ///
+ PT_INHERITED,
+ ///
+ PT_FALSE,
+ ///
+ PT_TRUE
+};
+
} // namespace lyx
#endif
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
-int const LAYOUT_FORMAT = 61; //spitz ResumeCounter, StepMasterCounter
+int const LAYOUT_FORMAT = 62; //spitz PassThru for arguments.
// Layout format for the current lyx file format. Controls which format is
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_chars_(docstring())
+ pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false),
+ pass_thru_chars_(docstring())
{}
void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
{
Layout::LaTeXArgMap args = it.paragraph().layout().args();
- pass_thru_ = it.paragraph().layout().pass_thru;
+ pass_thru_context_ = it.paragraph().layout().pass_thru;
bool const insetlayout = args.empty();
if (insetlayout) {
args = it.inset().getLayout().args();
- pass_thru_ = it.inset().getLayout().isPassThru();
+ pass_thru_context_ = it.inset().getLayout().isPassThru();
}
// Handle pre 2.1 ArgInsets (lyx2lyx cannot classify them)
labelfont_ = (*lait).second.labelfont;
decoration_ = (*lait).second.decoration;
pass_thru_chars_ = (*lait).second.pass_thru_chars;
+ pass_thru_local_ = false;
+ switch ((*lait).second.passthru) {
+ case PT_INHERITED:
+ pass_thru_ = pass_thru_context_;
+ break;
+ case PT_TRUE:
+ pass_thru_ = true;
+ pass_thru_local_ = true;
+ break;
+ case PT_FALSE:
+ pass_thru_ = false;
+ break;
+ }
} else {
labelstring_ = _("Unknown Argument");
tooltip_ = _("Argument not known in this Layout. Will be supressed in the output.");
// with (inherited) pass_thru to avoid call for
// fixParagraphsFont(), which does not play nicely with
// inherited pass_thru (see #8471).
- // FIXME: Once we have implemented genuine pass_thru
- // option for InsetArgument (not inherited pass_thru),
- // we should probably directly call
- // InsetCollapsable::doDispatch(cur, cmd) for that
- // case as well
- if (pass_thru_)
+ if (pass_thru_ && !pass_thru_local_)
text().dispatch(cur, cmd);
else
InsetCollapsable::doDispatch(cur, cmd);
OutputParams runparams = runparams_in;
if (!pass_thru_chars_.empty())
runparams.pass_thru_chars += pass_thru_chars_;
+ runparams.pass_thru = isPassThru();
InsetText::latex(ots, runparams);
TexString ts = ots.release();
bool const add_braces = ldelim != "{" && support::contains(ts.str, rdelim);
FontInfo labelfont_;
///
std::string decoration_;
- ///
+ /// Are we in a pass-thru context?
+ bool pass_thru_context_;
+ /// Is the argument itself have an explicitly pass-thru?
+ bool pass_thru_local_;
+ /// Effective pass-thru setting (inherited or local)
bool pass_thru_;
///
docstring pass_thru_chars_;
arg.font = inherit_font;
arg.labelfont = inherit_font;
arg.is_toc_caption = false;
+ arg.passthru = PT_INHERITED;
string nr;
lex >> nr;
bool const postcmd = prefixIs(nr, "post:");
} else if (tok == "passthruchars") {
lex.next();
arg.pass_thru_chars = lex.getDocString();
+ } else if (tok == "passthru") {
+ lex.next();
+ docstring value = lex.getDocString();
+ if (value == "true" || value == "1")
+ arg.passthru = PT_TRUE;
+ else if (value == "false" || value == "0")
+ arg.passthru = PT_FALSE;
+ else
+ arg.passthru = PT_INHERITED;
} else if (tok == "istoccaption") {
lex.next();
arg.is_toc_caption = lex.getBool();
LYXERR(Debug::ACTION, "InsetText::doDispatch(): cmd: " << cmd);
// See bug #9042, for instance.
- if (isPassThru() && lyxCode() != ARG_CODE) {
+ if (isPassThru()) {
// Force any new text to latex_language FIXME: This
// should only be necessary in constructor, but new
// paragraphs that are created by pressing enter at