makeinfo --html writes a <meta name=description ...> tage and uses the
title of the document for the description. but sometimes i want
something other than the title for the description. below is a patch
to add this feature (and documentation for it as well). there's a new
command @setdescription if you want to your own description. if it's
not used, you get the title for your description, i.e. the behavior of texinfo-4.0.
also, the head of an html document shouldnt be closed until the top
node is encountered. the below patch does this too.
i made this patch having already applied the group of eli's patches to
texinfo-4.0 from a few days ago. if that's a problem, lemme know.
--Will
===File ~/in/texinfo-4.0-body.patch=========================
1999-10-24 W. L. Estes <[EMAIL PROTECTED]>
* doc/texinfo.tex (setdescription): new command
* doc/texinfo.txi (setdescription): new node for @setdescription
* makeinfo/cmds.c (cm_setdescription): new function
(command_table[]): add setdescription
* makeinfo/sectioning.c (description): new variable
* makeinfo/sectioning.h (description): declared here as extern for
public benefit
* makeinfo/html.c(html_output_head): use description instead of
html_title if description was supplied, dont close head here
* makeinfo/node.c (cm_node): close head here if top node
diff -urp texinfo-4.0.orig/doc/texinfo.tex texinfo-4.0/doc/texinfo.tex
--- texinfo-4.0.orig/doc/texinfo.tex Sat Sep 25 10:31:21 1999
+++ texinfo-4.0/doc/texinfo.tex Sun Oct 24 12:53:40 1999
@@ -1685,6 +1685,9 @@ where each line of input produces a line
\def\thistitle{\putwordNoTitle}
\def\settitle{\parsearg\settitlezzz}
\def\settitlezzz #1{\gdef\thistitle{#1}}
+
+%@setdescription is used in HTML, so we ignore it here.
+\let\setdescription = \comment
\message{tables,}
diff -urp texinfo-4.0.orig/doc/texinfo.txi texinfo-4.0/doc/texinfo.txi
--- texinfo-4.0.orig/doc/texinfo.txi Tue Sep 28 15:38:01 1999
+++ texinfo-4.0/doc/texinfo.txi Sun Oct 24 13:16:37 1999
@@ -186,7 +186,6 @@ This is Edition @value{VERSION} of the T
* Concept Index:: A menu covering many topics.
@detailmenu
-
--- The Detailed Node Listing ---
Overview of Texinfo
@@ -241,6 +240,7 @@ The Texinfo File Header
* Start of Header:: Formatting a region requires this.
* setfilename:: Tell Info the name of the Info file.
* settitle:: Create a title for the printed work.
+* setdescription:: Create a description for HTML.
* setchapternewpage:: Start chapters on right-hand pages.
* paragraphindent:: Specify paragraph indentation.
* exampleindent:: Specify environment indentation.
@@ -444,7 +444,7 @@ Inserting Space
* Multiple Spaces:: Inserting multiple spaces.
* dmn:: How to format a dimension.
-Inserting Ellipsis, Dots, and Bullets
+Inserting Ellipsis and Bullets
* dots:: How to insert dots @dots{}
* bullet:: How to insert a bullet.
@@ -624,6 +624,7 @@ Finding Badly Referenced Nodes
* Unsplit:: How to create an unsplit file.
* Tagifying:: How to tagify a file.
* Splitting:: How to split a file manually.
+
@end detailmenu
@end menu
@@ -2700,6 +2701,7 @@ or else like this:
* Start of Header:: Formatting a region requires this.
* setfilename:: Tell Info the name of the Info file.
* settitle:: Create a title for the printed work.
+* setdescription:: Create a description for HTML.
* setchapternewpage:: Start chapters on right-hand pages.
* paragraphindent:: Specify paragraph indentation.
* exampleindent:: Specify environment indentation.
@@ -2816,7 +2818,7 @@ also reads @file{texinfo.cnf} if that fi
(@pxref{Preparing for TeX,, Preparing for @TeX{}}).
-@node settitle, setchapternewpage, setfilename, Header
+@node settitle
@comment node-name, next, previous, up
@subsection @code{@@settitle}
@findex settitle
@@ -2864,6 +2866,31 @@ information.)@refill
You may, if you wish, create your own, customized headings and
footings. @xref{Headings, , Page Headings}, for a detailed discussion
of this process.@refill
+
+@node setdescription
+@subsection @code{@@setdescription}
+@findex setdescription
+@cindex meta HTML tag, and description
+
+When producing HTML output for a document, @command{makeinfo} writes a
+@samp{<meta>} element in the @samp{<head>} to give some idea of the
+content of the document. By default, this @dfn{description} is the title
+of the document. To change the description included in the HTML output,
+write a line like this:
+
+@example
+@@setdescription descriptive text
+@end example
+
+@noindent
+This will produce the following output in the @samp{<head>} of the HTML:
+
+@example
+<meta name=description content="descriptive text">
+@end example
+
+Write the @code{@@setdescription} command at the beginning of a line and follow it
+on the same
+line by the description.
@node setchapternewpage
diff -urp texinfo-4.0.orig/makeinfo/cmds.c texinfo-4.0/makeinfo/cmds.c
--- texinfo-4.0.orig/makeinfo/cmds.c Sun Oct 24 13:18:06 1999
+++ texinfo-4.0/makeinfo/cmds.c Sun Oct 24 12:53:41 1999
@@ -61,7 +61,8 @@ void
cm_defcodeindex (), cm_result (), cm_expansion (), cm_equiv (),
cm_print (), cm_error (), cm_point (), cm_today (), cm_flushleft (),
cm_flushright (), cm_finalout (), cm_cartouche (), cm_detailmenu (),
- cm_multitable (), cm_settitle (), cm_titlefont (), cm_tt ();
+ cm_multitable (), cm_settitle (), cm_titlefont (), cm_tt (),
+ cm_setdescription ();
/* Conditionals. */
void cm_set (), cm_clear (), cm_ifset (), cm_ifclear ();
@@ -176,6 +177,7 @@ COMMAND command_table[] = {
{ "defvarx", cm_defun, NO_BRACE_ARGS },
{ "defvr", cm_defun, NO_BRACE_ARGS },
{ "defvrx", cm_defun, NO_BRACE_ARGS },
+ { "setdescription", cm_setdescription, NO_BRACE_ARGS },
{ "detailmenu", cm_detailmenu, NO_BRACE_ARGS },
{ "dfn", cm_dfn, BRACE_ARGS },
{ "dircategory", cm_dircategory, NO_BRACE_ARGS },
@@ -787,6 +789,12 @@ void
cm_settitle ()
{
get_rest_of_line (0, &title);
+}
+
+void
+cm_setdescription ()
+{
+ get_rest_of_line (0, &description);
}
/* Ignore argument in braces. */
diff -urp texinfo-4.0.orig/makeinfo/html.c texinfo-4.0/makeinfo/html.c
--- texinfo-4.0.orig/makeinfo/html.c Sun Oct 24 13:18:06 1999
+++ texinfo-4.0/makeinfo/html.c Sun Oct 24 12:53:41 1999
@@ -47,10 +47,9 @@ html_output_head ()
add_word_args ("; charset=%s", document_encoding);
add_word ("\">\n");
- add_word_args ("<meta name=description content=\"%s\">\n", html_title);
+ add_word_args ("<meta name=description content=\"%s\">\n",
+(description)?description:html_title);
add_word_args ("<meta name=generator content=\"makeinfo %s\">\n", VERSION);
add_word ("<link href=\"http://texinfo.org/\" rel=generator-home>\n");
- add_word ("</head>\n\n<body>\n");
if (title)
free (html_title);
diff -urp texinfo-4.0.orig/makeinfo/node.c texinfo-4.0/makeinfo/node.c
--- texinfo-4.0.orig/makeinfo/node.c Sun Oct 24 13:18:06 1999
+++ texinfo-4.0/makeinfo/node.c Sun Oct 24 12:53:41 1999
@@ -758,6 +758,13 @@ cm_node ()
add_word ("</head>\n<body>\n");
}
+ /* test to see if we need to output </head> </body> tags before we write node
+anchor */
+ if (current_node && STREQ (current_node, "Top"))
+ {
+ add_word ("</head>\n<body>\n");
+ top_node_seen = 1;
+ }
+
if (!splitting && no_headers)
{ /* cross refs need a name="#anchor" even if we're not writing headers*/
add_word ("<a name=\"");
@@ -854,9 +861,6 @@ cm_node ()
/* Change the section only if there was a sectioning command. */
if (this_section >= 0)
current_section = this_section;
-
- if (current_node && STREQ (current_node, "Top"))
- top_node_seen = 1;
filling_enabled = 1;
in_fixed_width_font--;
diff -urp texinfo-4.0.orig/makeinfo/sectioning.c texinfo-4.0/makeinfo/sectioning.c
--- texinfo-4.0.orig/makeinfo/sectioning.c Tue Aug 17 17:06:50 1999
+++ texinfo-4.0/makeinfo/sectioning.c Sun Oct 24 12:53:41 1999
@@ -59,6 +59,8 @@ section_alist_type section_alist[] = {
/* The argument of @settitle, used for HTML. */
char *title = NULL;
+/* The argument of @setdescription, used for HTML. */
+char *description = NULL;
#define APPENDIX_MAGIC 1024
#define UNNUMBERED_MAGIC 2048
diff -urp texinfo-4.0.orig/makeinfo/sectioning.h texinfo-4.0/makeinfo/sectioning.h
--- texinfo-4.0.orig/makeinfo/sectioning.h Sun Apr 25 16:44:13 1999
+++ texinfo-4.0/makeinfo/sectioning.h Sun Oct 24 12:53:41 1999
@@ -49,6 +49,8 @@ extern int what_section ();
/* The argument of @settitle, used for HTML. */
extern char *title;
+/* The argument of @setdescription, used for HTML. */
+extern char *description;
/* Here is a structure which associates sectioning commands with
an integer that reflects the depth of the current section. */
============================================================