summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-03-30 19:32:00 +0000
committerSimon Tatham <anakin@pobox.com>2004-03-30 19:32:00 +0000
commit4265ea15b41a4f1ff299932ff55797c7b7641e7f (patch)
tree1979e93daea1fe88128921030df9dd054fab7337
parentc1469440142291402d5a77a4613c07f841bb3157 (diff)
downloadhalibut-4265ea15b41a4f1ff299932ff55797c7b7641e7f.zip
halibut-4265ea15b41a4f1ff299932ff55797c7b7641e7f.tar.gz
halibut-4265ea15b41a4f1ff299932ff55797c7b7641e7f.tar.bz2
halibut-4265ea15b41a4f1ff299932ff55797c7b7641e7f.tar.xz
I always meant to remove emphasis in the index by default. Now I do
so. It's restorable using \IM. [originally from svn r4000]
-rw-r--r--doc/input.but5
-rw-r--r--index.c18
2 files changed, 23 insertions, 0 deletions
diff --git a/doc/input.but b/doc/input.but
index 05d18b5..ca66df5 100644
--- a/doc/input.but
+++ b/doc/input.but
@@ -1059,6 +1059,11 @@ still want it to look like code in the index, whereas most people
indexing an emphasised word will \e{not} want it emphasised in the
index.
+(In fact, \e{no} emphasis in the text inside \c{\\i} will be
+preserved in the index. If you really want a term in the index to
+appear emphasised, you must say so explicitly using \c{\\IM}; see
+\k{input-index-rewrite}.)
+
Sometimes you might want to index a term which is not explicitly
mentioned, but which is highly relevant to the text and you think
that somebody looking up that term in the index might find it useful
diff --git a/index.c b/index.c
index 3b1df51..c312f07 100644
--- a/index.c
+++ b/index.c
@@ -61,6 +61,24 @@ void index_merge(indexdata *idx, int is_explicit, wchar_t *tags, word *text) {
indextag *t, *existing;
/*
+ * For an implicit merge, we want to remove all emphasis,
+ * because the chances are that the user didn't really want to
+ * index the term as emphasised.
+ */
+ {
+ word *w;
+
+ for (w = text; w; w = w->next) {
+ if (w->type == word_Emph)
+ w->type = word_Normal;
+ else if (w->type == word_EmphSpace)
+ w->type = word_WhiteSpace;
+ else if (w->type == word_EmphQuote)
+ w->type = word_Quote;
+ }
+ }
+
+ /*
* FIXME: want to warn on overlapping source sets.
*/
for (; *tags; tags = uadv(tags)) {