According to Joe R. Jah:
> On Thu, 28 Oct 1999, Gilles Detillieux wrote:
> > Hi, Sergey.  Thanks for the patch.  Right now, 3.1.x is just in maintenance
> > mode, so I don't know about adding new features like this one to the
> > source tree.  I guess we should do as for feature freezes and vote it in.
> > 
> > Similarly, 3.2.0b1 is now in a feature freeze, so I think we should vote
> > it in for this release too.
> > 
> > My vote would be +1 for both of these simple features.  If it gets voted
> > down, it'll wait until 3.2.0b2, I guess.
> 
> Vote: +1 for both.

You, Sergey and I make 3 votes.  If I don't get 3 votes against it,
I'll commit the following changes tomorrow.  This is my variation on
Sergey's patch, adapted for 3.2, and cleaned up a bit.  I also made the
page_number_separator into a real quoted string list (hey, it was easy).

It's when it comes to adding new config attributes that Loic's new
cf_generate.pl system for documentation really shines.  Good job!

Index: htcommon/defaults.cc
===================================================================
RCS file: /opt/htdig/cvs/htdig3/htcommon/defaults.cc,v
retrieving revision 1.64.2.9
diff -u -r1.64.2.9 defaults.cc
--- htcommon/defaults.cc        1999/10/28 18:18:59     1.64.2.9
+++ htcommon/defaults.cc        1999/10/28 20:36:13
@@ -273,6 +273,15 @@
        reminder to the user that the excerpt is only part of
        the complete document.
 " },
+{ "end_highlight", "</strong>", 
+       "string", "htsearch", "end_highlight: &lt;/font&gt;", "
+       When excerpts are displayed in the search output, matched
+       words will be highlighted using <a href=\"#start_highlight\">
+       start_highlight</a> and this string.
+       You should ensure that highlighting tags are balanced,
+       that is, this string should close any formatting
+       tag opened by start_highlight.
+" },
 { "endings_affix_file", "${common_dir}/english.aff", 
        "string", "htfuzzy", "endings_affix_file: /var/htdig/affix_rules", "
        Specifies the location of the file which contains the
@@ -321,13 +330,16 @@
        "number", "htsearch", "excerpt_length: 500", "
        This is the maximum number of characters the displayed
        excerpt will be limited to. The first matched word will
-       be bolded in the middle of the excerpt so that there is
+       be highlighted in the middle of the excerpt so that there is
        some surrounding context.<br>
        The <em><a href=\"#start_ellipses\">
        start_ellipses</a></em> and
        <em><a href=\"#end_ellipses\">end_ellipses</a></em> are used to
        indicate that the document contains text before and
        after the displayed excerpt respectively.
+       The <em><a href=\"#start_highlight\">start_highlight</a></em> and
+       <em><a href=\"#end_highlight\">end_highlight</a></em> are used to
+       specify what formatting tags are used to highlight matched words.
 " },
 { "excerpt_show_top", "false", 
        "boolean", "htsearch", "excerpt_show_top: yes", "
@@ -1179,6 +1191,23 @@
        <a href=\"#search_results_footer\">search_results_footer</a>
        file, when all search results fit on more than one page.
 " },
+{ "page_number_separator", "\" \"", 
+       "quoted string list", "htsearch", "page_number_separator: "&lt;/td&gt; 
+&lt;td&gt;", "
+       The text strings in this list will be used when putting
+       together the PAGELIST variable, for use in templates or
+       the <a href=\"#search_results_footer\">search_results_footer</a>
+       file, when search results fit on more than page. The PAGELIST
+       is the list of links at the bottom of the search results page.
+       The strings in the list will be used in rotation, and will
+       separate individual entries taken from
+       <a href=\"#page_number_text\">page_number_text</a> and
+       <a href=\"#no_page_number_text\">no_page_number_text</a>.
+       There can be as many or as few strings in the list as you like.
+       If there are not enough for the number of pages listed, it goes
+       back to the start of the list. If the list is empty, a space is
+       used. The text strings can contain HTML tags. The strings need
+       to be quoted if they contain spaces, or to specify an empty string.
+" },
 { "page_number_text", "", 
        "quoted string list", "htsearch", "page_number_text:
                                  &lt;em&gt;1&lt;/em&gt; &lt;em&gt;2&lt;/em&gt; \\<br>
@@ -1722,6 +1751,15 @@
        text before the text displayed. This is just a visual
        reminder to the user that the excerpt is only part of
        the complete document.
+" },
+{ "start_highlight", "<strong>", 
+       "string", "htsearch", "start_highlight: &lt;font color=\"#FF0000\"&gt;", "
+       When excerpts are displayed in the search output, matched
+       words will be highlighted using this string and
+       <a href=\"#end_highlight\"> end_highlight</a>.
+       You should ensure that highlighting tags are balanced,
+       that is, any formatting tags that this string
+       opens should be closed by end_highlight.
 " },
 { "start_url", "http://www.htdig.org/", 
        "string list", "htdig", "start_url: 
http://www.somewhere.org/alldata/index.html", "
Index: htsearch/Display.cc
===================================================================
RCS file: /opt/htdig/cvs/htdig3/htsearch/Display.cc,v
retrieving revision 1.100
diff -u -r1.100 Display.cc
--- htsearch/Display.cc 1999/10/08 14:50:40     1.100
+++ htsearch/Display.cc 1999/10/28 20:36:29
@@ -526,6 +526,7 @@
        char    *p;
        QuotedStringList        pnt(config["page_number_text"], " \t\r\n");
        QuotedStringList        npnt(config["no_page_number_text"], " \t\r\n");
+       QuotedStringList        sep(config["page_number_separator"], " \t\r\n");
        if (nPages > config.Value("maximum_pages", 10))
            nPages = config.Value("maximum_pages");
        for (i = 1; i <= nPages; i++)
@@ -535,7 +536,7 @@
                p = npnt[i - 1];
                if (!p)
                    p = form("%d", i);
-               *str << p << ' ';
+               *str << p;
            }
            else
            {
@@ -545,8 +546,10 @@
                *str << "<a href=\"";
                tmp = 0;
                createURL(tmp, i);
-               *str << tmp << "\">" << p << "</a> ";
+               *str << tmp << "\">" << p << "</a>";
            }
+           if (i != nPages)
+               *str << (sep.Count() > 0) ? sep[(i-1)%sep.Count()] : " ";
        }
        vars.Add("PAGELIST", str);
     }
@@ -1134,6 +1137,8 @@
 String
 Display::hilight(const String& str_arg, const String& urlanchor, int fanchor)
 {
+    static char                *start_highlight = config["start_highlight"];
+    static char                *end_highlight = config["end_highlight"];
     const char         *str = str_arg;
     String             result;
     int                        pos;
@@ -1146,13 +1151,13 @@
     {
        result.append(str, pos);
        ww = (WeightWord *) (*searchWords)[which];
-       result << "<strong>";
+       result << start_highlight;
        if (first && fanchor)
            result << "<a href=\"" << urlanchor << "\">";
        result.append(str + pos, length);
        if (first && fanchor)
            result << "</a>";
-       result << "</strong>";
+       result << end_highlight;
        str += pos + length;
        first = 0;
     }

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to