[LyX features/features/indexmacros] Document new inset features
The branch, features/indexmacros, has been updated. - Log - commit f4d588cea5ec175051adf264f4182d1aed8dfd66 Author: Juergen Spitzmueller Date: Mon Oct 31 19:26:39 2022 +0100 Document new inset features diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx index 2d2409c..f6b226d 100644 --- a/lib/doc/UserGuide.lyx +++ b/lib/doc/UserGuide.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true @@ -424,6 +424,8 @@ Preferences \family default . \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -460,6 +462,8 @@ Reconfigure \family default . \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -556,6 +560,8 @@ Reconfigure \family default ). \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -586,6 +592,8 @@ How to work with \SpecialChar LyX \begin_layout Section Basic File Operations \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1054,6 +1062,8 @@ you can register the changes you made to a document so that others can identify \begin_layout Section Basic Editing Features \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1101,6 +,8 @@ Cut \family default \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1139,6 +1151,8 @@ Copy \family default \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1177,6 +1191,8 @@ Paste \family default \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1239,6 +1255,8 @@ Replace \family default \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1251,6 +1269,8 @@ Find \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1883,6 +1903,8 @@ arg "command-sequence buffer-begin ; buffer-end-select" \begin_layout Section Undo and Redo \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1893,6 +1915,8 @@ Redo \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -1991,6 +2015,8 @@ Redo \begin_layout Section Mouse Operations \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2081,6 +2107,8 @@ name "sec:Navigating" \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2177,6 +2205,8 @@ name "subsec:The-Outliner" \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2187,6 +2217,8 @@ Navigating ! Outline \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2474,6 +2506,8 @@ By right-clicking on a section in the outliner you can select the whole \begin_layout Subsection Horizontal Scrolling \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2646,6 +2680,8 @@ name "sec:Input-Completion" \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2656,6 +2692,8 @@ Input completion \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2909,6 +2947,8 @@ Undo \begin_layout Section Basic Key Bindings \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2919,6 +2959,8 @@ Key Bindings \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -2951,6 +2993,8 @@ status collapsed \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -3426,6 +3470,8 @@ A \SpecialChar LyX Basics \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -3441,6 +3487,8 @@ status collapsed \begin_layout Section Document Types \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -3481,6 +3529,8 @@ document class \begin_layout Subsection Document Classes \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -3508,6 +3558,8 @@ Document Class \family default \begin_inset Index idx +range none +pageformat default status collapsed \begin_layout Plain Layout @@ -3725,6 +3777,8 @@ Document\SpecialChar m
[LyX/master] Merge branch 'master' into features/indexmacros
commit 5093e39170f16fa685208f5ef1f9a6584f69c5dd Merge: 7d7b21e 50403c4 Author: Juergen Spitzmueller Date: Tue Apr 19 11:54:11 2022 +0200 Merge branch 'master' into features/indexmacros src/Cursor.cpp |1 + 1 files changed, 1 insertions(+), 0 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] InsetIndex: add a comment.
commit 758792f6d60262534b4f4fdb63ac401360dac724 Author: Thibaut Cuvelier Date: Mon Apr 25 03:10:45 2022 +0200 InsetIndex: add a comment. --- src/insets/InsetIndex.cpp |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 3d3a801..72204c0 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -1379,6 +1379,8 @@ docstring InsetPrintIndex::xhtml(XMLStream &, OutputParams const & op) const // whatever, but return docstring(); + // Sort the entries, first on the main entry, then the subentry, then the subsubentry, + // thanks to the implementation of operator<. stable_sort(entries.begin(), entries.end()); Layout const & lay = bp.documentClass().htmlTOCLayout(); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Merge branch 'master' into features/indexmacros
commit 891731992484202e40d4fd67dab2672510070145 Merge: 5093e39 40a331a Author: Juergen Spitzmueller Date: Wed Apr 20 08:38:12 2022 +0200 Merge branch 'master' into features/indexmacros po/de.po| 34 --- po/fr.gmo | Bin 627646 -> 627801 bytes po/fr.po| 68 --- po/messages.mo | Bin 0 -> 627646 bytes po/sk.po| 17 +++- src/frontends/qt/FindAndReplace.cpp | 22 +++--- src/lyxfind.cpp | 165 +-- src/support/debug.cpp |7 +- src/support/debug.h | 11 ++- 9 files changed, 171 insertions(+), 153 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] InsetIndex: add a few comments.
commit b5418f0d29a022ff13e6ae6f9402dbbfd8b826bf Author: Thibaut Cuvelier Date: Mon Apr 25 03:14:24 2022 +0200 InsetIndex: add a few comments. --- src/insets/InsetIndex.cpp |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 72204c0..9f8471e 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -1241,6 +1241,7 @@ struct IndexEntry { IndexEntry() = default; + /// Builds an entry for the index with the given LaTeX index entry `s` and a pointer to the index inset `d`. IndexEntry(docstring const & s, DocIterator const & d, bool for_output = false) : dit_(d) { @@ -1250,6 +1251,7 @@ struct IndexEntry parseItem(subsub_, for_output); } + /// Comparison between two entries only based on their LaTeX representation. bool equal(IndexEntry const & rhs) const { return main_ == rhs.main_ && sub_ == rhs.sub_ && subsub_ == rhs.subsub_; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] InsetIndex: add a method hasSubentries.
commit 5c80671740ec803be7ce35b1f1844ffa438575a2 Author: Thibaut Cuvelier Date: Mon Apr 25 03:34:29 2022 +0200 InsetIndex: add a method hasSubentries. --- src/insets/InsetIndex.cpp | 17 + src/insets/InsetIndex.h |2 ++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index afa25f1..8a75622 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -769,6 +769,23 @@ std::vector InsetIndex::getSeeAlsoesAsText(OutputParams const & runpa } +bool InsetIndex::hasSubentries() const +{ + Paragraph const & par = paragraphs().front(); + InsetList::const_iterator it = par.insetList().begin(); + for (; it != par.insetList().end(); ++it) { + Inset & inset = *it->inset; + if (inset.lyxCode() == INDEXMACRO_CODE) { + InsetIndexMacro const & iim = + static_cast(inset); + if (iim.params().type == InsetIndexMacroParams::Subindex) + return true; + } + } + return false; +} + + bool InsetIndex::hasSeeRef() const { Paragraph const & par = paragraphs().front(); diff --git a/src/insets/InsetIndex.h b/src/insets/InsetIndex.h index 3a22b3b..ccf214b 100644 --- a/src/insets/InsetIndex.h +++ b/src/insets/InsetIndex.h @@ -106,6 +106,8 @@ private: /// std::vector getSeeAlsoesAsText(OutputParams const & runparams) const; /// + bool hasSubentries() const; + /// bool hasSeeRef() const; /// bool hasSortKey() const; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] InsetIndex: simplify the implementation of the has* methods.
commit 54a519a0893af33220dea91bef55f8a5d71b907c Author: Thibaut Cuvelier Date: Mon Apr 25 03:40:06 2022 +0200 InsetIndex: simplify the implementation of the has* methods. --- src/insets/InsetIndex.cpp | 48 1 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 8a75622..21995a0 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -769,51 +769,47 @@ std::vector InsetIndex::getSeeAlsoesAsText(OutputParams const & runpa } -bool InsetIndex::hasSubentries() const +namespace { + +bool hasInsetWithCode(const InsetIndex * const inset_index, const InsetCode code, + const std::set types = {}) { - Paragraph const & par = paragraphs().front(); + Paragraph const & par = inset_index->paragraphs().front(); InsetList::const_iterator it = par.insetList().begin(); for (; it != par.insetList().end(); ++it) { Inset & inset = *it->inset; - if (inset.lyxCode() == INDEXMACRO_CODE) { + if (inset.lyxCode() == code) { + if (types.empty()) + return true; + + LASSERT(code == INDEXMACRO_CODE, return false); InsetIndexMacro const & iim = - static_cast(inset); - if (iim.params().type == InsetIndexMacroParams::Subindex) + static_cast(inset); + if (types.find(iim.params().type) != types.end()) return true; } } return false; } +} // namespace + + +bool InsetIndex::hasSubentries() const +{ + return hasInsetWithCode(this, INDEXMACRO_CODE, {InsetIndexMacroParams::Subindex}); +} + bool InsetIndex::hasSeeRef() const { - Paragraph const & par = paragraphs().front(); - InsetList::const_iterator it = par.insetList().begin(); - for (; it != par.insetList().end(); ++it) { - Inset & inset = *it->inset; - if (inset.lyxCode() == INDEXMACRO_CODE) { - InsetIndexMacro const & iim = - static_cast(inset); - if (iim.params().type == InsetIndexMacroParams::See - || iim.params().type == InsetIndexMacroParams::Seealso) - return true; - } - } - return false; + return hasInsetWithCode(this, INDEXMACRO_CODE, {InsetIndexMacroParams::See, InsetIndexMacroParams::Seealso}); } bool InsetIndex::hasSortKey() const { - Paragraph const & par = paragraphs().front(); - InsetList::const_iterator it = par.insetList().begin(); - for (; it != par.insetList().end(); ++it) { - Inset & inset = *it->inset; - if (inset.lyxCode() == INDEXMACRO_SORTKEY_CODE) - return true; - } - return false; + return hasInsetWithCode(this, INDEXMACRO_SORTKEY_CODE); } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Introduce InsetIndexMacros
commit 7d7b21ec3e60f0186929016d89a0dfeb4ad8c60f Author: Juergen Spitzmueller Date: Tue Apr 19 11:46:08 2022 +0200 Introduce InsetIndexMacros This adds native macros for subindexes (!level), |see and |seealso as well as native support for ranges |( |) and pagination format -- e.g., |textbf -- via the index dialog Resolves #12478, #7232 and #5014 The feature is complete (incl. tex2lyx) except for * file format change and lyx2lyx * docbook/xhtml * documentation lib/layouts/stdinsets.inc | 30 +++ lib/ui/stdcontext.inc | 17 ++ lib/ui/stdmenus.inc|8 + src/FuncCode.h |2 + src/LyXAction.cpp | 10 + src/Makefile.am|1 + src/Text3.cpp | 10 + src/factory.cpp| 14 ++ src/frontends/qt/GuiIndex.cpp | 51 - src/frontends/qt/GuiIndex.h|1 + src/frontends/qt/ui/IndexUi.ui | 141 +--- src/insets/InsetCode.h |4 + src/insets/InsetIndex.cpp | 486 +++- src/insets/InsetIndex.h| 30 +++- src/insets/InsetIndexMacro.cpp | 384 +++ src/insets/InsetIndexMacro.h | 125 ++ src/insets/InsetText.cpp |4 + src/tex2lyx/Parser.cpp | 60 - src/tex2lyx/Parser.h | 12 +- src/tex2lyx/tex2lyx.h |6 +- src/tex2lyx/text.cpp | 236 ++- 21 files changed, 1464 insertions(+), 168 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] InsetIndex: refactor IndexEntry to be a full-fledged class, hiding its implementation details better than before.
commit 4a62c08e61dc14843b45f81d89831318254fc41b Author: Thibaut Cuvelier Date: Mon Apr 25 03:09:02 2022 +0200 InsetIndex: refactor IndexEntry to be a full-fledged class, hiding its implementation details better than before. --- autotests/export/docbook/index.lyx | 36 +++- src/insets/InsetIndex.cpp | 171 2 files changed, 106 insertions(+), 101 deletions(-) diff --git a/autotests/export/docbook/index.lyx b/autotests/export/docbook/index.lyx index 4c03f98..18398c7 100644 --- a/autotests/export/docbook/index.lyx +++ b/autotests/export/docbook/index.lyx @@ -90,31 +90,6 @@ Index tests \end_layout \begin_layout Standard -\begin_inset Index idx -range none -pageformat default -status open - -\begin_layout Plain Layout -Primary -\begin_inset IndexMacro subindex -status open - -\begin_layout Plain Layout -Secondary -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard Text \begin_inset Index idx range none @@ -300,5 +275,16 @@ Tertiary . \end_layout +\begin_layout Standard +\begin_inset CommandInset index_print +LatexCommand printindex +type "idx" +name "Index" + +\end_inset + + +\end_layout + \end_body \end_document diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index aa49362..3d3a801 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -1237,88 +1237,113 @@ bool InsetPrintIndex::hasSettings() const namespace { - -void parseItem(docstring & s, bool for_output) +struct IndexEntry { - // this does not yet check for escaped things - size_type loc = s.find(from_ascii("@")); - if (loc != string::npos) { - if (for_output) - s.erase(0, loc + 1); - else - s.erase(loc); + IndexEntry() = default; + + IndexEntry(docstring const & s, DocIterator const & d, bool for_output = false) + : dit_(d) + { + extractSubentries(s); + parseItem(main_, for_output); + parseItem(sub_, for_output); + parseItem(subsub_, for_output); } - loc = s.find(from_ascii("|")); - if (loc != string::npos) - s.erase(loc); -} + bool equal(IndexEntry const & rhs) const + { + return main_ == rhs.main_ && sub_ == rhs.sub_ && subsub_ == rhs.subsub_; + } -void extractSubentries(docstring const & entry, docstring & main, - docstring & sub1, docstring & sub2) -{ - if (entry.empty()) - return; - size_type const loc = entry.find(from_ascii(" ! ")); - if (loc == string::npos) - main = entry; - else { - main = trim(entry.substr(0, loc)); - size_t const locend = loc + 3; - size_type const loc2 = entry.find(from_ascii(" ! "), locend); - if (loc2 == string::npos) { - sub1 = trim(entry.substr(locend)); - } else { - sub1 = trim(entry.substr(locend, loc2 - locend)); - sub2 = trim(entry.substr(loc2 + 3)); - } + bool same_sub(IndexEntry const & rhs) const + { + return main_ == rhs.main_ && sub_ == rhs.sub_; } -} + bool same_main(IndexEntry const & rhs) const + { + return main_ == rhs.main_; + } -struct IndexEntry -{ - IndexEntry() - {} + const Paragraph & innerParagraph() const + { + return dit_.innerParagraph(); + } - IndexEntry(docstring const & s, DocIterator const & d) - : dit(d) + const docstring & main() const { - extractSubentries(s, main, sub, subsub); - parseItem(main, false); - parseItem(sub, false); - parseItem(subsub, false); + return main_; } - bool equal(IndexEntry const & rhs) const + const docstring & sub() const { - return main == rhs.main && sub == rhs.sub && subsub == rhs.subsub; + return sub_; } - bool same_sub(IndexEntry const & rhs) const + const docstring & subsub() const { - return main == rhs.main && sub == rhs.sub; + return subsub_; } - bool same_main(IndexEntry const & rhs) const + const DocIterator & dit() const { - return main == rhs.main; + return dit_; } - docstring main; - docstring sub; - docstring subsub; - DocIterator dit; + +private: + void parseItem(docstring & s, bool for_output) + { + // this does not yet check for escaped things + size_type loc = s.find(from_ascii("@")); + if (loc != string::npos) { +
[LyX/master] InsetIndex: when parsing entries for XHTML, don't impose spaces around ! for subentries.
commit 029d8d58392a8649c68eabc05ef5c801d36632b0 Author: Thibaut Cuvelier Date: Mon Apr 25 03:24:01 2022 +0200 InsetIndex: when parsing entries for XHTML, don't impose spaces around ! for subentries. --- src/insets/InsetIndex.cpp | 64 ++-- 1 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 9f8471e..afa25f1 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -1243,7 +1243,7 @@ struct IndexEntry /// Builds an entry for the index with the given LaTeX index entry `s` and a pointer to the index inset `d`. IndexEntry(docstring const & s, DocIterator const & d, bool for_output = false) - : dit_(d) + : dit_(d), output_error_{} { extractSubentries(s); parseItem(main_, for_output); @@ -1292,8 +1292,49 @@ struct IndexEntry return dit_; } + /// When parsing this entry, some errors may be found; they are reported as a single string. + // It is up to the caller to send this string to LYXERR and the output file, as needed. + const docstring & output_error() const + { + return output_error_; + } + private: + void checkForUnsupportedFeatures(docstring const & entry) + { + if (entry.find(from_utf8("@\\")) != lyx::docstring::npos) { + output_error_ = from_utf8("Unsupported feature: an index entry contains an @\\. " + "Complete entry: \"") + entry + from_utf8("\""); + } + } + + /// Splits the LaTeX entry into subentries. + void extractSubentries(docstring const & entry) + { + if (entry.empty()) + return; + + size_type const loc_first_bang = entry.find(from_ascii("!")); + if (loc_first_bang == string::npos) { + // No subentry. + main_ = entry; + } else { + main_ = trim(entry.substr(0, loc_first_bang)); + size_t const loc_after_first_bang = loc_first_bang + 1; + + size_type const loc_second_bang = entry.find(from_ascii("!"), loc_after_first_bang); + if (loc_second_bang == string::npos) { + // Only a subentry, no subsubentry. + sub_ = trim(entry.substr(loc_after_first_bang)); + } else { + // Subsubentry. + sub_ = trim(entry.substr(loc_after_first_bang, loc_second_bang - loc_after_first_bang)); + subsub_ = trim(entry.substr(loc_second_bang + 1)); + } + } + } + void parseItem(docstring & s, bool for_output) { // this does not yet check for escaped things @@ -1309,27 +1350,8 @@ private: s.erase(loc); } - void extractSubentries(docstring const & entry) - { - if (entry.empty()) - return; - size_type const loc = entry.find(from_ascii(" ! ")); - if (loc == string::npos) - main_ = entry; - else { - main_ = trim(entry.substr(0, loc)); - size_t const locend = loc + 3; - size_type const loc2 = entry.find(from_ascii(" ! "), locend); - if (loc2 == string::npos) { - sub_ = trim(entry.substr(locend)); - } else { - sub_ = trim(entry.substr(locend, loc2 - locend)); - subsub_ = trim(entry.substr(loc2 + 3)); - } - } - } - private: + docstring output_error_; docstring main_; docstring sub_; docstring subsub_; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] DocBook: use the new system for index.
commit 5a538722590f2301e8658bc56ce777f3ef4a787a Author: Thibaut Cuvelier Date: Fri Apr 22 03:44:16 2022 +0200 DocBook: use the new system for index. --- autotests/export/docbook/index.lyx | 159 +++- autotests/export/docbook/index.xml |2 + src/insets/InsetIndex.cpp | 139 --- src/insets/InsetIndex.h|8 ++ 4 files changed, 294 insertions(+), 14 deletions(-) diff --git a/autotests/export/docbook/index.lyx b/autotests/export/docbook/index.lyx index 875e633..4c03f98 100644 --- a/autotests/export/docbook/index.lyx +++ b/autotests/export/docbook/index.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 608 +\lyxformat 609 \begin_document \begin_header \save_transient_properties true @@ -90,8 +90,35 @@ Index tests \end_layout \begin_layout Standard +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Primary +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Secondary +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard Text \begin_inset Index idx +range none +pageformat default status open \begin_layout Plain Layout @@ -102,6 +129,8 @@ Text \begin_inset Index idx +range none +pageformat default status open \begin_layout Plain Layout @@ -112,6 +141,8 @@ SortedAs@Text \begin_inset Index idx +range none +pageformat default status open \begin_layout Plain Layout @@ -122,6 +153,8 @@ Primary!Secondary \begin_inset Index idx +range none +pageformat default status open \begin_layout Plain Layout @@ -132,6 +165,8 @@ SortedPrimary@Primary!Secondary \begin_inset Index idx +range none +pageformat default status open \begin_layout Plain Layout @@ -143,5 +178,127 @@ Primary!Secondary!Tertiary . \end_layout +\begin_layout Standard +Text +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Text +\end_layout + +\end_inset + + +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +\begin_inset IndexMacro sortkey +status open + +\begin_layout Plain Layout +SortedAs +\end_layout + +\end_inset + +Text +\end_layout + +\end_inset + + +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Primary +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Secondary +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +\begin_inset IndexMacro sortkey +status open + +\begin_layout Plain Layout +SortedPrimary +\end_layout + +\end_inset + +Primary +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Secondary +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Primary +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Secondary +\end_layout + +\end_inset + + +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Tertiary +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +. +\end_layout + \end_body \end_document diff --git a/autotests/export/docbook/index.xml b/autotests/export/docbook/index.xml index 21e73c5..d80aa38 100644 --- a/autotests/export/docbook/index.xml +++ b/autotests/export/docbook/index.xml @@ -3,5 +3,7 @@ See https://www.lyx.org/ for more information --> http://docbook.org/ns/docbook"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="http://www.w3.org/1998/Math/MathML"; xmlns:xi="http://www.w3.org/2001/XInclude"; version="5.2"> Index tests +PrimarySecondary +TextTextTextPrimarySecondaryPrimarySecondaryPrimarySecondaryTertiary. TextTextTextPrimarySecondaryPrimarySecondaryPrimarySecondaryTertiary. \ No newline at end of file diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 8b69b6f..aa49362 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -307,6 +307,11 @@ void InsetIndex::processLatexSorting(otexstream & os, OutputParams const & runpa void InsetIndex::docbook(XMLStream & xs, OutputParams const & runparams) const { + // Two ways of processing this inset are implemented: + // - the legacy one, based on parsing the raw LaTeX (before LyX 2.4) -- unlikely to be deprecated + // - the modern one, based on precise insets for indexing features + // Like the LaTeX implementation, consider the user chooses either of those options. + // Get the content of the inset as LaTeX, as some things may be encoded as ERT (like {}). // TODO: if there is an ERT within the index term, its conversion should be tried, in case it becomes useful; // otherwise, ERT
[LyX/master] Merge branch 'master' into features/indexmacros
commit f86c7994a5be562544ee80bf3b6e9607a7c5ebf3 Merge: 5a53872 8b48e42 Author: Juergen Spitzmueller Date: Mon Apr 25 08:12:12 2022 +0200 Merge branch 'master' into features/indexmacros po/de.gmo| Bin 624552 -> 624975 bytes po/de.po | 34 +++- po/fr.gmo| Bin 627801 -> 628113 bytes po/fr.po | 47 - po/sk.po | 12 +++- src/frontends/qt/GuiProgressView.cpp | 23 ++-- src/lyxfind.cpp |6 ++-- src/support/debug.cpp| 14 -- src/support/debug.h | 14 -- 9 files changed, 98 insertions(+), 52 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix a warning related to comparing different signedness
commit 5e87cfbf4c0e64f15f0a26c4ac5a29236b1eb962 Author: Thibaut Cuvelier Date: Thu Sep 1 10:57:04 2022 +0200 Fix a warning related to comparing different signedness --- src/insets/InsetIndex.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index b4a143e..94bfa13 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -1476,7 +1476,7 @@ bool operator<(IndexEntry const & lhs, IndexEntry const & rhs) if (lhs.terms_.empty()) return false; - for (int i = 0; i < min(rhs.terms_.size(), lhs.terms_.size()); ++i) { + for (unsigned i = 0; i < min(rhs.terms_.size(), lhs.terms_.size()); ++i) { int comp = compare_no_case(lhs.terms_[i], rhs.terms_[i]); if (comp != 0) return comp < 0; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] DocBook: amend 34ea4080
commit f4b0cf9b599c0994c0e8c60390a65d57d5f7262a Author: Thibaut Cuvelier Date: Thu Sep 1 01:13:47 2022 +0200 DocBook: amend 34ea4080 @ for sorting is implemented at 34ea4080, but the user was still shown a warning (now removed). --- src/insets/InsetIndex.cpp |8 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 848d530..f463b19 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -320,14 +320,6 @@ void InsetIndex::docbook(XMLStream & xs, OutputParams const & runparams) const InsetText::latex(ots, runparams); docstring latexString = trim(odss.str()); - // Check whether there are unsupported things. @ is supported, but only for sorting, without specific formatting. - if (latexString.find(from_utf8("@\\")) != lyx::docstring::npos) { - docstring error = from_utf8("Unsupported feature: an index entry contains an @\\. " - "Complete entry: \"") + latexString + from_utf8("\""); - LYXERR0(error); - xs << XMLStream::ESCAPE_NONE << (from_utf8("\n")); - } - // Handle several indices (indicated in the inset instead of the raw latexString). docstring indexType = from_utf8(""); if (buffer().masterBuffer()->params().use_indices) { -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] LyXHTML: implement index ranges
commit 92ba7584415cacbea639dbca0199c9fd510ca617 Author: Thibaut Cuvelier Date: Thu Sep 1 02:22:50 2022 +0200 LyXHTML: implement index ranges --- src/insets/InsetIndex.cpp | 49 +--- 1 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index d17b059..b4a143e 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -360,10 +360,10 @@ void InsetIndex::docbook(XMLStream & xs, OutputParams const & runparams) const } // Handle ranges. Happily, in the raw LaTeX mode, (| and |) can only be at the end of the string! - bool hasInsetRange = params_.range != InsetIndexParams::PageRange::None; - bool hasStartRange = params_.range == InsetIndexParams::PageRange::Start || + const bool hasInsetRange = params_.range != InsetIndexParams::PageRange::None; + const bool hasStartRange = params_.range == InsetIndexParams::PageRange::Start || latexString.find(from_ascii("|(")) != lyx::docstring::npos; - bool hasEndRange = params_.range == InsetIndexParams::PageRange::End || + const bool hasEndRange = params_.range == InsetIndexParams::PageRange::End || latexString.find(from_ascii("|)")) != lyx::docstring::npos; if (hasInsetRange) { @@ -1566,7 +1566,7 @@ IndexNode* buildIndexTree(vector& entries) return index_root; } -void outputIndexPage(XMLStream & xs, const IndexNode* root_node, unsigned depth = 0) +void outputIndexPage(XMLStream & xs, const IndexNode* root_node, unsigned depth = 0) // NOLINT(misc-no-recursion) { LASSERT(root_node->entries.size() + root_node->children.size() > 0, return); @@ -1576,16 +1576,49 @@ void outputIndexPage(XMLStream & xs, const IndexNode* root_node, unsigned depth // By tree assumption, all the entries at this node have the same set of terms. if (!root_node->entries.empty()) { - xs << XMLStream::ESCAPE_NONE << " — "; + xs << XMLStream::ESCAPE_NONE << " — "; // Em dash, i.e. long (---). unsigned entry_number = 1; - for (unsigned i = 0; i < root_node->entries.size(); ++i) { - const IndexEntry &entry = root_node->entries[i]; - + auto writeLinkToEntry = [&xs](const IndexEntry &entry, unsigned entry_number) { std::string const link_attr = "href='#" + entry.inset()->paragraphs()[0].magicLabel() + "'"; xs << xml::StartTag("a", link_attr); xs << from_ascii(std::to_string(entry_number)); xs << xml::EndTag("a"); + }; + + for (unsigned i = 0; i < root_node->entries.size(); ++i) { + const IndexEntry &entry = root_node->entries[i]; + + switch (entry.inset()->params().range) { + case InsetIndexParams::PageRange::None: + writeLinkToEntry(entry, entry_number); + break; + case InsetIndexParams::PageRange::Start: { + // Try to find the end of the range, if it is just after. Otherwise, the output will be slightly + // scrambled, but understandable. Doing better would mean implementing more of the indexing logic here + // and more complex indexing here (skipping the end is not just incrementing i). Worst case output: + // 1--, 2, --3 + const bool nextEntryIsEnd = i + 1 < root_node->entries.size() && + root_node->entries[i + 1].inset()->params().range == + InsetIndexParams::PageRange::End; + // No need to check if both entries are for the same terms: they are in the same IndexNode. + + writeLinkToEntry(entry, entry_number); + xs << XMLStream::ESCAPE_NONE << " – "; // En dash, i.e. semi-long (--). + + if (nextEntryIsEnd) { + // Skip the next entry in the loop, write it right now, after the dash. + entry_number += 1; + i += 1; + writeLinkToEntry(root_node->entries[i], entry_number); + } + } + break; + case InsetIndexParams::PageRange::End: +
[LyX/master] Merge branch 'master' into features/indexmacros
commit 3a949b32f08ce4884906a9c5d47c4d7031c794b2 Merge: b3b22b0 4a54269 Author: Juergen Spitzmueller Date: Sat Oct 29 11:42:14 2022 +0200 Merge branch 'master' into features/indexmacros lib/configure.py |2 +- lib/scripts/prefs2prefs_prefs.py | 15 - src/Buffer.cpp|2 +- src/Buffer.h |2 +- src/BufferView.cpp| 11 ++- src/Cursor.cpp|2 +- src/Cursor.h |5 +- src/FuncCode.h|2 - src/Layout.h |5 -- src/LyXAction.cpp | 16 - src/LyXRC.cpp | 34 +- src/LyXRC.h | 10 ++-- src/Text3.cpp | 42 +++- src/frontends/qt/GuiPrefs.cpp | 23 --- src/frontends/qt/GuiPrefs.h |2 +- src/frontends/qt/ui/PrefEditUi.ui | 126 +--- 16 files changed, 134 insertions(+), 165 deletions(-) diff --cc src/FuncCode.h index 6d7ed85,8a0fe35..f050f8e --- a/src/FuncCode.h +++ b/src/FuncCode.h @@@ -500,11 -500,7 +500,9 @@@ enum FuncCod LFUN_SPELLING_ADD_LOCAL,// jspitzm 20210306 // 390 LFUN_SPELLING_REMOVE_LOCAL, // jspitzm 20210307 - LFUN_FINISHED_DOWN, // lasgouttes 20210629 - LFUN_FINISHED_UP, // lasgouttes 20210629 LFUN_BRANCH_SYNC_ALL, // sanda 20220415 + LFUN_INDEXMACRO_INSERT, // spitz 20220220 + // 395 LFUN_LASTACTION // end of the table }; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Document new inset features
commit f4d588cea5ec175051adf264f4182d1aed8dfd66 Author: Juergen Spitzmueller Date: Mon Oct 31 19:26:39 2022 +0100 Document new inset features lib/doc/UserGuide.lyx | 2388 +++-- 1 files changed, 2322 insertions(+), 66 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Enter subindex on Enter in index
commit 9dc9fa68ce74964c8f59e608286e99822c268c6b Author: Juergen Spitzmueller Date: Mon Oct 31 05:25:04 2022 +0100 Enter subindex on Enter in index --- src/insets/InsetIndex.cpp | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index dd29579..25dfb46 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -29,6 +29,7 @@ #include "LaTeX.h" #include "LaTeXFeatures.h" #include "Lexer.h" +#include "LyX.h" #include "output_latex.h" #include "output_xhtml.h" #include "xml.h" @@ -579,6 +580,14 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) cur.bv().updateDialog("index", params2string(params_)); break; + case LFUN_PARAGRAPH_BREAK: { + // Since this inset in single-par anyway, let's use + // return to enter subindexes + FuncRequest fr(LFUN_INDEXMACRO_INSERT, "subindex"); + lyx::dispatch(fr); + break; + } + default: InsetCollapsible::doDispatch(cur, cmd); break; @@ -610,6 +619,9 @@ bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd, return true; } + case LFUN_PARAGRAPH_BREAK: + return macrosPossible("subindex"); + case LFUN_INDEXMACRO_INSERT: return macrosPossible(cmd.getArg(0)); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Display subinsets in inset button and outliner
commit fba3dace9ecd42408d6efbadc7123e3caf32083f Author: Juergen Spitzmueller Date: Mon Oct 31 06:04:13 2022 +0100 Display subinsets in inset button and outliner --- src/insets/InsetIndex.cpp | 40 src/insets/InsetIndex.h |3 ++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 25dfb46..5f4cb7e 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -687,7 +687,8 @@ void InsetIndex::getSubentries(otexstream & os, OutputParams const & runparams) } -std::vector InsetIndex::getSubentriesAsText(OutputParams const & runparams) const +std::vector InsetIndex::getSubentriesAsText(OutputParams const & runparams, + bool const asLabel) const { std::vector subentries; @@ -703,10 +704,15 @@ std::vector InsetIndex::getSubentriesAsText(OutputParams const & runp ++i; if (i > 2) break; - - otexstringstream os; - iim.getLatex(os, runparams); - subentries.emplace_back(os.str()); + if (asLabel) { + docstring const l; + docstring const sl = iim.getNewLabel(l); + subentries.emplace_back(sl); + } else { + otexstringstream os; + iim.getLatex(os, runparams); + subentries.emplace_back(os.str()); + } } } } @@ -926,8 +932,15 @@ docstring const InsetIndex::buttonLabel(BufferView const & bv) const docstring res; if (!il.contentaslabel() || geometry(bv) != ButtonOnly) res = label; - else + else { res = getNewLabel(label); + OutputParams const rp(0); + vector sublbls = getSubentriesAsText(rp, true); + for (auto const & sublbl : sublbls) { + res += " " + docstring(1, char_type(0x2023));// TRIANGULAR BULLET + res += " " + sublbl; + } + } if (!insetindexpagerangetranslator_latex().find(params_.range).empty()) res += " " + from_ascii(insetindexpagerangetranslator_latex().find(params_.range)); return res; @@ -979,11 +992,22 @@ void InsetIndex::addToToc(DocIterator const & cpit, bool output_active, DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast(*this))); docstring str; + InsetLayout const & il = getLayout(); + docstring label = translateIfPossible(il.labelstring()); + if (!il.contentaslabel()) + str = label; + else { + str = getNewLabel(label); + OutputParams const rp(0); + vector sublbls = getSubentriesAsText(rp, true); + for (auto const & sublbl : sublbls) { + str += " " + docstring(1, char_type(0x2023));// TRIANGULAR BULLET + str += " " + sublbl; + } + } string type = "index"; if (buffer().masterBuffer()->params().use_indices) type += ":" + to_utf8(params_.index); - // this is unlikely to be terribly long - text().forOutliner(str, INT_MAX); TocBuilder & b = backend.builder(type); b.pushItem(pit, str, output_active); // Proceed with the rest of the inset. diff --git a/src/insets/InsetIndex.h b/src/insets/InsetIndex.h index 5ecf6be..1aaf2d7 100644 --- a/src/insets/InsetIndex.h +++ b/src/insets/InsetIndex.h @@ -104,7 +104,8 @@ private: /// void getSubentries(otexstream &, OutputParams const &) const; /// - std::vector getSubentriesAsText(OutputParams const &) const; + std::vector getSubentriesAsText(OutputParams const &, + bool const asLabel = false) const; /// docstring getMainSubentryAsText(OutputParams const & runparams) const; /// -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Merge branch 'master' into features/indexmacros
commit 047004cb0fca7247a6e13dde9f22c9a56ab245e6 Merge: f352a37 1464bd3 Author: Juergen Spitzmueller Date: Sat May 14 16:29:46 2022 +0200 Merge branch 'master' into features/indexmacros .../latex/lyxbugs-resolved/6197-polish-amssymb.lyx | 141 + .../export/latex/lyxbugs/6197-polish-amssymb.lyx | 134 - config/qt.m4 |4 +- development/autotests/filterCheckWarnings |4 +- development/autotests/findadv-05-in.txt|2 +- development/autotests/findadv-06-in.txt|6 +- development/autotests/findadv-07-in.txt|4 +- development/autotests/findadv-09-in.txt|4 +- development/autotests/findadv-10-in.txt|4 +- development/autotests/findadv-14-in.txt|4 +- development/autotests/findadv-15-in.txt|4 +- development/autotests/findadv-16-in.txt|2 +- development/autotests/findadv-17-in.txt|2 +- development/autotests/findadv-21-in.txt|4 +- development/autotests/findadv-22-in.txt|4 +- development/autotests/findadv-combined-in.txt |2 +- development/autotests/findadv-logo-in.txt |2 +- development/autotests/findadv-re-01-in.txt |4 +- development/autotests/findadv-re-02-in.txt |6 +- development/autotests/findadv-re-03-in.txt |4 +- development/autotests/findadv-re-04-in.txt |8 +- development/autotests/findadv-re-06-in.txt |2 +- development/autotests/lyx2lyxtest.cmake|2 +- development/batchtests/beamer_test.tex.orig|4 +- lib/doc/UserGuide.lyx | 149 +- lib/ui/stdcontext.inc |2 +- m4/eilseq.m4 | 20 +- po/de.gmo | Bin 624975 -> 625745 bytes po/de.po | 222 +-- po/fr.gmo | Bin 628113 -> 629103 bytes po/fr.po | 278 +++--- po/sk.po | 95 +-- src/BufferView.cpp |4 +- src/Font.cpp | 17 +- src/OutputParams.h |9 +- src/Paragraph.cpp | 37 ++- src/Text2.cpp |1 + src/Text3.cpp | 20 +- src/frontends/qt/FindAndReplace.cpp| 81 +- src/frontends/qt/FindAndReplace.h |7 + src/frontends/qt/ui/FindAndReplaceUi.ui| 157 -- src/frontends/qt/ui/PrefEditUi.ui |9 +- src/insets/InsetBibtex.cpp |2 +- src/insets/InsetBranch.cpp |4 +- src/insets/InsetInclude.cpp|4 +- src/insets/InsetIndex.cpp |2 +- src/insets/InsetNote.cpp | 14 +- src/insets/InsetQuotes.cpp |4 +- src/insets/InsetSpace.cpp | 82 -- src/lyxfind.cpp| 308 +++ src/mathed/InsetMathHull.cpp |6 +- src/mathed/InsetMathNest.cpp |2 +- src/output_latex.cpp | 28 +- 53 files changed, 1329 insertions(+), 592 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] DocBook: add missing test case for index
commit 07380a3bc167f6479a6c0c7a639e703d2eedeb9c Author: Thibaut Cuvelier Date: Thu Sep 1 00:14:41 2022 +0200 DocBook: add missing test case for index --- autotests/export/docbook/index_nesting.xml | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/autotests/export/docbook/index_nesting.xml b/autotests/export/docbook/index_nesting.xml new file mode 100644 index 000..e80244e --- /dev/null +++ b/autotests/export/docbook/index_nesting.xml @@ -0,0 +1,11 @@ + + +http://docbook.org/ns/docbook"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="http://www.w3.org/1998/Math/MathML"; xmlns:xi="http://www.w3.org/2001/XInclude"; version="5.2"> +Index nesting tests +A +AB +ABC +AD +EF + \ No newline at end of file -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] LyXHTML: implement multiple indices
commit 2b177172f17d524cd27727319799112cbc62fa7d Author: Thibaut Cuvelier Date: Thu Sep 1 02:04:05 2022 +0200 LyXHTML: implement multiple indices --- src/insets/InsetCommandParams.cpp | 20 +--- src/insets/InsetCommandParams.h |4 src/insets/InsetIndex.cpp | 19 ++- src/insets/InsetIndex.h |2 ++ 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 09c9ee8..bff358f 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -322,7 +322,7 @@ void InsetCommandParams::Read(Lexer & lex, Buffer const * buffer) preview_ = lex.getBool(); continue; } - if (info_.hasParam(token)) { + if (hasParam(token)) { lex.next(true); docstring data = lex.getDocString(); if (buffer && token == "filename") { @@ -604,10 +604,24 @@ docstring InsetCommandParams::getFirstNonOptParam() const } +bool InsetCommandParams::hasParam(std::string const & name) const +{ + return info_.hasParam(name); +} + + +docstring const & InsetCommandParams::getParamOr(std::string const & name, docstring const & defaultValue) const +{ + if (hasParam(name)) + return (*this)[name]; + return defaultValue; +} + + docstring const & InsetCommandParams::operator[](string const & name) const { static const docstring dummy; - LASSERT(info_.hasParam(name), return dummy); + LASSERT(hasParam(name), return dummy); ParamMap::const_iterator data = params_.find(name); if (data == params_.end() || data->second.empty()) return dummy; @@ -620,7 +634,7 @@ docstring const & InsetCommandParams::operator[](string const & name) const docstring & InsetCommandParams::operator[](string const & name) { - LATTEST(info_.hasParam(name)); + LATTEST(hasParam(name)); // this will add the name in release mode ParamInfo::ParamData const & param = info_[name]; if (param.ignore()) diff --git a/src/insets/InsetCommandParams.h b/src/insets/InsetCommandParams.h index 1800fb5..7ed182a 100644 --- a/src/insets/InsetCommandParams.h +++ b/src/insets/InsetCommandParams.h @@ -146,6 +146,10 @@ public: /// FIXME Would be better removed, but is used in BufferView.cpp in /// ways that make removal hard. docstring getFirstNonOptParam() const; + /// Determine whether a parameter is set + bool hasParam(std::string const & name) const; + /// Get the parameter \p name if it is set, \p defaultValue otherwise + docstring const & getParamOr(std::string const & name, docstring const & defaultValue) const; /// get parameter \p name /// LyX will assert if name is not a valid parameter. docstring const & operator[](std::string const & name) const; diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index f463b19..d17b059 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -1656,25 +1656,17 @@ docstring InsetPrintIndex::xhtml(XMLStream &, OutputParams const & op) const { BufferParams const & bp = buffer().masterBuffer()->params(); - // we do not presently support multiple indices, so we refuse to print - // anything but the main index, so as not to generate multiple indices. - // NOTE Multiple index support would require some work. The reason - // is that the TOC does not know about multiple indices. Either it would - // need to be told about them (not a bad idea), or else the index entries - // would need to be collected differently, say, during validation. - if (bp.use_indices && getParam("type") != from_ascii("idx")) - return docstring(); - shared_ptr toc = buffer().tocBackend().toc("index"); if (toc->empty()) return docstring(); // Collect the index entries in a form we can use them. vector entries; + const docstring & indexType = params().getParamOr("type", from_ascii("idx")); for (const TocItem& item : *toc) { - static_cast(&(item.dit().inset()))->params_.index; - if (item.isOutput()) - entries.emplace_back(IndexEntry{static_cast(&(item.dit().inset())), &op}); + const auto* inset = static_cast(&(item.dit().inset())); + if (item.isOutput() && inset->params().index == indexType) + entries.emplace_back(IndexEntry{inset, &op}); } // If all the index entries are in notes or not displayed, get out sooner. @@ -1690,6 +1682,7 @@ docstring InsetPrintIndex::xhtml(XMLStream &, OutputParams const & op) const Layout const & lay = bp.documentClass().htmlTOCLayout(); st
[LyX/master] Rename subindex to subentry
commit 077ccf905dfaa5dac0c5e77a54b15c6980d45b09 Author: Juergen Spitzmueller Date: Mon Oct 31 06:51:38 2022 +0100 Rename subindex to subentry Makes more sense, and distinguishes it better from printsubindex --- autotests/export/docbook/index.lyx |8 +++--- autotests/export/docbook/index_light.lyx|6 ++-- autotests/export/docbook/index_multiple.lyx | 10 autotests/export/docbook/index_nesting.lyx | 10 development/FORMAT |4 +- lib/layouts/stdinsets.inc |4 +- lib/lyx2lyx/lyx_2_4.py | 28 +- lib/ui/stdcontext.inc |2 +- lib/ui/stdmenus.inc |2 +- src/LyXAction.cpp |2 +- src/factory.cpp |4 +- src/insets/InsetIndex.cpp | 18 src/insets/InsetIndexMacro.cpp |8 +++--- src/insets/InsetIndexMacro.h|2 +- src/tex2lyx/text.cpp|6 ++-- 15 files changed, 57 insertions(+), 57 deletions(-) diff --git a/autotests/export/docbook/index.lyx b/autotests/export/docbook/index.lyx index 18398c7..4a0eb07 100644 --- a/autotests/export/docbook/index.lyx +++ b/autotests/export/docbook/index.lyx @@ -195,7 +195,7 @@ status open \begin_layout Plain Layout Primary -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -226,7 +226,7 @@ SortedPrimary \end_inset Primary -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -248,7 +248,7 @@ status open \begin_layout Plain Layout Primary -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -258,7 +258,7 @@ Secondary \end_inset -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout diff --git a/autotests/export/docbook/index_light.lyx b/autotests/export/docbook/index_light.lyx index ce4dd7e..368af82 100644 --- a/autotests/export/docbook/index_light.lyx +++ b/autotests/export/docbook/index_light.lyx @@ -110,7 +110,7 @@ status open \begin_layout Plain Layout Primary -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -132,7 +132,7 @@ status open \begin_layout Plain Layout Primary -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -142,7 +142,7 @@ Secondary \end_inset -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout diff --git a/autotests/export/docbook/index_multiple.lyx b/autotests/export/docbook/index_multiple.lyx index 66542aa..5e4fcdd 100644 --- a/autotests/export/docbook/index_multiple.lyx +++ b/autotests/export/docbook/index_multiple.lyx @@ -118,7 +118,7 @@ status open \begin_layout Plain Layout A -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -143,7 +143,7 @@ status open \begin_layout Plain Layout A -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -153,7 +153,7 @@ B \end_inset -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -178,7 +178,7 @@ status open \begin_layout Plain Layout A -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -203,7 +203,7 @@ status open \begin_layout Plain Layout E -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout diff --git a/autotests/export/docbook/index_nesting.lyx b/autotests/export/docbook/index_nesting.lyx index 545244a..dd352cd 100644 --- a/autotests/export/docbook/index_nesting.lyx +++ b/autotests/export/docbook/index_nesting.lyx @@ -112,7 +112,7 @@ status open \begin_layout Plain Layout A -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -137,7 +137,7 @@ status open \begin_layout Plain Layout A -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -147,7 +147,7 @@ B \end_inset -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -172,7 +172,7 @@ status open \begin_layout Plain Layout A -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout @@ -197,7 +197,7 @@ status open \begin_layout Plain Layout E -\begin_inset IndexMacro subindex +\begin_inset IndexMacro subentry status open \begin_layout Plain Layout diff --git a/development/FORMA
[LyX/master] Sync with master
commit b3b22b0c70717d0f44dcb91f559ddc0c3239d30c Author: Juergen Spitzmueller Date: Wed Oct 26 10:52:21 2022 +0200 Sync with master config/qt.m4|2 + development/LyX-Mac-binary-release.sh |3 +- development/autotests/ctests-costs-benefits.txt | 26 +- development/autotests/findadv-01-in.txt |4 + development/autotests/findadv-02-in.txt |4 + development/autotests/findadv-04-in.txt |4 + development/autotests/findadv-12-in.txt |4 + development/autotests/findadv-20-in.txt |3 + development/autotests/findadv-logo-in.txt |4 + development/autotests/findadv-re-04-in.txt |2 + development/autotests/ignoredTests |7 + development/autotests/invertedTests | 13 + development/autotests/keytest.py| 27 +- development/cmake/ConfigureChecks.cmake | 16 +- development/cmake/Install.cmake |4 +- lib/Makefile.am |5 +- lib/RELEASE-NOTES |5 + lib/chkconfig.ltx |5 + lib/configure.py| 95 +- lib/doc/Additional.lyx | 15 +- lib/doc/Customization.lyx | 25 +- lib/doc/EmbeddedObjects.lyx | 19 +- lib/doc/Math.lyx| 44 +- lib/doc/Tutorial.lyx| 39 +- lib/doc/UserGuide.lyx | 600 ++- lib/doc/de/UserGuide.lyx| 16 +- lib/doc/fr/UserGuide.lyx|4 +- lib/examples/Curricula_Vitae/Europe_CV.lyx | 14 +- lib/examples/es/Curricula_Vitae/Europe_CV.lyx | 14 +- lib/generate_contributions.py |2 +- lib/images/icon.aliases |6 + lib/images/lyxfiles-system-folder.svgz | Bin 0 -> 1635 bytes lib/images/lyxfiles-user-folder.svgz| Bin 0 -> 943 bytes lib/images/lyxfiles-user.svgz | Bin 477 -> 775 bytes lib/images/math/style.svgz | Bin 1933 -> 2245 bytes lib/lyx2lyx/lyx2lyx_tools.py|2 +- lib/lyx2lyx/lyx_0_12.py |2 +- lib/lyx2lyx/lyx_1_2.py | 10 +- lib/lyx2lyx/lyx_1_3.py |2 +- lib/lyx2lyx/lyx_1_4.py | 40 +- lib/lyx2lyx/lyx_1_5.py | 24 +- lib/lyx2lyx/lyx_1_6.py | 12 +- lib/lyx2lyx/lyx_2_0.py | 20 +- lib/lyx2lyx/lyx_2_1.py |4 +- lib/lyx2lyx/lyx_2_2.py | 10 +- lib/lyx2lyx/lyx_2_3.py | 10 +- lib/lyx2lyx/lyx_2_4.py | 14 +- lib/lyx2lyx/parser_tools.py | 14 +- lib/scripts/TeXFiles.py |2 +- lib/scripts/fig2pdftex.py |2 +- lib/scripts/layout2layout.py|8 +- lib/scripts/legacy_lyxpreview2ppm.py| 18 +- lib/scripts/lyxpak.py |2 +- lib/scripts/lyxpaperview.py |2 +- lib/scripts/lyxpreview2bitmap.py|4 +- lib/scripts/lyxpreview_tools.py |1 - lib/scripts/prefs2prefs_prefs.py|4 +- lib/ui/stdcontext.inc | 53 +- lib/ui/stdmenus.inc |8 +- lib/ui/stdtoolbars.inc | 21 +- po/de.gmo | Bin 625745 -> 629364 bytes po/de.po| 4607 +++--- po/fr.gmo | Bin 629103 -> 632211 bytes po/fr.po| 4656 +++--- po/it.gmo | Bin 604422 -> 615431 bytes po/it.po| 8027 --- po/messages.mo | Bin 627646 -> 0 bytes po/sk.po| 501 +- src/Buffer.cpp | 20 +- src/Buffer.h|5 + src/BufferParams.cpp| 23 +- src/BufferView.cpp | 25 +- src/BufferView.h|2 + src/Converter.cpp | 15 +- src/Counters.cpp| 10 + src/Counters.h |2 + src/CutAndPaste.cpp | 36 +- src/KeyMap.cpp | 52 +- src/LaTeXFeatures.cpp |7 +- src/LayoutModuleList.cpp
[LyX/master] InsetIndex: revamp IndexEntry to handle both legacy and modern index insets; simplify and adapt the XHTML code.
commit f352a375d93517a994316ed5fac82b1804459f51 Author: Thibaut Cuvelier Date: Mon Apr 25 04:57:42 2022 +0200 InsetIndex: revamp IndexEntry to handle both legacy and modern index insets; simplify and adapt the XHTML code. DocBook comes in another commit, as the modifications are not required to keep the code compilable. A semicolon is no more used between an index term and the places it appears, because some languages need a space before it and others not: this wasn't handled at all. With a dash, this problem disappears. --- autotests/export/docbook/index_light.lyx | 174 autotests/export/docbook/index_nesting.lyx | 229 ++ src/insets/InsetIndex.cpp | 635 +--- src/insets/InsetIndex.h|6 + 4 files changed, 801 insertions(+), 243 deletions(-) diff --git a/autotests/export/docbook/index_light.lyx b/autotests/export/docbook/index_light.lyx new file mode 100644 index 000..ce4dd7e --- /dev/null +++ b/autotests/export/docbook/index_light.lyx @@ -0,0 +1,174 @@ +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 609 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass article +\use_default_options true +\maintain_unincluded_children no +\language american +\language_package default +\inputencoding utf8 +\fontencoding auto +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_microtype false +\use_dash_ligatures true +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\float_placement class +\float_alignment class +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 1 +\use_minted 0 +\use_lineno 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 0 +\math_numbering_side default +\quotes_style english +\dynamic_quotes 0 +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tablestyle default +\tracking_changes false +\output_changes false +\change_bars false +\postpone_fragile_content true +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 +\end_header + +\begin_body + +\begin_layout Title +Index tests +\end_layout + +\begin_layout Standard +Text +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Primary +\end_layout + +\end_inset + + +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Primary +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Secondary +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +Primary +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Secondary +\end_layout + +\end_inset + + +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +Tertiary +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset CommandInset index_print +LatexCommand printindex +type "idx" +name "Index" + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/autotests/export/docbook/index_nesting.lyx b/autotests/export/docbook/index_nesting.lyx new file mode 100644 index 000..545244a --- /dev/null +++ b/autotests/export/docbook/index_nesting.lyx @@ -0,0 +1,229 @@ +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 609 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass article +\use_default_options true +\maintain_unincluded_children no +\language american +\language_package default +\inputencoding utf8 +\fontencoding auto +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_
[LyX/master] Enable pagination property with inset sortkey
commit e39c755b85aa3632c9f57695e3a769379b31e05f Author: Juergen Spitzmueller Date: Sat Oct 29 12:48:45 2022 +0200 Enable pagination property with inset sortkey --- src/insets/InsetIndex.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 94bfa13..dd29579 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -161,6 +161,10 @@ void InsetIndex::latex(otexstream & ios, OutputParams const & runparams_in) cons os << "|"; os << insetindexpagerangetranslator_latex().find(params_.range); getSeeRefs(os, runparams); + } else if (!params_.pagefmt.empty() && params_.pagefmt != "default") { + os << "|"; + os << insetindexpagerangetranslator_latex().find(params_.range); + os << from_utf8(params_.pagefmt); } } else { // We check whether we need a sort key. @@ -429,7 +433,7 @@ void InsetIndex::docbook(XMLStream & xs, OutputParams const & runparams) const xs << XMLStream::ESCAPE_NONE << (from_utf8("\n")); } -// Write all of this down. + // Write all of this down. if (terms.empty() && !hasEndRange) { docstring error = from_utf8("No index term found! Complete entry: \"") + latexString + from_utf8("\""); LYXERR0(error); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] DocBook: add test case for multiple indices
commit 35a752e6db95d53dc81e6f8b5f26a8869c13c641 Author: Thibaut Cuvelier Date: Thu Sep 1 01:11:40 2022 +0200 DocBook: add test case for multiple indices --- autotests/export/docbook/index_multiple.lyx | 248 +++ autotests/export/docbook/index_multiple.xml | 11 ++ src/insets/InsetIndex.cpp |1 + 3 files changed, 260 insertions(+), 0 deletions(-) diff --git a/autotests/export/docbook/index_multiple.lyx b/autotests/export/docbook/index_multiple.lyx new file mode 100644 index 000..66542aa --- /dev/null +++ b/autotests/export/docbook/index_multiple.lyx @@ -0,0 +1,248 @@ +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 609 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass article +\use_default_options true +\maintain_unincluded_children no +\language american +\language_package default +\inputencoding utf8 +\fontencoding auto +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_microtype false +\use_dash_ligatures true +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\float_placement class +\float_alignment class +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices true +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 1 +\use_minted 0 +\use_lineno 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\index Secondary +\shortcut sec +\color #55 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 0 +\math_numbering_side default +\quotes_style english +\dynamic_quotes 0 +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tablestyle default +\tracking_changes false +\output_changes false +\change_bars false +\postpone_fragile_content true +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 +\end_header + +\begin_body + +\begin_layout Title +Multiple indices tests +\end_layout + +\begin_layout Standard +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +A +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Index idx +range none +pageformat default +status open + +\begin_layout Plain Layout +A +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +B +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Index sec +range none +pageformat default +status open + +\begin_layout Plain Layout +A +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +B +\end_layout + +\end_inset + + +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +C +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Index sec +range none +pageformat default +status open + +\begin_layout Plain Layout +A +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +D +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Index sec +range none +pageformat default +status open + +\begin_layout Plain Layout +E +\begin_inset IndexMacro subindex +status open + +\begin_layout Plain Layout +F +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset index_print +LatexCommand printindex +type "idx" +name "Index" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset index_print +LatexCommand printindex +type "sec" +name "Index" +literal "false" + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/autotests/export/docbook/index_multiple.xml b/autotests/export/docbook/index_multiple.xml new file mode 100644 index 000..dcc60ec --- /dev/null +++ b/autotests/export/docbook/index_multiple.xml @@ -0,0 +1,11 @@ + + +http://docbook.org/ns/docbook"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:m="http://www.w3.org/1998/Math/MathML"; xmlns:xi="http://www.w3.org/2001/XInclude"; version="5.2"> +Multiple indices tests +A +AB +ABC +AD +EF +
[LyX/master] Merge branch 'features/indexmacros'
commit 4e50da3e655b9f8d26f7d5e439d72b219d32279d Merge: 0df63e3 f4d588c Author: Juergen Spitzmueller Date: Mon Oct 31 19:32:52 2022 +0100 Merge branch 'features/indexmacros' autotests/export/docbook/index.lyx | 145 ++- autotests/export/docbook/index.xml |2 + autotests/export/docbook/index_light.lyx| 174 ++ autotests/export/docbook/index_multiple.lyx | 248 +++ autotests/export/docbook/index_multiple.xml | 11 + autotests/export/docbook/index_nesting.lyx | 229 +++ autotests/export/docbook/index_nesting.xml | 11 + development/FORMAT | 14 + lib/doc/UserGuide.lyx | 2388 ++- lib/layouts/stdinsets.inc | 30 + lib/lyx2lyx/lyx_2_4.py | 125 ++- lib/ui/stdcontext.inc | 17 + lib/ui/stdmenus.inc |8 + src/FuncCode.h |2 + src/LyXAction.cpp | 10 + src/Makefile.am |1 + src/Text3.cpp | 10 + src/factory.cpp | 14 + src/frontends/qt/GuiIndex.cpp | 51 +- src/frontends/qt/GuiIndex.h |1 + src/frontends/qt/ui/IndexUi.ui | 141 ++- src/insets/InsetCode.h |4 + src/insets/InsetCommandParams.cpp | 20 +- src/insets/InsetCommandParams.h |4 + src/insets/InsetIndex.cpp | 1367 src/insets/InsetIndex.h | 49 +- src/insets/InsetIndexMacro.cpp | 384 + src/insets/InsetIndexMacro.h| 125 ++ src/insets/InsetText.cpp|4 + src/tex2lyx/Parser.cpp | 60 +- src/tex2lyx/Parser.h| 12 +- src/tex2lyx/tex2lyx.h |6 +- src/tex2lyx/text.cpp| 236 +++- src/version.h |4 +- 34 files changed, 5414 insertions(+), 493 deletions(-) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] format change stub (to be updated before merge)
commit 43365d2bbdac6578f4dda6a1093765af12d71162 Author: Juergen Spitzmueller Date: Sat Oct 29 12:51:17 2022 +0200 format change stub (to be updated before merge) --- development/FORMAT | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index dd95edf..430f3a2 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,20 @@ changes happened in particular if possible. A good example would be --- +2022-10-29 Jürgen Spitzmüller + * Format incremented to 610: InsetIndexMacros and new IndexInset params: + - \begin_inset IndexMacro [see|seealso|subindex|sortkey], relating to + \index{...|see{content}} -- see + \index{...|seealso{content}} -- seealso + \index{...!subindex} -- subindex + \index{sortkey@...} -- sortkey + see and see also are mutually exclusive + - \begin_inset Index +range start -- \index{...|(} +range end -- \index{...|)} +pageformat cmd -- \index{...|cmd} + pageformat and see[also] are mutually exclusive. + 2022-02-11 Jürgen Spitzmüller * Format incremented to 609: \\begin_metadata ... \\end_metadata buffer param. This takes a list of keyvals for the new \\DocumentMetadata command -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Add last missing bit to insetindexmacros: file format change and lyx2lyx
commit 874f559bc78f1572a3daeeea375f7b4be376bbdd Author: Juergen Spitzmueller Date: Sat Oct 29 15:11:11 2022 +0200 Add last missing bit to insetindexmacros: file format change and lyx2lyx The feature is now ready for primetime! --- lib/lyx2lyx/lyx_2_4.py | 118 +++- src/version.h |4 +- 2 files changed, 118 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 7d5d7a8..f98dd5c 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -4414,6 +4414,7 @@ def revert_docbook_mathml_prefix(document): return del document.header[i] + def revert_document_metadata(document): """Revert document metadata""" i = 0 @@ -4427,6 +4428,117 @@ def revert_document_metadata(document): break document.header[i : j + 1] = [] + +def revert_index_macros(document): +" Revert inset index macros " + +i = 0 +while True: +i = find_token(document.body, '\\begin_inset Index', i+1) +if i == -1: +break +j = find_end_of_inset(document.body, i) +if j == -1: +document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i) +continue +pl = find_token(document.body, '\\begin_layout Plain Layout', i, j) +if pl == -1: +document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i) +continue +# find, store and remove params +pr = find_token(document.body, 'range', i, pl) +prval = get_quoted_value(document.body, "range", pr) +pagerange = "" +if prval == "start": +pagerange = "(" +elif prval == "end": +pagerange = ")" +pf = find_token(document.body, 'pageformat', i, pl) +pageformat = get_quoted_value(document.body, "pageformat", pf) +del document.body[pr:pf+1] +j = find_end_of_inset(document.body, i) +if j == -1: +document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i) +continue +imacros = ["seealso", "see", "subindex", "subindex", "sortkey"] +see = [] +seealso = [] +subindex = [] +subindex2 = [] +sortkey = [] +for imacro in imacros: +iim = find_token(document.body, "\\begin_inset IndexMacro %s" % imacro, i, j) +if iim == -1: +continue +iime = find_end_of_inset(document.body, iim) +if iime == -1: +document.warning("Malformed LyX document: Can't find end of index macro inset at line %d" % i) +continue +iimpl = find_token(document.body, '\\begin_layout Plain Layout', iim, iime) +if iimpl == -1: +document.warning("Malformed LyX document: Can't find plain layout in index macro inset at line %d" % i) +continue +iimple = find_end_of_layout(document.body, iimpl) +if iimple == -1: +document.warning("Malformed LyX document: Can't find end of index macro inset plain layout at line %d" % i) +continue +icont = document.body[iimpl:iimple] +if imacro == "see": +see = icont[1:] +elif imacro == "seealso": +seealso = icont[1:] +elif imacro == "subindex": +# subindexes might hace their own sortkey! +xiim = find_token(document.body, "\\begin_inset IndexMacro sortkey", iimpl, iimple) +if xiim != -1: +xiime = find_end_of_inset(document.body, xiim) +if xiime == -1: +document.warning("Malformed LyX document: Can't find end of index macro inset at line %d" % i) +else: +xiimpl = find_token(document.body, '\\begin_layout Plain Layout', xiim, xiime) +if xiimpl == -1: +document.warning("Malformed LyX document: Can't find plain layout in index macro inset at line %d" % i) +else: +xiimple = find_end_of_layout(document.body, xiimpl) +if xiimple == -1: +document.warning("Malformed LyX document: Can't find end of index macro inset plain layout at line %d" % i) +else: +xicont = document.body[xiimpl:xiimple] +xxicont = document.body[iimpl:xiimpl] + document.body[xiimple+1:iimple] +icont = xicont + put_cmd_in_ert("@") + xxicont[1:] +if len(subindex) > 0: +subindex2 = icont[1:] +else: +subindex = icont
[LyX/master] Add some comments
commit 5a7c6aaeeeffb28f4ec45c1a5546c5ca3e2fb97a Author: Juergen Spitzmueller Date: Sat Oct 29 15:40:06 2022 +0200 Add some comments --- lib/lyx2lyx/lyx_2_4.py | 17 - 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index f98dd5c..62aeb76 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -4445,7 +4445,7 @@ def revert_index_macros(document): if pl == -1: document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i) continue -# find, store and remove params +# find, store and remove inset params pr = find_token(document.body, 'range', i, pl) prval = get_quoted_value(document.body, "range", pr) pagerange = "" @@ -4456,16 +4456,20 @@ def revert_index_macros(document): pf = find_token(document.body, 'pageformat', i, pl) pageformat = get_quoted_value(document.body, "pageformat", pf) del document.body[pr:pf+1] +# Now re-find (potentially moved) inset end again, and search for subinsets j = find_end_of_inset(document.body, i) if j == -1: document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i) continue -imacros = ["seealso", "see", "subindex", "subindex", "sortkey"] +# We search for all possible subindexes in turn, store their +# content and delete them see = [] seealso = [] subindex = [] subindex2 = [] sortkey = [] +# Two subindexes are allowed, thus the duplication +imacros = ["seealso", "see", "subindex", "subindex", "sortkey"] for imacro in imacros: iim = find_token(document.body, "\\begin_inset IndexMacro %s" % imacro, i, j) if iim == -1: @@ -4483,10 +4487,10 @@ def revert_index_macros(document): document.warning("Malformed LyX document: Can't find end of index macro inset plain layout at line %d" % i) continue icont = document.body[iimpl:iimple] -if imacro == "see": -see = icont[1:] -elif imacro == "seealso": +if imacro == "seealso": seealso = icont[1:] +elif imacro == "see": +see = icont[1:] elif imacro == "subindex": # subindexes might hace their own sortkey! xiim = find_token(document.body, "\\begin_inset IndexMacro sortkey", iimpl, iimple) @@ -4512,11 +4516,14 @@ def revert_index_macros(document): subindex = icont[1:] elif imacro == "sortkey": sortkey = icont +# Everything stored. Delete subinset. del document.body[iim:iime+1] +# Again re-find (potentially moved) index inset end j = find_end_of_inset(document.body, i) if j == -1: document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i) continue +# Now insert all stuff, starting from the inset end pl = find_token(document.body, '\\begin_layout Plain Layout', i, j) if pl == -1: document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Typo
commit ca89c6c18ebad780a888b6f50ae12cf4eb99b677 Author: Juergen Spitzmueller Date: Mon Oct 31 07:52:11 2022 +0100 Typo --- src/insets/InsetIndex.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 2234d9d..0a14372 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -582,7 +582,7 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_PARAGRAPH_BREAK: { // Since this inset in single-par anyway, let's use - // return to enter subentryes + // return to enter subentries FuncRequest fr(LFUN_INDEXMACRO_INSERT, "subentry"); lyx::dispatch(fr); break; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update tex2lyx tests
commit 3c488c22e1d86da021750e04b0c8e85a8d8630ab Author: Juergen Spitzmueller Date: Mon Oct 31 21:11:07 2022 +0100 Update tex2lyx tests --- src/tex2lyx/test/CJK.lyx.lyx |2 +- src/tex2lyx/test/CJKutf8.lyx.lyx |2 +- src/tex2lyx/test/DummyDocument.lyx.lyx |2 +- src/tex2lyx/test/Dummy~Document.lyx.lyx|2 +- src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx |2 +- src/tex2lyx/test/algo2e.lyx.lyx|2 +- src/tex2lyx/test/beamer.lyx.lyx|2 +- .../test/box-color-size-space-align.lyx.lyx|2 +- src/tex2lyx/test/listpreamble.lyx.lyx |2 +- src/tex2lyx/test/tabular-x-test.lyx.lyx|2 +- src/tex2lyx/test/test-insets-basic.lyx.lyx | 26 +++- src/tex2lyx/test/test-insets.lyx.lyx | 26 +++- src/tex2lyx/test/test-memoir.lyx.lyx |2 +- src/tex2lyx/test/test-minted.lyx.lyx |2 +- src/tex2lyx/test/test-modules.lyx.lyx |2 +- src/tex2lyx/test/test-refstyle-theorems.lyx.lyx|2 +- src/tex2lyx/test/test-scr.lyx.lyx |2 +- src/tex2lyx/test/test-structure.lyx.lyx|2 +- src/tex2lyx/test/test.lyx.lyx |2 +- src/tex2lyx/test/verbatim.lyx.lyx |2 +- 20 files changed, 68 insertions(+), 20 deletions(-) diff --git a/src/tex2lyx/test/CJK.lyx.lyx b/src/tex2lyx/test/CJK.lyx.lyx index 6addbc4..0eb44aa 100644 --- a/src/tex2lyx/test/CJK.lyx.lyx +++ b/src/tex2lyx/test/CJK.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/CJKutf8.lyx.lyx b/src/tex2lyx/test/CJKutf8.lyx.lyx index 585d14a..3d29580 100644 --- a/src/tex2lyx/test/CJKutf8.lyx.lyx +++ b/src/tex2lyx/test/CJKutf8.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/DummyDocument.lyx.lyx b/src/tex2lyx/test/DummyDocument.lyx.lyx index b5fb085..98d26f1 100644 --- a/src/tex2lyx/test/DummyDocument.lyx.lyx +++ b/src/tex2lyx/test/DummyDocument.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/Dummy~Document.lyx.lyx b/src/tex2lyx/test/Dummy~Document.lyx.lyx index 872addf..48c2312 100644 --- a/src/tex2lyx/test/Dummy~Document.lyx.lyx +++ b/src/tex2lyx/test/Dummy~Document.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx index 47b8e32..92b804d 100644 --- a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx +++ b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/algo2e.lyx.lyx b/src/tex2lyx/test/algo2e.lyx.lyx index 756fa0b..ca17963 100644 --- a/src/tex2lyx/test/algo2e.lyx.lyx +++ b/src/tex2lyx/test/algo2e.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/beamer.lyx.lyx b/src/tex2lyx/test/beamer.lyx.lyx index 5b00841..16b8bdf 100644 --- a/src/tex2lyx/test/beamer.lyx.lyx +++ b/src/tex2lyx/test/beamer.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx index 28ea2b5..cf0c0cb 100644 --- a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx +++ b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/listpreamble.lyx.lyx b/src/tex2lyx/test/listpreamble.lyx.lyx index a0fc0b0..2a25975 100644 --- a/src/tex2lyx/test/listpreamble.lyx.lyx +++ b/src/tex2lyx/test/listpreamble.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/tabular-x-test.lyx.lyx b/src/tex2lyx/test/tabular-x-test.lyx.lyx index b3f4c54..1b267ee 100644 --- a/src/tex2lyx/test/tabular-x-test.lyx.lyx +++ b/src/tex2lyx/test/tabular-x-test.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 609 +\lyxformat 610 \begin_document \begin_head
[LyX/master] Update sk.po
commit 6f7b39f84299660586b0485713d9672279ebe226 Author: Kornel Benko Date: Mon Oct 31 22:57:02 2022 +0100 Update sk.po --- po/sk.po | 164 ++ 1 files changed, 143 insertions(+), 21 deletions(-) diff --git a/po/sk.po b/po/sk.po index 2669afc..beabf5c 100644 --- a/po/sk.po +++ b/po/sk.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: LyX-2.4\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" -"POT-Creation-Date: 2022-10-29 11:26+0200\n" -"PO-Revision-Date: 2022-10-29 09:42+\n" +"POT-Creation-Date: 2022-10-31 21:54+0100\n" +"PO-Revision-Date: 2022-10-31 21:53+\n" "Last-Translator: Kornel Benko \n" "Language-Team: Slovak \n" "Language: sk\n" @@ -2347,6 +2347,27 @@ msgstr "Doslovne (Verbatim)" msgid "Program Listing" msgstr "Výpis zdrojového kódu" +#: src/insets/InsetIndex.cpp:85 +msgid "Starts page range" +msgstr "Začína rozsah strán" + +#: src/insets/InsetIndex.cpp:86 +msgid "Ends page range" +msgstr "Končí rozsah strán" + +#: src/insets/InsetIndex.cpp:289 +#, c-format +msgid "" +"LyX's automatic index sorting algorithm faced problems with the entry " +"'%1$s'.\n" +"Please specify the sorting of this entry manually, as explained in the User " +"Guide." +msgstr "" +"Algoritmus pre automatické triedenie algoritmov narazil na problém\n" +"so záznamom '%1$s'.\n" +"Prosím nastavte triedenie tohto záznamu ručne, ako\n" +"vysvetlené v užívateľskej príručke." + #: src/frontends/qt/ui/IncludeUi.ui:69 msgid "Edit the file" msgstr "Upraviť súbor" @@ -2413,14 +2434,27 @@ msgstr "" "Podaj obsah poľa `Popis' priamo pre LaTeX. Označte toto keď chcete vložiť " "LaTeX kód." -#: src/frontends/qt/ui/IndexUi.ui:40 -msgid "Available I&ndexes:" -msgstr "Do&stupné registre:" +#: src/frontends/qt/ui/IndexUi.ui:23 +msgid "Available I&ndexes" +msgstr "Dostupné r&egistre" #: src/frontends/qt/ui/IndexUi.ui:50 msgid "Select the index this entry should be listed in." msgstr "Vyberte register v ktorom by toto heslo malo byť uvedené." +#: src/frontends/qt/ui/IndexUi.ui:52 +msgid "&Pagination" +msgstr "&Stránkovanie" + +#: src/frontends/qt/ui/IndexUi.ui:58 +msgid "Page &Range:" +msgstr "&Rozsah strán:" + +#: src/frontends/qt/ui/IndexUi.ui:68 +msgid "If the entry spans multiple pages, you can start or end the range here" +msgstr "" +"Keď je záznam dlhší ako jedna strana, môže tu rozsah začať alebo končiť" + #: src/frontends/qt/ui/IndicesUi.ui:19 msgid "" "Here you can define an alternative index processor and specify its options." @@ -3553,6 +3587,18 @@ msgstr "Formát stránky" msgid "&Format:" msgstr "&Formát:" +#: src/frontends/qt/ui/IndexUi.ui:98 +msgid "" +"Customize the format of the page number here. Note that the format is not " +"used with \"See\" and \"See also\" references." +msgstr "" +"Upraviť formát číslovania strán tu. Všimnite si, že formát nie je použitý s " +"referenciami \"Viď\" či \"Viď tiež\"." + +#: src/frontends/qt/ui/IndexUi.ui:105 +msgid "Enter custom command here (without leading backslash)." +msgstr "Vložte sem vlastný rozkaz (bez začínajúcej šikmej čiary)." + #: src/frontends/qt/ui/PageLayoutUi.ui:45 msgid "Choose a particular paper size, or set your own with \"Custom\"" msgstr "" @@ -10124,10 +10170,10 @@ msgstr "Výška" msgid "The height of the overlay area" msgstr "Výška plochy prekrytia" -#: lib/layouts/beamer.layout:854 lib/layouts/beamer.layout:1563 -#: lib/layouts/beamer.layout:1565 lib/layouts/powerdot.layout:660 +#: lib/layouts/beamer.layout:856 lib/layouts/beamer.layout:1565 +#: lib/layouts/beamer.layout:1567 lib/layouts/powerdot.layout:660 msgid "Uncover" -msgstr "Odhalenie" +msgstr "Odhaliť" #: lib/layouts/beamer.layout:864 msgid "Uncovered on slides" @@ -12327,6 +12373,10 @@ msgstr "Päta jazyka:" msgid "End" msgstr "Koniec" +#: src/frontends/qt/GuiIndex.cpp:49 +msgid "Emphasized" +msgstr "Zdôraznenie" + #: lib/layouts/europasscv.layout:546 lib/layouts/europecv.layout:387 msgid "End of CV" msgstr "Koniec CV" @@ -20204,6 +20254,30 @@ msgstr "Pridať neznámu vetvu|P" msgid "Insert Reference at Cursor Position|I" msgstr "Vložiť referenciu na pozícii kurzoru|V" +#: lib/ui/stdcontext.inc:636 +msgid "Insert Subentry|b" +msgstr "Vložiť pod-záznam|d" + +#: lib/ui/stdcontext.inc:637 +msgid "Insert Sortkey|k" +msgstr "Vložiť triediaci kľúč|k" + +#: lib/ui/stdcontext.inc:638 +msgid "Insert See Reference|e" +msgstr "Vložiť \"Viď\" referenciu|V" + +#: lib/ui/stdcontext.inc:639 +msgid "Insert See also Reference|a" +msgstr "Vložiť \"Viď tiež\" referenciu|t" + +#: lib/ui/stdcontext.inc:647 lib/ui/stdmenus.inc:539 +msgid "See|e" +msgstr "Viď|V" + +#: lib/ui/stdcontext.inc:648 lib/ui/stdmenus.inc:540 +msgid "See also|a" +msgstr "Viď tiež|t" + #: lib/ui/stdcontext.inc:620 msgid "All Indexes|A" msgstr "Všetky registre|V" @@ -20929,6 +21003,10 @@ msgid "Label...|L" msgstr "Referenčná značka…|z" #: lib/ui/stdmenus.inc:394 +msgid "Index Properties" +msgstr "Vlastnosti registru" + +
[LyX/master] InsetIndex: hide printTree behind a LYX_INSET_INDEX_DEBUG flag
commit 3bf1b97ae547aea5d0243e41b2d8af463a6e40c5 Author: Thibaut Cuvelier Date: Mon Oct 31 23:57:41 2022 +0100 InsetIndex: hide printTree behind a LYX_INSET_INDEX_DEBUG flag The change ensures that the function is not seen by the compiler when the debug mode is not enabled. The flag is not set by default, because it might have a significant performance impact for large indices. The reason for the flag is that the default configuration under Linux forbids the definition of unused functions. --- src/insets/InsetIndex.cpp |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 0a14372..13a7b4d 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -55,6 +55,9 @@ using namespace std; using namespace lyx::support; +// Uncomment to enable InsetIndex-specific debugging mode: the tree for the index will be printed to std::cout. +// #define LYX_INSET_INDEX_DEBUG + namespace lyx { namespace { @@ -1687,7 +1690,7 @@ void outputIndexPage(XMLStream & xs, const IndexNode* root_node, unsigned depth xs << xml::CR(); } -// Only useful for debugging. +#ifdef LYX_INSET_INDEX_DEBUG void printTree(const IndexNode* root_node, unsigned depth = 0) { static const std::string pattern = ""; @@ -1722,6 +1725,7 @@ void printTree(const IndexNode* root_node, unsigned depth = 0) printTree(node, depth + 1); } } +#endif // LYX_INSET_INDEX_DEBUG } @@ -1747,7 +1751,7 @@ docstring InsetPrintIndex::xhtml(XMLStream &, OutputParams const & op) const return docstring(); const IndexNode* index_root = buildIndexTree(entries); -#if 0 +#ifdef LYX_INSET_INDEX_DEBUG printTree(index_root); #endif -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs