Rename subindex to subentry

Makes more sense, and distinguishes it better from printsubindex
This commit is contained in:
Juergen Spitzmueller 2022-10-31 06:51:38 +01:00
parent fba3dace9e
commit 077ccf905d
15 changed files with 57 additions and 57 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -9,10 +9,10 @@ changes happened in particular if possible. A good example would be
2022-10-29 Jürgen Spitzmüller <spitz@lyx.org>
* 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

View File

@ -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

View File

@ -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("@")

View File

@ -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"

View File

@ -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"

View File

@ -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 <type>
* \li Params: <type>: see, seealso, subindex, sortkey.
* \li Params: <type>: see, seealso, subentry, sortkey.
* \li Origin: spitz, 20 Feb 2022
* \endvar
*/

View File

@ -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);

View File

@ -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<InsetIndexMacro const &>(inset);
if (iim.params().type == InsetIndexMacroParams::Subindex) {
if (iim.params().type == InsetIndexMacroParams::Subentry) {
++i;
if (i > 2)
return;
@ -700,7 +700,7 @@ std::vector<docstring> InsetIndex::getSubentriesAsText(OutputParams const & runp
if (inset.lyxCode() == INDEXMACRO_CODE) {
InsetIndexMacro const & iim =
static_cast<InsetIndexMacro const &>(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;

View File

@ -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);

View File

@ -27,7 +27,7 @@ public:
enum Type {
See,
Seealso,
Subindex,
Subentry,
Sortkey
};
///

View File

@ -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