summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/makeinfo/footnote.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/texinfo/makeinfo/footnote.c')
-rw-r--r--contrib/texinfo/makeinfo/footnote.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/contrib/texinfo/makeinfo/footnote.c b/contrib/texinfo/makeinfo/footnote.c
index 5a11028..e5a7f4c 100644
--- a/contrib/texinfo/makeinfo/footnote.c
+++ b/contrib/texinfo/makeinfo/footnote.c
@@ -1,5 +1,5 @@
/* footnote.c -- footnotes for Texinfo.
- $Id: footnote.c,v 1.4 2002/11/05 03:04:26 karl Exp $
+ $Id: footnote.c,v 1.7 2004/04/11 17:56:47 karl Exp $
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
@@ -21,7 +21,9 @@
#include "footnote.h"
#include "macro.h"
#include "makeinfo.h"
+#include "node.h"
#include "xml.h"
+#include "xref.h"
/* Nonzero means that the footnote style for this document was set on
the command line, which overrides any other settings. */
@@ -53,11 +55,10 @@ int already_outputting_pending_notes = 0;
int footnote_style = end_node;
int first_footnote_this_node = 1;
int footnote_count = 0;
-
+
/* Set the footnote style based on the style identifier in STRING. */
int
-set_footnote_style (string)
- char *string;
+set_footnote_style (char *string)
{
if (strcasecmp (string, "separate") == 0)
footnote_style = separate_node;
@@ -70,7 +71,7 @@ set_footnote_style (string)
}
void
-cm_footnotestyle ()
+cm_footnotestyle (void)
{
char *arg;
@@ -95,9 +96,8 @@ FN *pending_notes = NULL;
/* A method for remembering footnotes. Note that this list gets output
at the end of the current node. */
-void
-remember_note (marker, note)
- char *marker, *note;
+static void
+remember_note (char *marker, char *note)
{
FN *temp = xmalloc (sizeof (FN));
@@ -111,7 +111,7 @@ remember_note (marker, note)
/* How to get rid of existing footnotes. */
static void
-free_pending_notes ()
+free_pending_notes (void)
{
FN *temp;
@@ -133,7 +133,7 @@ free_pending_notes ()
footnote *{this is a footnote}
where "*" is the (optional) marker character for this note. */
void
-cm_footnote ()
+cm_footnote (void)
{
char *marker;
char *note;
@@ -237,9 +237,12 @@ cm_footnote ()
`fn-<n>', though that's unlikely. */
if (html)
{
+ /* Hyperlink also serves as an anchor (mnemonic: fnd is footnote
+ definition.) */
add_html_elt ("<a rel=\"footnote\" href=");
- add_word_args ("\"#fn-%d\"><sup>%s</sup></a>",
- current_footnote_number, marker);
+ add_word_args ("\"#fn-%d\" name=\"fnd-%d\"><sup>%s</sup></a>",
+ current_footnote_number, current_footnote_number,
+ marker);
}
else
/* Your method should at least insert MARKER. */
@@ -282,7 +285,7 @@ cm_footnote ()
/* Output the footnotes. We are at the end of the current node. */
void
-output_pending_notes ()
+output_pending_notes (void)
{
FN *footnote = pending_notes;
@@ -290,13 +293,13 @@ output_pending_notes ()
return;
if (html)
- { /* The type= attribute is used just in case some weirdo browser
- out there doesn't use numbers by default. Since we rely on the
- browser to produce the footnote numbers, we need to make sure
- they ARE indeed numbers. Pre-HTML4 browsers seem to not care. */
- add_word ("<div class=\"footnote\">\n<hr>\n<h4>");
- add_word (_("Footnotes"));
- add_word ("</h4>\n<ol type=\"1\">\n");
+ {
+ add_html_block_elt ("<div class=\"footnote\">\n<hr>\n");
+ /* We add an anchor here so @printindex can refer to this point
+ (as the node name) for entries defined in footnotes. */
+ if (!splitting)
+ add_word ("<a name=\"texinfo-footnotes-in-document\"></a>");
+ add_word_args ("<h4>%s</h4>", (char *) _("Footnotes"));
}
else
switch (footnote_style)
@@ -329,6 +332,7 @@ output_pending_notes ()
/* Handle the footnotes in reverse order. */
{
+ int save_in_fixed_width_font = in_fixed_width_font;
FN **array = xmalloc ((footnote_count + 1) * sizeof (FN *));
array[footnote_count] = NULL;
@@ -340,14 +344,18 @@ output_pending_notes ()
filling_enabled = 1;
indented_fill = 1;
+ in_fixed_width_font = 0;
while ((footnote = array[++footnote_count]))
{
if (html)
{
/* Make the text of every footnote begin a separate paragraph. */
- add_word_args ("<li><a name=\"fn-%d\"></a>\n<p>",
- footnote->number);
+ add_html_block_elt ("<p class=\"footnote\"><small>");
+ /* Make footnote number a link to its definition. */
+ add_word_args ("[<a name=\"fn-%d\" href=\"#fnd-%d\">%d</a>]",
+ footnote->number, footnote->number, footnote->number);
+ add_word ("</small> ");
already_outputting_pending_notes++;
execute_string ("%s", footnote->note);
already_outputting_pending_notes--;
@@ -372,10 +380,12 @@ output_pending_notes ()
}
if (html)
- add_word ("</ol><hr></div>");
+ add_word ("<hr></div>");
close_paragraph ();
free (array);
+
+ in_fixed_width_font = save_in_fixed_width_font;
}
-
+
free_pending_notes ();
}
OpenPOWER on IntegriCloud