Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Fri, 29 Oct 1999 16:54:59 -0500 (CDT)
Hi, all. This is a variation on a patch posted to htdig3-dev on Wednesday.
It will also be available on http://www.htdig.org/files/contrib/other/ .
This patch adds start_highlight, end_highlight, and page_number_separator
attributes to htsearch, to improve configurability of output formats. It's
an adaptation of a similar patch by Sergey Yu. Abdurashitov, posted to the
htdig3-dev mailing list, with improvements and documentation added.
--- htdig-3.1.3/htcommon/defaults.cc.orig Wed Sep 22 11:18:39 1999
+++ htdig-3.1.3/htcommon/defaults.cc Fri Oct 29 15:54:40 1999
@@ -48,6 +48,7 @@ ConfigDefaults defaults[] =
{"doc_index", "${database_base}.docs.index"},
{"doc_list", "${database_base}.docs"},
{"end_ellipses", "<b><tt> ...</tt></b>"},
+ {"end_highlight", "</strong>"},
{"endings_affix_file", "${common_dir}/english.aff"},
{"endings_dictionary", "${common_dir}/english.0"},
{"endings_root2word_db", "${common_dir}/root2word.db"},
@@ -107,6 +108,7 @@ ConfigDefaults defaults[] =
{"no_title_text", "filename"},
{"nothing_found_file", "${common_dir}/nomatch.html"},
{"page_list_header", "<hr noshade size=2>Pages:<br>"},
+ {"page_number_separator", "\" \""},
{"prefix_match_character", "*"},
{"prev_page_text", "[prev]"},
{"remove_bad_urls", "true"},
@@ -126,6 +128,7 @@ ConfigDefaults defaults[] =
{"star_image", "${image_url_prefix}/star.gif"},
{"star_patterns", ""},
{"start_ellipses", "<b><tt>... </tt></b>"},
+ {"start_highlight", "<strong>"},
{"start_url", "http://www.htdig.org/"},
{"substring_max_words", "25"},
{"synonym_db", "${common_dir}/synonyms.db"},
--- htdig-3.1.3/htdoc/attrs.html.orig Wed Oct 20 11:37:52 1999
+++ htdig-3.1.3/htdoc/attrs.html Fri Oct 29 15:51:06 1999
@@ -1232,6 +1232,53 @@
<hr>
<dl>
<dt>
+ <strong><a name="end_highlight">
+ end_highlight</a></strong>
+ </dt>
+ <dd>
+ <dl>
+ <dt>
+ <em>type:</em>
+ </dt>
+ <dd>
+ string
+ </dd>
+ <dt>
+ <em>used by:</em>
+ </dt>
+ <dd>
+ <a href="htsearch.html" target="_top">htsearch</a>
+ </dd>
+ <dt>
+ <em>default:</em>
+ </dt>
+ <dd>
+ </strong>
+ </dd>
+ <dt>
+ <em>description:</em>
+ </dt>
+ <dd>
+ 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.
+ </dd>
+ <dt>
+ <em>example:</em>
+ </dt>
+ <dd>
+ end_highlight: </font>
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ <hr>
+ <dl>
+ <dt>
<strong><a name="endings_affix_file">
endings_affix_file</a></strong>
</dt>
@@ -1479,13 +1526,17 @@
<dd>
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.
</dd>
<dt>
<em>example:</em>
@@ -4206,6 +4257,65 @@
<hr>
<dl>
<dt>
+ <strong><a name="page_number_separator">
+ page_number_separator</a></strong>
+ </dt>
+ <dd>
+ <dl>
+ <dt>
+ <em>type:</em>
+ </dt>
+ <dd>
+ quoted string list
+ </dd>
+ <dt>
+ <em>used by:</em>
+ </dt>
+ <dd>
+ <a href="htsearch.html" target="_top">htsearch</a>
+ </dd>
+ <dt>
+ <em>default:</em>
+ </dt>
+ <dd>
+ " "
+ </dd>
+ <dt>
+ <em>description:</em>
+ </dt>
+ <dd>
+ 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.
+ </dd>
+ <dt>
+ <em>example:</em>
+ </dt>
+ <dd>
+ page_number_separator: "</td> <td>"
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ <hr>
+ <dl>
+ <dt>
<strong><a name="page_number_text">
page_number_text</a></strong>
</dt>
@@ -5559,6 +5669,53 @@
<hr>
<dl>
<dt>
+ <strong><a name="start_highlight">
+ start_highlight</a></strong>
+ </dt>
+ <dd>
+ <dl>
+ <dt>
+ <em>type:</em>
+ </dt>
+ <dd>
+ string
+ </dd>
+ <dt>
+ <em>used by:</em>
+ </dt>
+ <dd>
+ <a href="htsearch.html" target="_top">htsearch</a>
+ </dd>
+ <dt>
+ <em>default:</em>
+ </dt>
+ <dd>
+ <strong>
+ </dd>
+ <dt>
+ <em>description:</em>
+ </dt>
+ <dd>
+ 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.
+ </dd>
+ <dt>
+ <em>example:</em>
+ </dt>
+ <dd>
+ start_highlight: <font color="#FF0000">
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ <hr>
+ <dl>
+ <dt>
<strong><a name="start_url">start_url</a></strong>
</dt>
<dd>
@@ -6732,7 +6889,7 @@
<a href="author.html">Andrew Scherpbier <andrew@contigo.com></a>
</address>
<!-- hhmts start -->
-Last modified: Fri Aug 6 15:00:15 EDT 1999
+Last modified: Fri Oct 29 16:50:59 EDT 1999
<!-- hhmts end -->
</body>
</html>
--- htdig-3.1.3/htdoc/cf_byname.html.orig Wed Sep 22 11:18:41 1999
+++ htdig-3.1.3/htdoc/cf_byname.html Fri Oct 29 15:57:42 1999
@@ -47,6 +47,7 @@
</font> <br>
<b>E</b> <font face="helvetica,arial" size="2"><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#end_ellipses">end_ellipses</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#end_highlight">end_highlight</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#endings_affix_file">endings_affix_file</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#endings_dictionary">endings_dictionary</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#endings_root2word_db">endings_root2word_db</a><br>
@@ -123,6 +124,7 @@
</font> <br>
<b>P</b> <font face="helvetica,arial" size="2"><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#page_list_header">page_list_header</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#page_number_separator">page_number_separator</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#page_number_text">page_number_text</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#pdf_parser">pdf_parser</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#prefix_match_character">prefix_match_character</a><br>
@@ -148,6 +150,7 @@
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#star_image">star_image</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#star_patterns">star_patterns</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#start_ellipses">start_ellipses</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#start_highlight">start_highlight</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#start_url">start_url</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#substring_max_words">substring_max_words</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#synonym_db">synonym_db</a><br>
--- htdig-3.1.3/htdoc/cf_byprog.html.orig Wed Sep 22 11:18:41 1999
+++ htdig-3.1.3/htdoc/cf_byprog.html Fri Oct 29 15:58:35 1999
@@ -122,6 +122,7 @@
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#doc_db">doc_db</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#doc_index">doc_index</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#end_ellipses">end_ellipses</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#end_highlight">end_highlight</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#endings_root2word_db">endings_root2word_db</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#endings_word2root_db">endings_word2root_db</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#excerpt_length">excerpt_length</a><br>
@@ -147,6 +148,7 @@
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#nothing_found_file">nothing_found_file</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#no_title_text">no_title_text</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#page_list_header">page_list_header</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#page_number_separator">page_number_separator</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#page_number_text">page_number_text</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#prefix_match_character">prefix_match_character</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#prev_page_text">prev_page_text</a><br>
@@ -160,6 +162,7 @@
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#star_image">star_image</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#star_patterns">star_patterns</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#start_ellipses">start_ellipses</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#start_highlight">start_highlight</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#substring_max_words">substring_max_words</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#synonym_db">synonym_db</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body" href="attrs.html#template_map">template_map</a><br>
--- htdig-3.1.3/htsearch/Display.cc.orig Wed Sep 22 11:18:44 1999
+++ htdig-3.1.3/htsearch/Display.cc Fri Oct 29 15:38:08 1999
@@ -498,6 +498,7 @@ Display::setVariables(int pageNumber, Li
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++)
@@ -507,7 +508,7 @@ Display::setVariables(int pageNumber, Li
p = npnt[i - 1];
if (!p)
p = form("%d", i);
- *str << p << ' ';
+ *str << p;
}
else
{
@@ -517,8 +518,10 @@ Display::setVariables(int pageNumber, Li
*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);
}
@@ -1058,6 +1061,8 @@ Display::excerpt(DocumentRef *ref, Strin
char *
Display::hilight(char *str, String urlanchor, int fanchor)
{
+ static char *start_highlight = config["start_highlight"];
+ static char *end_highlight = config["end_highlight"];
static String result;
int pos;
int which, length;
@@ -1069,13 +1074,13 @@ Display::hilight(char *str, String urlan
{
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: <grdetil@scrc.umanitoba.ca> 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 htdig mailing list, send a message to htdig@htdig.org containing the single word unsubscribe in the SUBJECT of the message.
This archive was generated by hypermail 2.0b3 on Fri Oct 29 1999 - 15:04:29 PDT