DocBook: fix for nomenclature xml:id and glossary paragraphs.

Previously, the xml:id's were not consistent among <glossterm> in the text and <glossentry> in the glossary.
This commit is contained in:
Thibaut Cuvelier 2020-11-15 18:43:14 +01:00
parent eb0194081b
commit 0ed820fa0b
4 changed files with 10 additions and 9 deletions

View File

@ -497,6 +497,8 @@ export/examples(|/de)/Curricula_Vitae/Europe_CV_docbook5
export/examples(|/es)/Curricula_Vitae/Modern_CV_docbook5
# - Chess: multicol not supported.
export/examples/Modules/Chessboard_docbook5
# - Empty figure and table (just a caption, while DocBook requires some content).
export/examples/Localization_Test_docbook5
Sublabel: docbook poster
# Posters cannot be properly exported, the LyX documents are too far from

View File

@ -53,8 +53,7 @@ namespace lyx {
/////////////////////////////////////////////////////////////////////
InsetNomencl::InsetNomencl(Buffer * buf, InsetCommandParams const & p)
: InsetCommand(buf, p),
nomenclature_entry_id(xml::uniqueID(from_ascii("nomen")))
: InsetCommand(buf, p)
{}
@ -106,7 +105,7 @@ int InsetNomencl::plaintext(odocstringstream & os,
void InsetNomencl::docbook(XMLStream & xs, OutputParams const &) const
{
docstring attr = "linkend=\"" + nomenclature_entry_id + "\"";
docstring attr = "linkend=\"" + xml::cleanID(from_ascii("nomen") + getParam("symbol")) + "\"";
xs << xml::StartTag("glossterm", attr);
xs << xml::escapeString(getParam("symbol"));
xs << xml::EndTag("glossterm");
@ -348,9 +347,8 @@ void InsetPrintNomencl::docbook(XMLStream & xs, OutputParams const & runparams)
EntryMap::const_iterator const een = entries.end();
for (; eit != een; ++eit) {
NomenclEntry const & ne = eit->second;
string const parid = ne.par->magicLabel();
xs << xml::StartTag("glossentry", "xml:id=\"" + parid + "\"");
xs << xml::StartTag("glossentry", "xml:id=\"" + xml::cleanID(from_ascii("nomen") + ne.symbol) + "\"");
xs << xml::CR();
xs << xml::StartTag("glossterm");
xs << ne.symbol;

View File

@ -73,9 +73,6 @@ private:
///
docstring screenLabel() const override;
//@}
/// unique id for this nomenclature entry for docbook export
docstring nomenclature_entry_id;
};

View File

@ -458,7 +458,7 @@ void makeParagraph(
special_case |= nInsets == (size_t) par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
return inset.inset && inset.inset->asInsetMath() && inset.inset->asInsetMath()->getType() != hullSimple;
});
// Tables doe not deserve their own paragraphs (DocBook allows them outside paragraphs).
// Tables do not deserve their own paragraphs (DocBook allows them outside paragraphs).
special_case |= nInsets == (size_t) par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
return inset.inset->lyxCode() == TABULAR_CODE;
});
@ -487,6 +487,10 @@ void makeParagraph(
special_case |= nInsets == (size_t) par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
return inset.inset->lyxCode() == INCLUDE_CODE;
});
// Glossaries should not have a paragraph.
special_case |= nInsets == (size_t) par->size() && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
return inset.inset->lyxCode() == NOMENCL_PRINT_CODE;
});
bool const open_par = runparams.docbook_make_pars
&& !runparams.docbook_in_par