~ubuntu-branches/debian/lenny/texinfo/lenny

« back to all changes in this revision

Viewing changes to makeinfo/node.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-02-20 08:24:18 UTC
  • mfrom: (3.1.4 hardy)
  • Revision ID: james.westby@ubuntu.com-20080220082418-v0mwknqadr1gzkzm
Tags: 4.11.dfsg.1-4
fix bashism in texi2dvi (Closes: #461352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* node.c -- nodes for Texinfo.
2
 
   $Id: node.c,v 1.27 2004/12/20 23:56:07 karl Exp $
3
 
 
4
 
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
5
 
   Foundation, Inc.
6
 
 
7
 
   This program is free software; you can redistribute it and/or modify
 
2
   $Id: node.c,v 1.37 2007/07/08 13:11:48 karl Exp $
 
3
 
 
4
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
 
5
   Free Software Foundation, Inc.
 
6
 
 
7
   This program is free software: you can redistribute it and/or modify
8
8
   it under the terms of the GNU General Public License as published by
9
 
   the Free Software Foundation; either version 2, or (at your option)
10
 
   any later version.
 
9
   the Free Software Foundation, either version 3 of the License, or
 
10
   (at your option) any later version.
11
11
 
12
12
   This program is distributed in the hope that it will be useful,
13
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
   GNU General Public License for more details.
16
16
 
17
17
   You should have received a copy of the GNU General Public License
18
 
   along with this program; if not, write to the Free Software Foundation,
19
 
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
19
 
21
20
#include "system.h"
22
21
#include "cmds.h"
403
402
      if (c == '\t' ||
404
403
          c == '\n' ||
405
404
          c == ','  ||
406
 
          ((paren_seen && nodename[i - 1] == ')') &&
 
405
          ((paren_seen && i > 0 && nodename[i - 1] == ')') &&
407
406
           (c == ' ' || c == '.')) ||
408
407
          (c == '.' &&
409
408
           ((!nodename[i + 1] ||
760
759
                        search_forward ("\n* ", input_text_offset);
761
760
 
762
761
                      if (input_text_offset != -1)
763
 
                        nodename_from_menu = glean_node_from_menu (0, 0);
 
762
                        nodename_from_menu = glean_node_from_menu (0, 
 
763
                                                     (enum reftype) 0);
764
764
 
765
765
                      if (nodename_from_menu)
766
766
                        {
912
912
          if (!tag)
913
913
            {
914
914
              output_stream = fopen (filename, "w");
915
 
              html_output_head_p = 0; /* so that we generate HTML preamble */
916
 
              html_output_head ();
 
915
              output_head_p = 0; /* so that we generate HTML preamble */
 
916
              output_head ();
917
917
            }
918
918
          else if ((tag->flags & TAG_FLAG_ANCHOR) != 0)
919
919
            {
930
930
              free (tag->html_fname);
931
931
              tag->html_fname = NULL;
932
932
              output_stream = fopen (filename, "w");
933
 
              html_output_head_p = 0; /* so that we generate HTML preamble */
934
 
              html_output_head ();
 
933
              output_head_p = 0; /* so that we generate HTML preamble */
 
934
              output_head ();
935
935
            }
936
936
          else
937
937
            {
988
988
          if (next)
989
989
            {
990
990
              tem = expansion (next, 0);
991
 
              add_word ((char *) _("Next:"));
 
991
              add_word ((char *) __("Next:"));
992
992
              add_word ("&nbsp;");
993
993
              
994
994
              add_word ("<a rel=\"next\" accesskey=\"n\" href=\"");
1004
1004
          if (prev)
1005
1005
            {
1006
1006
              tem = expansion (prev, 0);
1007
 
              add_word ((char *) _("Previous:"));
 
1007
              add_word ((char *) __("Previous:"));
1008
1008
              add_word ("&nbsp;");
1009
1009
              add_word ("<a rel=\"previous\" accesskey=\"p\" href=\"");
1010
1010
              add_anchor_name (tem, 1);
1018
1018
          if (up)
1019
1019
            {
1020
1020
              tem = expansion (up, 0);
1021
 
              add_word ((char *) _("Up:"));
 
1021
              add_word ((char *) __("Up:"));
1022
1022
              add_word ("&nbsp;");
1023
1023
              add_word ("<a rel=\"up\" accesskey=\"u\" href=\"");
1024
1024
              add_anchor_name (tem, 1);
1102
1102
  char *fname_for_anchor = NULL;
1103
1103
 
1104
1104
  if (arg == END)
1105
 
    return;
 
1105
    {
 
1106
      /* We want to ignore whitespace following @anchor a la
 
1107
         texinfo.tex, but we're sitting at the }.  So advance past it,
 
1108
         ignore the whitespace, and then go back one character.  When we
 
1109
         return, reader_loop will increment input_text_offset again (see
 
1110
         the '}' case).  Sorry.  */
 
1111
      input_text_offset++;
 
1112
      skip_whitespace_and_newlines ();
 
1113
      input_text_offset--;
 
1114
      return;
 
1115
    }
1106
1116
 
1107
1117
  /* Parse the anchor text.  */
1108
1118
  anchor = get_xref_token (1);
1118
1128
      if (!paragraph_is_open)
1119
1129
        {
1120
1130
          if (!executing_string && html)
1121
 
            html_output_head ();
 
1131
            output_head ();
1122
1132
          start_paragraph ();
1123
1133
          if (!in_fixed_width_font || in_menu || in_detailmenu)
1124
1134
            {
1219
1229
            }
1220
1230
        }
1221
1231
    }
1222
 
  else if (xml)
 
1232
  else if (xml || docbook)
1223
1233
    {
1224
 
      xml_insert_element_with_attribute (ANCHOR, START, "name=\"%s\"", anchor);
 
1234
      xml_insert_element_with_attribute (ANCHOR, START,
 
1235
                                         docbook ? "id=\"%s\"" : "name=\"%s\"",
 
1236
                                         anchor);
1225
1237
      xml_insert_element (ANCHOR, END);
1226
1238
    }
 
1239
 
1227
1240
  /* Save it in the tag table.  */
1228
1241
  remember_node (anchor, NULL, NULL, NULL,
1229
1242
                 output_position + output_paragraph_offset,
1360
1373
  switch (type)
1361
1374
    {
1362
1375
    case menu_reference:
1363
 
      return _("Menu");
 
1376
      return __("Menu");
1364
1377
    case followed_reference:
1365
 
      return _("Cross");
 
1378
      return __("Cross");
1366
1379
    default:
1367
1380
      return "Internal-bad-reference-type";
1368
1381
    }
1421
1434
      /* If this node has a Next, then make sure that the Next exists. */
1422
1435
      if (tags->next)
1423
1436
        {
1424
 
          validate (tags->next, tags->line_no, _("Next"));
 
1437
          validate (tags->next, tags->line_no, __("Next"));
1425
1438
 
1426
1439
          /* If the Next node exists, and there is no Up, then make sure
1427
1440
             that the Prev of the Next points back.  But do nothing if
1459
1472
         field at this stage. */
1460
1473
      if (!(tags->flags & TAG_FLAG_PREV_ERROR) && tags->prev)
1461
1474
        {
1462
 
          int valid_p = validate (tags->prev, tags->line_no, _("Prev"));
 
1475
          int valid_p = validate (tags->prev, tags->line_no, __("Prev"));
1463
1476
 
1464
1477
          if (!valid_p)
1465
1478
            tags->flags |= TAG_FLAG_PREV_ERROR;
1521
1534
        line_error (_("`%s' has no Up field (perhaps incorrect sectioning?)"), tags->node);
1522
1535
      else if (tags->up)
1523
1536
        {
1524
 
          int valid_p = validate (tags->up, tags->line_no, _("Up"));
 
1537
          int valid_p = validate (tags->up, tags->line_no, __("Up"));
1525
1538
 
1526
1539
          /* If node X has Up: Y, then warn if Y fails to have a menu item
1527
1540
             or note pointing at X, if Y isn't of the form "(Y)". */
1609
1622
          continue;
1610
1623
        }
1611
1624
 
1612
 
      /* Special hack.  If the node in question appears to have
1613
 
         been referenced more than REFERENCE_WARNING_LIMIT times,
1614
 
         give a warning. */
1615
 
      if (tags->touched > reference_warning_limit)
1616
 
        {
1617
 
          input_filename = tags->filename;
1618
 
          line_number = tags->line_no;
1619
 
          warning (_("node `%s' has been referenced %d times"),
1620
 
                   tags->node, tags->touched);
1621
 
        }
1622
 
 
1623
1625
      if (tags->touched == 0)
1624
1626
        {
1625
1627
          input_filename = tags->filename;