[pm-h] perl application: I'm in over my head
Russell L. Harris
rlharris at oplink.net
Wed Feb 7 03:09:08 PST 2007
I have a small programming problem which is a bit over my head.
The problem involves web pages which I am generating with hyperlatex.
It has just been brought to my attention that I need to add
"description" and "keywords" meta tags to my web site; but I have not
been able to do so directly with hyperlatex. I am able to use
hyperlatex to create the appropriate meta tags for each HTML file, but
the tags are created in the body of the file, rather than in the head;
thus, my need is to relocate the tags.
It seems to me that the following is a reasonable approach:
TASK:
When creating HTML files from a LaTeX source file, the "\xml{tag}"
command of hyperlatex creates a meta tag in the body of the file.
However, the the "description" and "keywords" meta tags belong in
the head of the file, and there appears to be no way (short of
hacking hyperlatex) to force hyperlatex to write a meta tag to the
head of the file.
Consequently, once the HTML file has been created, it is necessary
to move the "description" and "keywords" meta tags from the body
to the head.
A Perl routine invoked by a "make" file appears to be a good way
to accomplish this task.
PROCEDURE:
For a fixed list of HTML files with assorted names:
name1.html
name2.html
anothername1.html
anothername2.html
and a variable list of HTML files which are systematically-named:
TG_1.html
TG_2.html
TG_3.html
...
TG_73.html
TG_74.html
...
(1) Search for the tag:
<meta name="description" ... >
(2) If the tag is found, move the tag from the body of the HTML file
to the head of the HTML file, inserting it immediately following the
line of the title tag:
<title> ... </title>
(3) Search for the tag:
<meta name="keywords" ... >
(4) If the tag is found, move the tag from the body of the HTML file
to the head of the HTML file, inserting it immediately following the
line of the title tag:
<title> ... </title>
(5) Proceed to the next file.
(6) Once all files in the two lists have been processed, exit.
RLH
More information about the Houston
mailing list