[LyX/master] DocBook: fix for nomenclature xml:id and glossary paragraphs.
Thibaut Cuvelier
tcuvelier at lyx.org
Sun Nov 15 17:14:40 UTC 2020
commit 0ed820fa0b8ea11a390c182286c5b34a2686058a
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sun Nov 15 18:43:14 2020 +0100
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.
---
development/autotests/invertedTests | 2 ++
src/insets/InsetNomencl.cpp | 8 +++-----
src/insets/InsetNomencl.h | 3 ---
src/output_docbook.cpp | 6 +++++-
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests
index 22e481a..f2faf03 100644
--- a/development/autotests/invertedTests
+++ b/development/autotests/invertedTests
@@ -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
diff --git a/src/insets/InsetNomencl.cpp b/src/insets/InsetNomencl.cpp
index 5e3c637..0e04ca6 100644
--- a/src/insets/InsetNomencl.cpp
+++ b/src/insets/InsetNomencl.cpp
@@ -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;
diff --git a/src/insets/InsetNomencl.h b/src/insets/InsetNomencl.h
index 1440649..1778e01 100644
--- a/src/insets/InsetNomencl.h
+++ b/src/insets/InsetNomencl.h
@@ -73,9 +73,6 @@ private:
///
docstring screenLabel() const override;
//@}
-
- /// unique id for this nomenclature entry for docbook export
- docstring nomenclature_entry_id;
};
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index d25d85f..b43d2b0 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -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
More information about the lyx-cvs
mailing list