Hi, Marc. Your mail program totally mangled the patches you sent me,
but I was able to get the gist of them anyway, and apply something
by hand. I've added this to the CVS source trees, but for those who
want to apply it to existing versions, here's my version of the patch.
I went with the first option, the compatible solution, so as not to break
any existing configurations that expect iso_8601 to work in htsearch.
--- htcommon/defaults.cc.nodatefmt Tue Mar 23 17:17:32 1999
+++ htcommon/defaults.cc Thu Mar 25 10:47:05 1999
@@ -41,6 +41,7 @@
{"create_url_list", "false"},
{"compression_level", "0"},
{"date_factor", "0"},
+ {"date_format", ""},
{"database_base", "${database_dir}/db"},
{"description_factor", "150"},
{"doc_db", "${database_base}.docdb"},
--- htdoc/attrs.html.nodatefmt Tue Mar 23 16:51:46 1999
+++ htdoc/attrs.html Thu Mar 25 11:35:03 1999
@@ -848,6 +848,56 @@
<hr>
<dl>
<dt>
+ <strong><a name="date_format">date_format</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>
+ <em><empty></em>
+ </dd>
+ <dt>
+ <em>description:</em>
+ </dt>
+ <dd>
+ This format string determines the output format for
+ modification dates of documents in the search results.
+ It is interpreted by your system's <em>strftime</em>
+ function. Please refer to your system's manual page
+ for this function, for a description of available
+ format codes. If this format string is empty, as it
+ is by default,
+ <a href="htsearch.html" target="_top">htsearch</a>
+ will pick a format itself. In this case, the <a
+ href="#iso_8601">iso_8601</a> attribute can be used
+ to modify the appearance of the date.
+ </dd>
+ <dt>
+ <em>example:</em>
+ </dt>
+ <dd>
+ date_format: %Y-%m-%d
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ <hr>
+ <dl>
+ <dt>
<strong><a name="description_factor">description_factor</a></strong>
</dt>
<dd>
@@ -2115,6 +2165,14 @@
<dd>
This sets whether dates should be output in ISO 8601
format. For example, this was written on: 1998-10-31 11:28:13
EST.
+ See also the <a
+ href="#date_format">date_format</a> attribute, which
+ can override any date format that
+ <a href="htsearch.html" target="_top">htsearch</a>
+ picks by default.<br>
+ This attribute also affects the format of the date
+ <a href="htnotify.html">htnotify</a> expects to find
+ in a <strong>htdig-notification-date</strong> field.
</dd>
<dt>
<em>example:</em>
--- htdoc/cf_byname.html.nodatefmt Tue Mar 23 16:51:46 1999
+++ htdoc/cf_byname.html Thu Mar 25 11:35:37 1999
@@ -37,6 +37,7 @@
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#database_base">database_base</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#database_dir">database_dir</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#date_factor">date_factor</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body"
+href="attrs.html#date_format">date_format</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#description_factor">description_factor</a><br>
<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>
--- htdoc/cf_byprog.html.nodatefmt Tue Mar 23 16:51:46 1999
+++ htdoc/cf_byprog.html Thu Mar 25 11:36:12 1999
@@ -117,6 +117,7 @@
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#common_url_parts">common_url_parts</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#database_base">database_base</a><br>
<img src="dot.gif" alt="*" width=9 height=9> <a target="body"
href="attrs.html#date_factor">date_factor</a><br>
+ <img src="dot.gif" alt="*" width=9 height=9> <a target="body"
+href="attrs.html#date_format">date_format</a><br>
<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>
--- htsearch/Display.cc.nodatefmt Thu Mar 25 09:50:23 1999
+++ htsearch/Display.cc Thu Mar 25 10:45:02 1999
@@ -315,15 +315,15 @@
if (t)
{
struct tm *tm = localtime(&t);
-// strftime(buffer, sizeof(buffer), "%e-%h-%Y", tm);
- if (config.Boolean("iso_8601"))
+ char *datefmt = config["date_format"];
+ if (!datefmt || !*datefmt)
{
- strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S %Z", tm);
- }
- else
- {
- strftime(buffer, sizeof(buffer), "%x", tm);
+ if (config.Boolean("iso_8601"))
+ datefmt = "%Y-%m-%d %H:%M:%S %Z";
+ else
+ datefmt = "%x";
}
+ strftime(buffer, sizeof(buffer), datefmt, tm);
*str << buffer;
}
vars.Add("MODIFIED", str);
According to Marc Pohl:
> Hi Gilles and Geoff,
>
> i have installed this wonderful piece of software on our intranet server
> and it runs fine (htdig-3.1.1 and Linux). But while customizing the output
> of htsearch, i saw that i cannot modify the format of the modification-date
> for our needs (dd.mm.yyyy or yyyy-mm-dd, both without time). So decided to
> develop a small patch for htdig, which allows the full customization of the
> formatstring via the .conf file. To di this i introduced the new parameter
> "date_format" in the conf file, which contains the third parameter for
> strftime(). The patch is simple and should have no performance impact in
> htsearch (especially the second version).
>
> Because i think that many european users deal with this problem, i will
> send you this patch and hope that you integrate this in the next version of
> htdig.
>
> I have developed two versions of this patch. The first one is the
> compatible solution:
>
> --- Display.cc.311 Wed Mar 24 20:58:01 1999
> +++ Display.cc Wed Mar 24
> 21:10:20 1999
> @@ -311,15 +311,23 @@
> {
> struct tm *tm =
> localtime(&t);
> // strftime(buffer, sizeof(buffer), "%e-%h-%Y", tm);
> -
> if (config.Boolean("iso_8601"))
> + String formatstr =
> config["date_format"];
> + if (formatstr.length())
> {
> -
> strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S %Z", tm);
> - }
> -
> else
> - {
> - strftime(buffer, sizeof(buffer), "%x", tm);
> - }
> -
> *str << buffer;
> + strftime(buffer, sizeof(buffer),
> formatstr.get(), tm);
> + }
> + else
> + {
> +
> if (config.Boolean("iso_8601"))
> + {
> +
> strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S %Z", tm);
> +
> }
> + else
> + {
> +
> strftime(buffer, sizeof(buffer), "%x", tm);
> + }
> +
> }
> + *str << buffer;
> }
> vars.Add("MODIFIED", str);
> }
>
> The second version (which i prefer) is the non-compatible version which
> uses also a default-value for the new parameter date_format. (the parameter
> "iso_8601" is no longer used in htsearch, if sb has used iso_8601 for
> htsearch before, he must now define "date_format: %Y-%m-%d %H:%M:%S %Z" in
> the .conf-file)
>
> --- htcommon/defaults.cc.311 Wed Mar 24 21:00:11 1999
> +++
> htcommon/defaults.cc Wed Mar 24 15:03:45 1999
> @@ -41,6 +41,7 @@
>
> {"create_url_list", "false"},
> {"compression_level",
> "0"},
> {"date_factor", "0"},
> + {"date_format",
> "%x"},
> {"database_base", "${database_dir}/db"},
>
> {"description_factor", "150"},
> {"doc_db",
> "${database_base}.docdb"},
>
>
> --- htsearch/Display.cc.311 Wed Mar 24 20:58:01 1999
> +++
> htsearch/Display.cc Wed Mar 24 15:01:00 1999
> @@ -310,16 +310,14 @@
> if
> (t)
> {
> struct tm *tm = localtime(&t);
> -// strftime(buffer,
> sizeof(buffer), "%e-%h-%Y", tm);
> - if (config.Boolean("iso_8601"))
> +
> +
> String formatstr = config["date_format"];
> + if (formatstr.length())
>
> {
> - strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S %Z", tm);
> -
> }
> - else
> - {
> - strftime(buffer, sizeof(buffer), "%x",
> tm);
> - }
> - *str << buffer;
> + strftime(buffer,
> sizeof(buffer), formatstr.get(), tm);
> +
> + *str << buffer;
> +
> }
> }
> vars.Add("MODIFIED", str);
> }
>
> Regards and thank you for developing htdig,
>
> Marc
>
>
>
> -----------------------------------------------------
>
> Marc Pohl
> Westdeutscher Rundfunk
> Tel.: +49 221 220 8618 OSC/Videotextredaktion
> FAX: +49 221 220 3882 D-50600 Koeln
> Email: [EMAIL PROTECTED]
>
>
--
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.