Instead of traversing a list of paragraphs, mark_attr_ends() now
[sgt/halibut] / main.c
diff --git a/main.c b/main.c
index 18d644c..847aea8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -288,8 +288,6 @@ int main(int argc, char **argv) {
 
        sfree(in.pushback);
 
-       mark_attr_ends(sourceform);
-
        sfree(infiles);
 
        keywords = get_keywords(sourceform);
@@ -304,6 +302,20 @@ int main(int argc, char **argv) {
 
        build_index(idx);
 
+       /*
+        * Set up attr_First / attr_Last / attr_Always, in the main
+        * document and in the index entries.
+        */
+       for (p = sourceform; p; p = p->next)
+           mark_attr_ends(p->words);
+       {
+           int i;
+           indexentry *entry;
+
+           for (i = 0; (entry = index234(idx->entries, i)) != NULL; i++)
+               mark_attr_ends(entry->text);
+       }
+
        if (debug) {
            index_debug(idx);
            dbg_prtkws(keywords);