From: Juergen Spitzmueller Date: Mon, 31 Oct 2022 05:51:38 +0000 (+0100) Subject: Rename subindex to subentry X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=077ccf905dfaa5dac0c5e77a54b15c6980d45b09;p=features.git Rename subindex to subentry Makes more sense, and distinguishes it better from printsubindex --- diff --git a/autotests/export/docbook/index.lyx b/autotests/export/docbook/index.lyx index 18398c7e2b..4a0eb07b04 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 ce4dd7ec8a..368af82193 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 66542aaf15..5e4fcddd38 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 545244aa4d..dd352cd0c6 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/FORMAT b/development/FORMAT index 430f3a20f3..0c41d8801c 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -9,10 +9,10 @@ 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 + - \begin_inset IndexMacro [see|seealso|subentry|sortkey], relating to \index{...|see{content}} -- see \index{...|seealso{content}} -- seealso - \index{...!subindex} -- subindex + \index{...!subentry} -- subentry \index{sortkey@...} -- sortkey see and see also are mutually exclusive - \begin_inset Index diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index 4063c630d7..614aa1df9b 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -456,9 +456,9 @@ InsetLayout IndexMacro:sortkey LabelString "Sort as" End -InsetLayout IndexMacro:subindex +InsetLayout IndexMacro:subentry CopyStyle IndexMacro:see - LabelString "Subindex" + LabelString "Subentry" End InsetLayout Box diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 62aeb7607e..e4fe3f97ac 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -4461,15 +4461,15 @@ def revert_index_macros(document): if j == -1: document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i) continue - # We search for all possible subindexes in turn, store their + # We search for all possible subentries in turn, store their # content and delete them see = [] seealso = [] - subindex = [] - subindex2 = [] + subentry = [] + subentry2 = [] sortkey = [] - # Two subindexes are allowed, thus the duplication - imacros = ["seealso", "see", "subindex", "subindex", "sortkey"] + # Two subentries are allowed, thus the duplication + imacros = ["seealso", "see", "subentry", "subentry", "sortkey"] for imacro in imacros: iim = find_token(document.body, "\\begin_inset IndexMacro %s" % imacro, i, j) if iim == -1: @@ -4491,8 +4491,8 @@ def revert_index_macros(document): seealso = icont[1:] elif imacro == "see": see = icont[1:] - elif imacro == "subindex": - # subindexes might hace their own sortkey! + elif imacro == "subentry": + # subentries 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) @@ -4510,10 +4510,10 @@ def revert_index_macros(document): 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:] + if len(subentry) > 0: + subentry2 = icont[1:] else: - subindex = icont[1:] + subentry = icont[1:] elif imacro == "sortkey": sortkey = icont # Everything stored. Delete subinset. @@ -4538,10 +4538,10 @@ def revert_index_macros(document): document.body[ple:ple] = put_cmd_in_ert("|" + pagerange + "seealso{") + seealso + put_cmd_in_ert("}") elif pageformat != "default": document.body[ple:ple] = put_cmd_in_ert("|" + pagerange + pageformat) - if len(subindex2) > 0: - document.body[ple:ple] = put_cmd_in_ert("!") + subindex2 - if len(subindex) > 0: - document.body[ple:ple] = put_cmd_in_ert("!") + subindex + if len(subentry2) > 0: + document.body[ple:ple] = put_cmd_in_ert("!") + subentry2 + if len(subentry) > 0: + document.body[ple:ple] = put_cmd_in_ert("!") + subentry if len(sortkey) > 0: document.body[pl:pl+1] = document.body[pl:pl] + sortkey + put_cmd_in_ert("@") diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index b230cdd3f0..d073006eb7 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -633,7 +633,7 @@ Menuset End Menu "context-edit-index" - OptItem "Insert Subentry|b" "indexmacro-insert subindex" + OptItem "Insert Subentry|b" "indexmacro-insert subentry" OptItem "Insert Sortkey|k" "indexmacro-insert sortkey" OptItem "Insert See Reference|e" "indexmacro-insert see" OptItem "Insert See also Reference|a" "indexmacro-insert seealso" diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc index 46287be100..301cdac8d7 100644 --- a/lib/ui/stdmenus.inc +++ b/lib/ui/stdmenus.inc @@ -534,7 +534,7 @@ Menuset End Menu "index_properties" - OptItem "Subentry|b" "indexmacro-insert subindex" + OptItem "Subentry|b" "indexmacro-insert subentry" OptItem "Sortkey|k" "indexmacro-insert sortkey" OptItem "See|e" "indexmacro-insert see" OptItem "See also|a" "indexmacro-insert seealso" diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 0e9a79c119..742c613206 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -2311,7 +2311,7 @@ void LyXAction::init() * \var lyx::FuncCode lyx::LFUN_INDEXMACRO_INSERT * \li Action: Inserts special Index macros into the document. * \li Syntax: indexmacro-insert - * \li Params: : see, seealso, subindex, sortkey. + * \li Params: : see, seealso, subentry, sortkey. * \li Origin: spitz, 20 Feb 2022 * \endvar */ diff --git a/src/factory.cpp b/src/factory.cpp index 4ab74dad4c..a465a55e86 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -163,8 +163,8 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd) case LFUN_INDEXMACRO_INSERT: { string const arg = cmd.getArg(0); if (arg != "see" && arg != "seealso" - && arg != "subindex" && arg != "sortkey") { - LYXERR0("LFUN_IPAMACRO_INSERT: wrong argument"); + && arg != "subentry" && arg != "sortkey") { + LYXERR0("LFUN_INDEXMACRO_INSERT: wrong argument"); return nullptr; } return new InsetIndexMacro(buf, arg); diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 5f4cb7e93f..2234d9da15 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -582,8 +582,8 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_PARAGRAPH_BREAK: { // Since this inset in single-par anyway, let's use - // return to enter subindexes - FuncRequest fr(LFUN_INDEXMACRO_INSERT, "subindex"); + // return to enter subentryes + FuncRequest fr(LFUN_INDEXMACRO_INSERT, "subentry"); lyx::dispatch(fr); break; } @@ -620,7 +620,7 @@ bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd, } case LFUN_PARAGRAPH_BREAK: - return macrosPossible("subindex"); + return macrosPossible("subentry"); case LFUN_INDEXMACRO_INSERT: return macrosPossible(cmd.getArg(0)); @@ -675,7 +675,7 @@ void InsetIndex::getSubentries(otexstream & os, OutputParams const & runparams) if (inset.lyxCode() == INDEXMACRO_CODE) { InsetIndexMacro const & iim = static_cast(inset); - if (iim.params().type == InsetIndexMacroParams::Subindex) { + if (iim.params().type == InsetIndexMacroParams::Subentry) { ++i; if (i > 2) return; @@ -700,7 +700,7 @@ std::vector InsetIndex::getSubentriesAsText(OutputParams const & runp if (inset.lyxCode() == INDEXMACRO_CODE) { InsetIndexMacro const & iim = static_cast(inset); - if (iim.params().type == InsetIndexMacroParams::Subindex) { + if (iim.params().type == InsetIndexMacroParams::Subentry) { ++i; if (i > 2) break; @@ -819,7 +819,7 @@ bool hasInsetWithCode(const InsetIndex * const inset_index, const InsetCode code bool InsetIndex::hasSubentries() const { - return hasInsetWithCode(this, INDEXMACRO_CODE, {InsetIndexMacroParams::Subindex}); + return hasInsetWithCode(this, INDEXMACRO_CODE, {InsetIndexMacroParams::Subentry}); } @@ -838,7 +838,7 @@ bool InsetIndex::hasSortKey() const bool InsetIndex::macrosPossible(string const type) const { if (type != "see" && type != "seealso" - && type != "sortkey" && type != "subindex") + && type != "sortkey" && type != "subentry") return false; Paragraph const & par = paragraphs().front(); @@ -854,8 +854,8 @@ bool InsetIndex::macrosPossible(string const type) const && (iim.params().type == InsetIndexMacroParams::See || iim.params().type == InsetIndexMacroParams::Seealso)) return false; - if (type == "subindex" - && iim.params().type == InsetIndexMacroParams::Subindex) { + if (type == "subentry" + && iim.params().type == InsetIndexMacroParams::Subentry) { ++subidxs; if (subidxs > 1) return false; diff --git a/src/insets/InsetIndexMacro.cpp b/src/insets/InsetIndexMacro.cpp index 2bfbc9176a..31754308f8 100644 --- a/src/insets/InsetIndexMacro.cpp +++ b/src/insets/InsetIndexMacro.cpp @@ -52,7 +52,7 @@ InsetIndexMacroTranslator const init_insetindexmacrotranslator() { InsetIndexMacroTranslator translator("see", InsetIndexMacroParams::See); translator.addPair("seealso", InsetIndexMacroParams::Seealso); - translator.addPair("subindex", InsetIndexMacroParams::Subindex); + translator.addPair("subentry", InsetIndexMacroParams::Subentry); translator.addPair("sortkey", InsetIndexMacroParams::Sortkey); return translator; } @@ -62,7 +62,7 @@ InsetIndexMacroTranslatorLoc const init_insetindexmacrotranslator_loc() { InsetIndexMacroTranslatorLoc translator(_("See"), InsetIndexMacroParams::See); translator.addPair(_("See also"), InsetIndexMacroParams::Seealso); - translator.addPair(_("Subindex"), InsetIndexMacroParams::Subindex); + translator.addPair(_("Subentry"), InsetIndexMacroParams::Subentry); translator.addPair(_("Sort as"), InsetIndexMacroParams::Sortkey); return translator; } @@ -155,7 +155,7 @@ void InsetIndexMacro::read(Lexer & lex) void InsetIndexMacro::getLatex(otexstream & os, OutputParams const & runparams) const { - if (params_.type == InsetIndexMacroParams::Subindex) { + if (params_.type == InsetIndexMacroParams::Subentry) { if (hasSortKey()) { getSortkey(os, runparams); os << "@"; @@ -374,7 +374,7 @@ bool InsetIndexMacro::insetAllowed(InsetCode code) const case INDEX_CODE: return false; case INDEXMACRO_SORTKEY_CODE: - return (params_.type == InsetIndexMacroParams::Subindex + return (params_.type == InsetIndexMacroParams::Subentry && !hasSortKey()); default: return InsetCollapsible::insetAllowed(code); diff --git a/src/insets/InsetIndexMacro.h b/src/insets/InsetIndexMacro.h index 4122621ea0..3d56e399de 100644 --- a/src/insets/InsetIndexMacro.h +++ b/src/insets/InsetIndexMacro.h @@ -27,7 +27,7 @@ public: enum Type { See, Seealso, - Subindex, + Subentry, Sortkey }; /// diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index b661e6fc85..e11d0a5bec 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1563,7 +1563,7 @@ void parse_index_entry(Parser & p, ostream & os, Context & context, string const p.get_token(); os << "\\begin_layout Plain Layout\n"; } else { - begin_inset(os, "IndexMacro subindex"); + begin_inset(os, "IndexMacro subentry"); os << "\nstatus collapsed\n"; } // Check for (level-specific) sortkey @@ -1583,7 +1583,7 @@ void parse_index_entry(Parser & p, ostream & os, Context & context, string const main = false; } if (!main) { - begin_inset(os, "IndexMacro subindex"); + begin_inset(os, "IndexMacro subentry"); os << "\nstatus collapsed\n"; } // Final level @@ -1626,7 +1626,7 @@ void parse_index_entry(Parser & p, ostream & os, Context & context, string const os << "\n\\end_layout\n"; } else { if (post.empty() && !startrange && !endrange) { - parse_text_in_inset(p, os, FLAG_BRACE_LAST, false, context, "IndexMacro subindex"); + parse_text_in_inset(p, os, FLAG_BRACE_LAST, false, context, "IndexMacro subentry"); p.dropPosition(); } else { // Handle post-argument