[l2h] \htmlmeta usage for META "keywords" in html?

Jameson C. Burt Jameson C. Burt" <jameson@coost.com
Wed, 29 Nov 2000 01:19:05 -0500


Ross Moore wrote:

>All this definition does is to append a text-string to the $HTML_META 
variable.
>As such, it will be used verbatim, in the appropriate place.
>The &revert_to_raw_tex is to undo any translation of special characters,
>such as < " ' > that may have occurred already.
>
>Thus you would have to give the complete string as an argument:
>\htmlmeta{<META NAME="keywords" CONTENT="nasslug, linux, users">}



>From this, I see that \htmlmeta{...} keeps "<" from becoming "&lt;" 
in the html document, but I must still perform a kludge with this "...",
which is now the variable $HTML_META.
Without some kludge, I get nothing from \htmlmeta{...}
in my final document; nonetheless, this \htmlmeta aids us users greatly.
A kludge appears to require the user to either add a file or change
an existing latex2html softwear file.
For example, many people have pointed out that pre-empting 
the subroutine "meta_information" with the additional 
file ~/.latex2html-init  will create the wanted changes.
The ~/.latex2html-init  below uses the variable $HTML_META,
implicitly defined as the contents of \htmlmeta{...}.
If a user's *.tex file includes the two lines
 \htmlmeta{<META NAME="description" CONTENT="nasslug: NASS Linux Users">
 <META NAME="keywords" CONTENT="nasslug, linux, users">}
then $HTML_META becomes
  <META NAME="description" CONTENT="nasslug: NASS Linux Users">
  <META NAME="keywords" CONTENT="nasslug, linux, users">
More realistic examples might have 100-200 characters in "description"
and 200-400 characters in "keywords".
The subroutine below looks neater without having "if" lines split 
for email transmittal.

The following subroutine might better replace 
the "meta_information" subroutine in
   latex2html.config
to avoid kludges.
This redefined "meta_information" subroutine satisfies 
the three parts (a, b, c) of an intersecting Venn diagram, 
whose main parts are "original four latex2html META entries" 
and "user defined META entries".
a. If NO \htmlmeta{...} line appears in the user's *.tex file,
   then the four "META NAME" lines from the original "meta_information"
   subroutine are added to the final html document.
b. If an \htmlmeta{...} line appears in the user's *.tex file that is 
   one of "description", "keywords", "resource-type", or "disribution";
   for example, to change the "keywords" line, then 
   only such lines (with, for example,  "keywords") will be changed.
c. If the user includes in \htmlmeta{...} "META NAME" lines that are not
    "description", keywords", "resource-type" or "distribution" lines, 
    then those additional "META NAME" lines will be added 
    to the final html document. 


MY  ~/.latex2html-init:

sub meta_information {
local($_) = @_;
# Cannot have nested HTML tags...
#
# Any following $HTML_META variable comes from an entry like
#\htmlmeta{<META NAME="description" CONTENT="nasslug: NASS Linux Users">
#    <META NAME="keywords" CONTENT="nasslug, linux, users">}
# in your *.tex document.
#
if ($HTML_META !~ /META NAME="description"/ && $_) 
   {$HTML_META .= "<META NAME=\"description\" CONTENT=\"$_\">\n" ;}
if ($HTML_META !~ /META NAME="keywords"/)          
   {$HTML_META .= "<META NAME=\"keywords\" CONTENT=\"$FILE\">\n" ;}
if ($HTML_META !~ /META NAME="resource-type"/)     
   {$HTML_META .= "<META NAME=\"resource-type\" CONTENT=\"document\">\n" ;}
if ($HTML_META !~ /META NAME="distribution"/)      
   {$HTML_META .= "<META NAME=\"distribution\" CONTENT=\"global\">\n" ;}
#
do { s/<[^>]*>//g;
    "$HTML_META"
}
}
1;      #This must be the last line



-- 
Jameson C. Burt, NJ9L   Fairfax, Virginia, USA
jameson@coost.com       http://www.coost.com