} else if (tok == "docbooktagtype") {
lex.next();
arg.docbooktagtype = lex.getDocString();
+ } else if (tok == "docbookargumentaftermaintag") {
+ lex.next();
+ arg.docbookargumentaftermaintag = lex.getBool();
+ } else if (tok == "docbookargumentbeforemaintag") {
+ lex.next();
+ arg.docbookargumentbeforemaintag = lex.getBool();
} else {
lex.printError("Unknown tag");
error = true;
std::string const & latexname() const { return latexname_; }
///
std::string const & itemcommand() const { return itemcommand_; }
- /// The arguments of this layout
+ /// One argument of this layout
struct latexarg {
docstring labelstring;
docstring menustring;
bool is_toc_caption = false;
bool free_spacing = false;
std::string newlinecmd;
+ /// The DocBook tag corresponding to this argument.
docstring docbooktag;
docstring docbooktagtype;
docstring docbookattr;
+ /// Whether this argument should be output after the main tag (default: inside). The result if the argument
+ /// should be output both before and after the main tag is undefined.
bool docbookargumentbeforemaintag = false;
+ /// Whether this argument should be output before the main tag (default: inside). The result if the argument
+ /// should be output both before and after the main tag is undefined.
+ bool docbookargumentaftermaintag = false;
};
///
typedef std::map<std::string, latexarg> LaTeXArgMap;
/// Some parameters are output before the rest of the paragraph, they should not be generated a second time.
std::set<InsetArgument const *> docbook_prepended_arguments = {};
+ /// Some parameters are output after the rest of the paragraph, they should not be generated a second time.
+ std::set<InsetArgument const *> docbook_appended_arguments = {};
+
/// Are we generating this material for inclusion in a TOC-like entity?
bool for_toc = false;
docbooktagtype_ = (*lait).second.docbooktagtype;
docbookattr_ = (*lait).second.docbookattr;
docbookargumentbeforemaintag_ = (*lait).second.docbookargumentbeforemaintag;
+ docbookargumentaftermaintag_ = (*lait).second.docbookargumentaftermaintag;
pass_thru_local_ = false;
if (lait->second.is_toc_caption) {
is_toc_caption_ = true;
void InsetArgument::docbook(XMLStream & xs, OutputParams const & rp) const {
- // Ignore arguments that have already been output.
+ // Ignore arguments that have already been output or are planned to be output elsewhere.
if (rp.docbook_prepended_arguments.find(this) != rp.docbook_prepended_arguments.end())
return;
+ if (rp.docbook_appended_arguments.find(this) != rp.docbook_appended_arguments.end())
+ return;
if (docbooktag_ != from_ascii("NONE") && docbooktag_ != from_ascii("IGNORE")) {
// TODO: implement docbooktagtype_.
bool docbookargumentbeforemaintag() const { return docbookargumentbeforemaintag_; }
+ bool docbookargumentaftermaintag() const { return docbookargumentaftermaintag_; }
+
/// \name Public functions inherited from Inset class
//@{
///
docstring docbookattr_;
///
bool docbookargumentbeforemaintag_ = false;
+ ///
+ bool docbookargumentaftermaintag_ = false;
protected:
/// \name Protected functions inherited from Inset class
IL_DOCBOOKSECTION,
IL_DOCBOOKININFO,
IL_DOCBOOKARGUMENTBEFOREMAINTAG,
+ IL_DOCBOOKARGUMENTAFTERMAINTAG,
IL_DOCBOOKNOTINPARA,
IL_DOCBOOKWRAPPERTAG,
IL_DOCBOOKWRAPPERTAGTYPE,
{ "custompars", IL_CUSTOMPARS },
{ "decoration", IL_DECORATION },
{ "display", IL_DISPLAY },
+ { "docbookargumentaftermaintag", IL_DOCBOOKARGUMENTAFTERMAINTAG },
{ "docbookargumentbeforemaintag", IL_DOCBOOKARGUMENTBEFOREMAINTAG },
{ "docbookattr", IL_DOCBOOKATTR },
{ "docbookininfo", IL_DOCBOOKININFO },
case IL_DOCBOOKARGUMENTBEFOREMAINTAG:
lex >> docbookargumentbeforemaintag_;
break;
+ case IL_DOCBOOKARGUMENTAFTERMAINTAG:
+ lex >> docbookargumentaftermaintag_;
+ break;
case IL_DOCBOOKNOTINPARA:
lex >> docbooknotinpara_;
break;
} else if (tok == "docbookargumentbeforemaintag") {
lex.next();
arg.docbookargumentbeforemaintag = lex.getBool();
+ } else if (tok == "docbookargumentaftermaintag") {
+ lex.next();
+ arg.docbookargumentaftermaintag = lex.getBool();
} else {
lex.printError("Unknown tag");
error = true;
///
bool docbookargumentbeforemaintag() const { return docbookargumentbeforemaintag_; }
///
+ bool docbookargumentaftermaintag() const { return docbookargumentaftermaintag_; }
+ ///
std::string docbookwrappertag() const { return docbookwrappertag_; }
///
std::string docbookwrappertagtype() const;
bool docbooknotinpara_ = false;
///
bool docbookargumentbeforemaintag_ = false;
+ ///
+ bool docbookargumentaftermaintag_ = false;
///
bool docbooksection_ = false;
///
writeOuterTag = !allBibitems;
}
- // Detect arguments that should be output before the paragraph.
+ // Detect arguments that should be output before/after the paragraph.
// Don't reuse runparams.docbook_prepended_arguments, as the same object is used in InsetArgument to determine
// whether the inset should be output or not, whatever the context (i.e. position with respect to the wrapper).
std::set<InsetArgument const *> prependedArguments;
}
}
+ std::set<InsetArgument const *> appendedArguments;
+ for (auto const & par : paragraphs()) {
+ for (pos_type i = 0; i < par.size(); ++i) {
+ if (par.getInset(i) && par.getInset(i)->lyxCode() == ARG_CODE) {
+ InsetArgument const *arg = par.getInset(i)->asInsetArgument();
+ if (arg->docbookargumentaftermaintag())
+ appendedArguments.insert(par.getInset(i)->asInsetArgument());
+ }
+ }
+ }
+
// Start outputting this inset.
// - First, wrapper around the inset and its main tag.
if (writeOuterTag) {
}
}
- // - Think about the arguments.
+ // - Think about the arguments before the paragraph.
OutputParams np = runparams;
np.docbook_in_par = true;
for (auto const & arg : prependedArguments)
arg->docbook(xs, np);
- // - Mark the newly generated arguments are not-to-be-generated-again.
+ // - Mark the newly generated arguments are not-to-be-generated-again. Do the same for arguments that will follow.
runparams.docbook_prepended_arguments = std::move(prependedArguments);
+ runparams.docbook_appended_arguments = appendedArguments;
// - Deal with the first item.
// TODO: in things like SciPoster, this should also check if the item tag is allowed. Hard to formalise for now...
docbookParagraphs(text_, buffer(), xs, runparams);
xs.endDivision();
+ // - Think about the arguments after the paragraph.
+ for (auto const & arg : appendedArguments)
+ arg->docbook(xs, np);
+
// - Close the required tags.
if (writeOuterTag) {
if (!il.docbookitemtag().empty() && il.docbookitemtag() != "NONE" && il.docbookitemtag() != "IGNORE")