~ubuntu-branches/ubuntu/maverick/texinfo/maverick

« back to all changes in this revision

Viewing changes to makeinfo/insertion.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2005-10-28 15:10:30 UTC
  • mto: (2.1.1 dapper) (3.1.4 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051028151030-9nsf2s2k2z3fktjt
Tags: upstream-4.8
ImportĀ upstreamĀ versionĀ 4.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* insertion.c -- insertions for Texinfo.
2
 
   $Id: insertion.c,v 1.39 2002/03/02 15:05:21 karl Exp $
 
2
   $Id: insertion.c,v 1.55 2004/11/11 18:34:28 karl Exp $
3
3
 
4
 
   Copyright (C) 1998, 99, 2000, 01, 02 Free Software Foundation, Inc.
 
4
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
 
5
   Foundation, Inc.
5
6
 
6
7
   This program is free software; you can redistribute it and/or modify
7
8
   it under the terms of the GNU General Public License as published by
20
21
#include "system.h"
21
22
#include "cmds.h"
22
23
#include "defun.h"
 
24
#include "float.h"
 
25
#include "html.h"
23
26
#include "insertion.h"
24
27
#include "macro.h"
25
28
#include "makeinfo.h"
 
29
#include "multi.h"
26
30
#include "xml.h"
27
31
 
28
32
/* Must match list in insertion.h.  */
29
33
static char *insertion_type_names[] =
30
34
31
 
  "cartouche", "defcv", "deffn", "defivar", "defmac", "defmethod",
32
 
  "defop", "defopt", "defspec", "deftp", "deftypefn", "deftypefun",
33
 
  "deftypeivar", "deftypemethod", "deftypeop", "deftypevar",
34
 
  "deftypevr", "defun", "defvar", "defvr", "detailmenu", "direntry",
35
 
  "display", "documentdescription", "enumerate", "example", "flushleft",
36
 
  "flushright", "format", "ftable", "group", "ifclear", "ifhtml",
37
 
  "ifinfo", "ifnothtml", "ifnotinfo", "ifnottex", "ifset", "iftex",
38
 
  "itemize", "lisp", "menu", "multitable", "quotation", "rawhtml",
39
 
  "rawtex", "smalldisplay", "smallexample", "smallformat", "smalllisp",
40
 
  "verbatim", "table", "tex", "vtable", "bad_type"
 
35
  "cartouche", "copying", "defcv", "deffn", "defivar", "defmac",
 
36
  "defmethod", "defop", "defopt", "defspec", "deftp", "deftypecv",
 
37
  "deftypefn", "deftypefun", "deftypeivar", "deftypemethod",
 
38
  "deftypeop", "deftypevar", "deftypevr", "defun", "defvar", "defvr",
 
39
  "detailmenu", "direntry", "display", "documentdescription",
 
40
  "enumerate", "example", "float", "flushleft", "flushright", "format",
 
41
  "ftable", "group", "ifclear", "ifdocbook", "ifhtml", "ifinfo",
 
42
  "ifnotdocbook", "ifnothtml", "ifnotinfo", "ifnotplaintext", "ifnottex",
 
43
  "ifnotxml", "ifplaintext", "ifset", "iftex", "ifxml", "itemize", "lisp",
 
44
  "menu", "multitable", "quotation", "rawdocbook", "rawhtml", "rawtex",
 
45
  "rawxml", "smalldisplay", "smallexample", "smallformat", "smalllisp",
 
46
  "verbatim", "table", "tex", "vtable", "titlepage", "bad_type"
41
47
};
42
48
 
43
49
/* All nested environments.  */
46
52
/* How deeply we're nested.  */
47
53
int insertion_level = 0;
48
54
 
49
 
/* Whether to examine menu lines.  */
50
 
int in_menu = 0;
51
 
 
52
 
/* How to examine menu lines.  */
53
 
int in_detailmenu = 0;
54
 
 
55
55
/* Set to 1 if we've processed (commentary) text in a @menu that
56
56
   wasn't part of a menu item.  */
57
57
int had_menu_commentary;
58
58
 
 
59
/* How to examine menu lines.  */
 
60
int in_detailmenu = 0;
 
61
 
 
62
/* Whether to examine menu lines.  */
 
63
int in_menu = 0;
 
64
 
59
65
/* Set to 1 if <p> is written in normal context. 
60
66
   Used for menu and itemize. */
61
67
int in_paragraph = 0;
62
68
 
63
 
static const char dl_tag[] = "<dl>\n";
 
69
/* Since an insertion is already in the stack before we reach the switch
 
70
   statement, we cannot use is_in_insertion_of_type (always returns true.) Also
 
71
   making it return the level found, and comparing it with the current level is
 
72
   no use, due to the order of stack.  */
 
73
static int float_active = 0;
 
74
 
 
75
/* Unsetting escape_html blindly causes text inside @html/etc. to be escaped if
 
76
   used within a rmacro.  */
 
77
static int raw_output_block = 0;
 
78
 
 
79
/* Non-zero if a <dl> element has a <dt> element in it.  We use this when
 
80
   deciding whether to insert a <br> or not.  */
 
81
static int html_deflist_has_term = 0;
64
82
 
65
83
void
66
 
init_insertion_stack ()
 
84
init_insertion_stack (void)
67
85
{
68
86
  insertion_stack = NULL;
69
87
}
70
88
 
71
89
/* Return the type of the current insertion. */
72
90
static enum insertion_type
73
 
current_insertion_type ()
 
91
current_insertion_type (void)
74
92
{
75
93
  return insertion_level ? insertion_stack->insertion : bad_type;
76
94
}
78
96
/* Return the string which is the function to wrap around items, or NULL
79
97
   if we're not in an environment where @item is ok.  */
80
98
static char *
81
 
current_item_function ()
 
99
current_item_function (void)
82
100
{
83
101
  int done = 0;
84
102
  INSERTION_ELT *elt = insertion_stack;
95
113
        case ifinfo:
96
114
        case ifnothtml:
97
115
        case ifnotinfo:
 
116
        case ifnotplaintext:
98
117
        case ifnottex:
 
118
        case ifnotxml:
 
119
        case ifplaintext:
99
120
        case ifset:
100
121
        case iftex:
 
122
        case ifxml:
 
123
        case rawdocbook:
101
124
        case rawhtml:
 
125
        case rawxml:
102
126
        case rawtex:
103
127
        case tex:
104
128
        case cartouche:
105
 
          elt = elt->next;
106
 
          break;
 
129
          elt = elt->next;
 
130
          break;
107
131
      
108
132
        default:
109
133
          done = 1;
118
142
   change it to "@ ", since "@" by itself is not a command.  This makes
119
143
   "@ ", "@\t", and "@\n" all the same, but their default meanings are
120
144
   the same anyway, and let's not worry about supporting redefining them.  */
121
 
char *
122
 
get_item_function ()
 
145
static char *
 
146
get_item_function (void)
123
147
{
124
148
  char *item_function;
 
149
  char *item_loc;
 
150
  
125
151
  get_rest_of_line (0, &item_function);
126
152
 
 
153
  /* If the document erroneously says
 
154
       @itemize @bullet @item foobar
 
155
     it's nicer to give an error up front than repeat `@bullet expected
 
156
     braces' until we get a segmentation fault.  */
 
157
  item_loc = strstr (item_function, "@item");
 
158
  if (item_loc)
 
159
    {
 
160
      line_error (_("@item not allowed in argument to @itemize"));
 
161
      *item_loc = 0;
 
162
    }
 
163
 
127
164
  /* If we hit the end of text in get_rest_of_line, backing up
128
165
     input pointer will cause the last character of the last line
129
166
     be pushed back onto the input, which is wrong.  */
140
177
}
141
178
 
142
179
 /* Push the state of the current insertion on the stack. */
143
 
void
144
 
push_insertion (type, item_function)
145
 
     enum insertion_type type;
146
 
     char *item_function;
 
180
static void
 
181
push_insertion (enum insertion_type type, char *item_function)
147
182
{
148
183
  INSERTION_ELT *new = xmalloc (sizeof (INSERTION_ELT));
149
184
 
163
198
 /* Pop the value on top of the insertion stack into the
164
199
    global variables. */
165
200
void
166
 
pop_insertion ()
 
201
pop_insertion (void)
167
202
{
168
203
  INSERTION_ELT *temp = insertion_stack;
169
204
 
183
218
 
184
219
 /* Return a pointer to the print name of this
185
220
    enumerated type. */
186
 
char *
187
 
insertion_type_pname (type)
188
 
     enum insertion_type type;
 
221
static const char *
 
222
insertion_type_pname (enum insertion_type type)
189
223
{
190
224
  if ((int) type < (int) bad_type)
191
 
    return insertion_type_names[(int) type];
 
225
  {
 
226
    if (type == rawdocbook)
 
227
      return "docbook";
 
228
    else if (type == rawhtml)
 
229
      return "html";
 
230
    else if (type == rawxml)
 
231
      return "xml";
 
232
    else if (type == rawtex)
 
233
      return "tex";
 
234
    else
 
235
      return insertion_type_names[(int) type];
 
236
  }
192
237
  else
193
238
    return _("Broken-Type in insertion_type_pname");
194
239
}
196
241
/* Return the insertion_type associated with NAME.
197
242
   If the type is not one of the known ones, return BAD_TYPE. */
198
243
enum insertion_type
199
 
find_type_from_name (name)
200
 
     char *name;
 
244
find_type_from_name (char *name)
201
245
{
202
246
  int index = 0;
203
247
  while (index < (int) bad_type)
204
248
    {
205
249
      if (STREQ (name, insertion_type_names[index]))
206
250
        return (enum insertion_type) index;
 
251
      if (index == rawdocbook && STREQ (name, "docbook"))
 
252
        return rawdocbook;
207
253
      if (index == rawhtml && STREQ (name, "html"))
208
254
        return rawhtml;
 
255
      if (index == rawxml && STREQ (name, "xml"))
 
256
        return rawxml;
209
257
      if (index == rawtex && STREQ (name, "tex"))
210
258
        return rawtex;
211
259
      index++;
213
261
  return bad_type;
214
262
}
215
263
 
 
264
/* Simple function to query insertion_stack to see if we are inside a given
 
265
   insertion type. */
216
266
int
217
 
defun_insertion (type)
218
 
     enum insertion_type type;
 
267
is_in_insertion_of_type (int type)
 
268
{
 
269
  INSERTION_ELT *temp = insertion_stack;
 
270
 
 
271
  if (!insertion_level)
 
272
    return 0;
 
273
 
 
274
  while (temp)
 
275
    {
 
276
      if (temp->insertion == type)
 
277
        return 1;
 
278
      temp = temp->next;
 
279
    }
 
280
 
 
281
  return 0;
 
282
}
 
283
 
 
284
 
 
285
static int
 
286
defun_insertion (enum insertion_type type)
219
287
{
220
288
  return 0
221
289
     || (type == defcv)
227
295
     || (type == defopt)
228
296
     || (type == defspec)
229
297
     || (type == deftp)
 
298
     || (type == deftypecv)
230
299
     || (type == deftypefn)
231
300
     || (type == deftypefun)
232
301
     || (type == deftypeivar)
257
326
int current_enumtype = ENUM_DIGITS;
258
327
char *enumeration_arg = NULL;
259
328
 
260
 
void
261
 
start_enumerating (at, type)
262
 
     int at, type;
 
329
static void
 
330
start_enumerating (int at, int type)
263
331
{
264
332
  if ((enumstack_offset + 1) == max_stack_depth)
265
333
    {
273
341
  current_enumtype = type;
274
342
}
275
343
 
276
 
void
277
 
stop_enumerating ()
 
344
static void
 
345
stop_enumerating (void)
278
346
{
279
347
  --enumstack_offset;
280
348
  if (enumstack_offset < 0)
285
353
}
286
354
 
287
355
/* Place a letter or digits into the output stream. */
288
 
void
289
 
enumerate_item ()
 
356
static void
 
357
enumerate_item (void)
290
358
{
291
359
  char temp[10];
292
360
 
308
376
}
309
377
 
310
378
static void
311
 
enum_html ()
 
379
enum_html (void)
312
380
{
313
381
  char type;
314
382
  int start;
329
397
      start = *enumeration_arg - 'a' + 1;
330
398
    }
331
399
 
332
 
  add_word_args ("<ol type=%c start=%d>\n", type, start);
 
400
  add_html_block_elt_args ("<ol type=%c start=%d>\n", type, start);
333
401
}
334
402
 
335
403
/* Conditionally parse based on the current command name. */
336
404
void
337
 
command_name_condition ()
 
405
command_name_condition (void)
338
406
{
339
407
  char *discarder = xmalloc (8 + strlen (command));
340
408
 
349
417
   commands is done.  A huge switch statement handles the
350
418
   various setups, and generic code is on both sides. */
351
419
void
352
 
begin_insertion (type)
353
 
     enum insertion_type type;
 
420
begin_insertion (enum insertion_type type)
354
421
{
355
422
  int no_discard = 0;
356
423
 
381
448
        add_word ("* Menu:\n");
382
449
 
383
450
      if (xml)
384
 
        xml_insert_element (MENU, START);
385
 
      
 
451
        xml_insert_element (MENU, START);
 
452
      else
 
453
        in_fixed_width_font++;
 
454
 
 
455
      next_menu_item_number = 1;
386
456
      in_menu++;
387
 
      in_fixed_width_font++;
388
457
      no_discard++;
389
458
      break;
390
459
 
400
469
          no_discard++;
401
470
        }
402
471
 
403
 
      in_fixed_width_font++;
 
472
      if (xml)
 
473
        {
 
474
          xml_insert_element (DETAILMENU, START);
 
475
          skip_whitespace_and_newlines();
 
476
        }
 
477
      else
 
478
        in_fixed_width_font++;
 
479
 
404
480
      in_detailmenu++;
405
481
      break;
406
482
 
430
506
      }
431
507
      break;
432
508
 
 
509
    case copying:
 
510
        /* Save the copying text away for @insertcopying,
 
511
           typically used on the back of the @titlepage (for TeX) and
 
512
           the Top node (for info/html).  */
 
513
      if (input_text[input_text_offset] != '\n')
 
514
        discard_until ("\n"); /* ignore remainder of @copying line */
 
515
 
 
516
        input_text_offset = get_until ("\n@end copying", &copying_text);
 
517
        canon_white (copying_text);
 
518
 
 
519
      /* For info, output the copying text right away, so it will end up
 
520
         in the header of the Info file, before the first node, and thus
 
521
         get copied automatically to all the split files.  For xml, also
 
522
         output it right away since xml output is never split.
 
523
         For html, we output it specifically in html_output_head. 
 
524
         For plain text, there's no way to hide it, so the author must
 
525
          use @insertcopying in the desired location.  */
 
526
      if (docbook)
 
527
        {
 
528
          if (!xml_in_bookinfo)
 
529
            {
 
530
              xml_insert_element (BOOKINFO, START);
 
531
              xml_in_bookinfo = 1;
 
532
            }
 
533
          xml_insert_element (LEGALNOTICE, START);
 
534
        }
 
535
 
 
536
      if (!html && !no_headers)
 
537
        cm_insert_copying ();
 
538
 
 
539
      if (docbook)
 
540
        xml_insert_element (LEGALNOTICE, END);
 
541
 
 
542
      break;
 
543
 
433
544
    case quotation:
434
545
      /* @quotation does filling (@display doesn't).  */
435
546
      if (html)
436
 
        add_word ("<blockquote>\n");
 
547
        add_html_block_elt ("<blockquote>\n");
437
548
      else
438
549
        {
439
 
          close_single_paragraph ();
 
550
          /* with close_single_paragraph, we get no blank line above
 
551
             within @copying.  */
 
552
          close_paragraph ();
440
553
          last_char_was_newline = no_indent = 0;
441
554
          indented_fill = filling_enabled = 1;
442
555
          inhibit_paragraph_indentation = 1;
443
556
        }
444
557
      current_indent += default_indentation_increment;
 
558
      if (xml)
 
559
        xml_insert_quotation (insertion_stack->item_function, START);
 
560
      else if (strlen(insertion_stack->item_function))
 
561
        execute_string ("@b{%s:} ", insertion_stack->item_function);
445
562
      break;
446
563
 
447
 
    case display:
448
 
    case smalldisplay:
449
564
    case example:
450
565
    case smallexample:
451
566
    case lisp:
452
567
    case smalllisp:
 
568
      in_fixed_width_font++;
 
569
      /* fall through */
 
570
 
 
571
      /* Like @example but no fixed width font. */
 
572
    case display:
 
573
    case smalldisplay:
453
574
      /* Like @display but without indentation. */
454
575
    case smallformat:
455
576
    case format:
456
577
      close_single_paragraph ();
457
578
      inhibit_paragraph_indentation = 1;
458
 
      in_fixed_width_font++;
459
579
      filling_enabled = 0;
460
580
      last_char_was_newline = 0;
461
581
 
462
582
      if (html)
463
 
        /* Kludge alert: if <pre> is followed by a newline, IE3
464
 
           renders an extra blank line before the pre-formatted block.
465
 
           Other browsers seem to not mind one way or the other.  */
466
 
        add_word ("<br><pre>");
 
583
        /* Kludge alert: if <pre> is followed by a newline, IE3,
 
584
           mozilla, maybe others render an extra blank line before the
 
585
           pre-formatted block.  So don't output a newline.  */
 
586
        add_html_block_elt_args ("<pre class=\"%s\">", command);
467
587
 
468
588
      if (type != format && type != smallformat)
469
 
        current_indent += default_indentation_increment;
 
589
        {
 
590
          current_indent += example_indentation_increment;
 
591
          if (html)
 
592
            {
 
593
              /* Since we didn't put \n after <pre>, we need to insert
 
594
                 the indentation by hand.  */
 
595
              int i;
 
596
              for (i = current_indent; i > 0; i--)
 
597
                add_char (' ');
 
598
            }
 
599
        }
470
600
      break;
471
601
 
472
602
    case multitable:
505
635
      if (html)
506
636
        {
507
637
          if (type == itemize)
508
 
            {
509
 
              add_word ("<ul>\n");
510
 
              in_paragraph = 0;
511
 
            }
 
638
            {
 
639
              add_html_block_elt ("<ul>\n");
 
640
              in_paragraph = 0;
 
641
            }
512
642
          else
513
 
            add_word (dl_tag);
 
643
            { /* We are just starting, so this <dl>
 
644
                 has no <dt> children yet.  */
 
645
              html_deflist_has_term = 0;
 
646
              add_html_block_elt ("<dl>\n");
 
647
            }
514
648
        }
515
649
      if (xml)
516
 
        xml_begin_table (type, insertion_stack->item_function);
 
650
        xml_begin_table (type, insertion_stack->item_function);
 
651
 
 
652
      while (input_text[input_text_offset] == '\n'
 
653
          && input_text[input_text_offset+1] == '\n')
 
654
        {
 
655
          line_number++;
 
656
          input_text_offset++;
 
657
        }
 
658
 
517
659
      break;
518
660
 
519
661
    case enumerate:
529
671
      filling_enabled = indented_fill = 1;
530
672
 
531
673
      if (html)
532
 
        enum_html ();
 
674
        {
 
675
          enum_html ();
 
676
          in_paragraph = 0;
 
677
        }
533
678
 
534
679
      if (xml)
535
 
        xml_begin_enumerate (enumeration_arg);
 
680
        xml_begin_enumerate (enumeration_arg);
536
681
      
537
682
      if (isdigit (*enumeration_arg))
538
683
        start_enumerating (atoi (enumeration_arg), ENUM_DIGITS);
540
685
        start_enumerating (*enumeration_arg, ENUM_ALPHA);
541
686
      break;
542
687
 
543
 
      /* @group does nothing special in makeinfo. */
 
688
      /* @group produces no output in info. */
544
689
    case group:
545
690
      /* Only close the paragraph if we are not inside of an
546
691
         @example-like environment. */
547
692
      if (xml)
548
 
        xml_insert_element (GROUP, START);
 
693
        xml_insert_element (GROUP, START);
549
694
      else if (!insertion_stack->next
550
695
          || (insertion_stack->next->insertion != display
551
696
              && insertion_stack->next->insertion != smalldisplay
560
705
        close_single_paragraph ();
561
706
      break;
562
707
 
 
708
    case cartouche:
 
709
      if (html)
 
710
        add_html_block_elt ("<p><table class=\"cartouche\" summary=\"cartouche\" border=\"1\"><tr><td>\n");
 
711
      if (in_menu)
 
712
        no_discard++;
 
713
      break;
 
714
 
 
715
    case floatenv:
 
716
      /* Cannot nest floats, so complain.  */
 
717
      if (float_active)
 
718
        {
 
719
          line_error (_("%cfloat environments cannot be nested"), COMMAND_PREFIX);
 
720
          pop_insertion ();
 
721
          break;
 
722
        }
 
723
 
 
724
      float_active++;
 
725
 
 
726
      { /* Collect data about this float.  */
 
727
        /* Example: @float [FLOATTYPE][,XREFLABEL][,POSITION] */
 
728
        char floattype[200] = "";
 
729
        char xreflabel[200] = "";
 
730
        char position[200]  = "";
 
731
        char *text;
 
732
        char *caption;
 
733
        char *shortcaption;
 
734
        int start_of_end;
 
735
        int save_line_number = line_number;
 
736
        int save_input_text_offset = input_text_offset;
 
737
        int i;
 
738
 
 
739
        if (strlen (insertion_stack->item_function) > 0)
 
740
          {
 
741
            int i = 0, t = 0, c = 0;
 
742
            while (insertion_stack->item_function[i])
 
743
              {
 
744
                if (insertion_stack->item_function[i] == ',')
 
745
                  {
 
746
                    switch (t)
 
747
                      {
 
748
                      case 0:
 
749
                        floattype[c] = '\0';
 
750
                        break;
 
751
                      case 1:
 
752
                        xreflabel[c] = '\0';
 
753
                        break;
 
754
                      case 2:
 
755
                        position[c] = '\0';
 
756
                        break;
 
757
                      }
 
758
                    c = 0;
 
759
                    t++;
 
760
                    i++;
 
761
                    continue;
 
762
                  }
 
763
 
 
764
                switch (t)
 
765
                  {
 
766
                  case 0:
 
767
                    floattype[c] = insertion_stack->item_function[i];
 
768
                    break;
 
769
                  case 1:
 
770
                    xreflabel[c] = insertion_stack->item_function[i];
 
771
                    break;
 
772
                  case 2:
 
773
                    position[c] = insertion_stack->item_function[i];
 
774
                    break;
 
775
                  }
 
776
                c++;
 
777
                i++;
 
778
              }
 
779
          }
 
780
 
 
781
        skip_whitespace_and_newlines ();
 
782
 
 
783
        start_of_end = get_until ("\n@end float", &text);
 
784
 
 
785
        /* Get also the @caption.  */
 
786
        i = search_forward_until_pos ("\n@caption{",
 
787
            save_input_text_offset, start_of_end);
 
788
        if (i > -1)
 
789
          {
 
790
            input_text_offset = i + sizeof ("\n@caption{") - 1;
 
791
            get_until_in_braces ("\n@end float", &caption);
 
792
            input_text_offset = save_input_text_offset;
 
793
          }
 
794
        else
 
795
          caption = "";
 
796
 
 
797
        /* ... and the @shortcaption.  */
 
798
        i = search_forward_until_pos ("\n@shortcaption{",
 
799
            save_input_text_offset, start_of_end);
 
800
        if (i > -1)
 
801
          {
 
802
            input_text_offset = i + sizeof ("\n@shortcaption{") - 1;
 
803
            get_until_in_braces ("\n@end float", &shortcaption);
 
804
            input_text_offset = save_input_text_offset;
 
805
          }
 
806
        else
 
807
          shortcaption = "";
 
808
 
 
809
        canon_white (xreflabel);
 
810
        canon_white (floattype);
 
811
        canon_white (position);
 
812
        canon_white (caption);
 
813
        canon_white (shortcaption);
 
814
 
 
815
        add_new_float (xstrdup (xreflabel),
 
816
            xstrdup (caption), xstrdup (shortcaption),
 
817
            xstrdup (floattype), xstrdup (position));
 
818
 
 
819
        /* Move to the start of the @float so the contents get processed as
 
820
           usual.  */
 
821
        input_text_offset = save_input_text_offset;
 
822
        line_number = save_line_number;
 
823
      }
 
824
 
 
825
      if (html)
 
826
        add_html_block_elt ("<div class=\"float\">\n");
 
827
      else if (docbook)
 
828
        xml_insert_element (FLOAT, START);
 
829
      else if (xml)
 
830
        {
 
831
          xml_insert_element_with_attribute (FLOAT, START,
 
832
              "name=\"%s\"", current_float_id ());
 
833
 
 
834
          xml_insert_element (FLOATTYPE, START);
 
835
          execute_string ("%s", current_float_type ());
 
836
          xml_insert_element (FLOATTYPE, END);
 
837
 
 
838
          xml_insert_element (FLOATPOS, START);
 
839
          execute_string ("%s", current_float_position ());
 
840
          xml_insert_element (FLOATPOS, END);
 
841
        }
 
842
      else
 
843
        { /* Info */
 
844
          close_single_paragraph ();
 
845
          inhibit_paragraph_indentation = 1;
 
846
        }
 
847
 
 
848
      /* Anchor now.  Note that XML documents get their
 
849
         anchors with <float name="anchor"> tag.  */
 
850
      if ((!xml || docbook) && strlen (current_float_id ()) > 0)
 
851
        execute_string ("@anchor{%s}", current_float_id ());
 
852
 
 
853
      break;
 
854
 
563
855
      /* Insertions that are no-ops in info, but do something in TeX. */
564
 
    case cartouche:
565
856
    case ifclear:
 
857
    case ifdocbook:
566
858
    case ifhtml:
567
859
    case ifinfo:
 
860
    case ifnotdocbook:
568
861
    case ifnothtml:
569
862
    case ifnotinfo:
 
863
    case ifnotplaintext:
570
864
    case ifnottex:
 
865
    case ifnotxml:
 
866
    case ifplaintext:
571
867
    case ifset:
572
868
    case iftex:
 
869
    case ifxml:
573
870
    case rawtex:
574
871
      if (in_menu)
575
872
        no_discard++;
576
873
      break;
577
874
 
 
875
    case rawdocbook:
578
876
    case rawhtml:
579
 
      escape_html = 0;
 
877
    case rawxml:
 
878
      raw_output_block++;
 
879
 
 
880
      if (raw_output_block > 0)
 
881
        {
 
882
          xml_no_para = 1;
 
883
          escape_html = 0;
 
884
          xml_keep_space++;
 
885
        }
 
886
 
 
887
      {
 
888
        /* Some deuglification for improved readability.  */
 
889
        extern int xml_in_para;
 
890
        if (xml && !xml_in_para && xml_indentation_increment > 0)
 
891
          add_char ('\n');
 
892
      }
 
893
 
580
894
      break;
581
895
 
582
896
    case defcv:
588
902
    case defopt:
589
903
    case defspec:
590
904
    case deftp:
 
905
    case deftypecv:
591
906
    case deftypefn:
592
907
    case deftypefun:
593
908
    case deftypeivar:
602
917
      filling_enabled = indented_fill = 1;
603
918
      current_indent += default_indentation_increment;
604
919
      no_indent = 0;
 
920
      if (xml)
 
921
        xml_begin_definition ();
605
922
      break;
606
923
 
607
924
    case flushleft:
609
926
      inhibit_paragraph_indentation = 1;
610
927
      filling_enabled = indented_fill = no_indent = 0;
611
928
      if (html)
612
 
        add_word ("<div align=\"left\">");
 
929
        add_html_block_elt ("<div align=\"left\">");
613
930
      break;
614
931
 
615
932
    case flushright:
618
935
      inhibit_paragraph_indentation = 1;
619
936
      force_flush_right++;
620
937
      if (html)
621
 
        add_word ("<div align=\"right\">");
 
938
        add_html_block_elt ("<div align=\"right\">");
 
939
      break;
 
940
 
 
941
    case titlepage:
 
942
      xml_insert_element (TITLEPAGE, START);
622
943
      break;
623
944
 
624
945
    default:
625
946
      line_error ("begin_insertion internal error: type=%d", type);
626
 
 
627
947
    }
628
948
 
629
949
  if (!no_discard)
634
954
   `bad_type', TYPE gets translated to match the value currently on top
635
955
   of the stack.  Otherwise, if TYPE doesn't match the top of the
636
956
   insertion stack, give error. */
637
 
void
638
 
end_insertion (type)
639
 
     enum insertion_type type;
 
957
static void
 
958
end_insertion (int type)
640
959
{
641
 
  enum insertion_type temp_type;
 
960
  int temp_type;
642
961
 
643
962
  if (!insertion_level)
644
963
    return;
661
980
  if (xml)
662
981
    {
663
982
      switch (type)
664
 
        {
665
 
        case ifinfo:
666
 
        case documentdescription:       
667
 
          break;
668
 
        case quotation:
669
 
          xml_insert_element (QUOTATION, END);
670
 
          break;
671
 
        case example:
672
 
          xml_insert_element (EXAMPLE, END);
673
 
          break;
674
 
        case smallexample:
675
 
          xml_insert_element (SMALLEXAMPLE, END);
676
 
          break;
677
 
        case lisp:
678
 
          xml_insert_element (LISP, END);
679
 
          break;
680
 
        case smalllisp:
681
 
          xml_insert_element (SMALLLISP, END);
682
 
          break;
683
 
        case cartouche:
684
 
          xml_insert_element (CARTOUCHE, END);
685
 
          break;
686
 
        case format:
687
 
          xml_insert_element (FORMAT, END);
688
 
          break;
689
 
        case smallformat:
690
 
          xml_insert_element (SMALLFORMAT, END);
691
 
          break;
692
 
        case display:
693
 
          xml_insert_element (DISPLAY, END);
694
 
          break;
695
 
        case smalldisplay:
696
 
          xml_insert_element (SMALLDISPLAY, END);
697
 
          break;
698
 
        case table:
699
 
        case ftable:
700
 
        case vtable:      
701
 
        case itemize:
702
 
          xml_end_table (type);
703
 
          break;
704
 
        case enumerate:
705
 
          xml_end_enumerate (type);
706
 
          break;
707
 
        case group:
708
 
          xml_insert_element (GROUP, END);
709
 
          break;
710
 
        }
 
983
        {
 
984
        case ifinfo:
 
985
        case documentdescription:       
 
986
          break;
 
987
        case quotation:
 
988
          xml_insert_quotation ("", END);
 
989
          break;
 
990
        case example:
 
991
          xml_insert_element (EXAMPLE, END);
 
992
          if (docbook && current_insertion_type () == floatenv)
 
993
            xml_insert_element (FLOATEXAMPLE, END);
 
994
          break;
 
995
        case smallexample:
 
996
          xml_insert_element (SMALLEXAMPLE, END);
 
997
          if (docbook && current_insertion_type () == floatenv)
 
998
            xml_insert_element (FLOATEXAMPLE, END);
 
999
          break;
 
1000
        case lisp:
 
1001
          xml_insert_element (LISP, END);
 
1002
          if (docbook && current_insertion_type () == floatenv)
 
1003
            xml_insert_element (FLOATEXAMPLE, END);
 
1004
          break;
 
1005
        case smalllisp:
 
1006
          xml_insert_element (SMALLLISP, END);
 
1007
          if (docbook && current_insertion_type () == floatenv)
 
1008
            xml_insert_element (FLOATEXAMPLE, END);
 
1009
          break;
 
1010
        case cartouche:
 
1011
          xml_insert_element (CARTOUCHE, END);
 
1012
          break;
 
1013
        case format:
 
1014
          if (docbook && xml_in_bookinfo && xml_in_abstract)
 
1015
            {
 
1016
              xml_insert_element (ABSTRACT, END);
 
1017
              xml_in_abstract = 0;
 
1018
            }
 
1019
          else
 
1020
            xml_insert_element (FORMAT, END);
 
1021
          break;
 
1022
        case smallformat:
 
1023
          xml_insert_element (SMALLFORMAT, END);
 
1024
          break;
 
1025
        case display:
 
1026
          xml_insert_element (DISPLAY, END);
 
1027
          break;
 
1028
        case smalldisplay:
 
1029
          xml_insert_element (SMALLDISPLAY, END);
 
1030
          break;
 
1031
        case table:
 
1032
        case ftable:
 
1033
        case vtable:      
 
1034
        case itemize:
 
1035
          xml_end_table (type);
 
1036
          break;
 
1037
        case enumerate:
 
1038
          xml_end_enumerate ();
 
1039
          break;
 
1040
        case group:
 
1041
          xml_insert_element (GROUP, END);
 
1042
          break;
 
1043
        case titlepage:
 
1044
          xml_insert_element (TITLEPAGE, END);
 
1045
          break;
 
1046
        }
711
1047
    }
712
1048
  switch (type)
713
1049
    {
714
1050
      /* Insertions which have no effect on paragraph formatting. */
715
 
    case documentdescription:
 
1051
    case copying:
 
1052
      line_number--;
 
1053
      break;
 
1054
 
716
1055
    case ifclear:
 
1056
    case ifdocbook:
717
1057
    case ifinfo:
718
1058
    case ifhtml:
 
1059
    case ifnotdocbook:
719
1060
    case ifnothtml:
720
1061
    case ifnotinfo:
 
1062
    case ifnotplaintext:
721
1063
    case ifnottex:
 
1064
    case ifnotxml:
 
1065
    case ifplaintext:
722
1066
    case ifset:
723
1067
    case iftex:
 
1068
    case ifxml:
724
1069
    case rawtex:
 
1070
    case titlepage:
725
1071
      break;
726
1072
 
 
1073
    case rawdocbook:
727
1074
    case rawhtml:
728
 
      escape_html = 1;
 
1075
    case rawxml:
 
1076
      raw_output_block--;
 
1077
 
 
1078
      if (raw_output_block <= 0)
 
1079
        {
 
1080
          xml_no_para = 0;
 
1081
          escape_html = 1;
 
1082
          xml_keep_space--;
 
1083
        }
 
1084
 
 
1085
      if ((xml || html) && output_paragraph[output_paragraph_offset-1] == '\n')
 
1086
        output_paragraph_offset--;
 
1087
      break;
 
1088
 
 
1089
    case detailmenu:
 
1090
      if (xml)
 
1091
        xml_insert_element (DETAILMENU, END);
 
1092
 
 
1093
      in_detailmenu--;          /* No longer hacking menus. */
 
1094
      if (!in_menu)
 
1095
        {
 
1096
          if (!no_headers)
 
1097
            close_insertion_paragraph ();
 
1098
        }
729
1099
      break;
730
1100
 
731
1101
    case direntry:              /* Eaten if html. */
733
1103
      close_insertion_paragraph ();
734
1104
      break;
735
1105
 
736
 
    case detailmenu:
737
 
      in_detailmenu--;          /* No longer hacking menus. */
738
 
      if (!in_menu)
739
 
        {
740
 
          if (!no_headers)
741
 
            close_insertion_paragraph ();
742
 
        }
 
1106
    case documentdescription:
 
1107
      if (xml)
 
1108
        insert_string (document_description);
 
1109
        xml_insert_element (DOCUMENTDESCRIPTION, END);
743
1110
      break;
744
 
 
 
1111
      
745
1112
    case menu:
746
1113
      in_menu--;                /* No longer hacking menus. */
747
 
      if (html)
748
 
        add_word ("</ul>\n");
749
 
      else if (!no_headers)
 
1114
      if (html && !no_headers)
 
1115
        add_html_block_elt ("</ul>\n");
 
1116
      else if (!no_headers && !xml)
750
1117
        close_insertion_paragraph ();
751
1118
      break;
752
1119
 
759
1126
      close_insertion_paragraph ();
760
1127
      current_indent -= default_indentation_increment;
761
1128
      if (html)
762
 
        add_word ("</ol>\n");
 
1129
        add_html_block_elt ("</ol>\n");
763
1130
      break;
764
1131
 
765
1132
    case flushleft:
766
1133
      if (html)
767
 
        add_word ("</div>\n");
 
1134
        add_html_block_elt ("</div>\n");
 
1135
      close_insertion_paragraph ();
 
1136
      break;
 
1137
 
 
1138
    case cartouche:
 
1139
      if (html)
 
1140
        add_html_block_elt ("</td></tr></table>\n");
768
1141
      close_insertion_paragraph ();
769
1142
      break;
770
1143
 
771
1144
    case group:
772
 
    case cartouche:
773
 
      close_insertion_paragraph ();
 
1145
      if (!xml || docbook)
 
1146
        close_insertion_paragraph ();
 
1147
      break;
 
1148
 
 
1149
    case floatenv:
 
1150
      if (xml)
 
1151
        xml_insert_element (FLOAT, END);
 
1152
      else
 
1153
        {
 
1154
          if (html)
 
1155
            add_html_block_elt ("<p><strong class=\"float-caption\">");
 
1156
          else
 
1157
            close_paragraph ();
 
1158
 
 
1159
          no_indent = 1;
 
1160
 
 
1161
          /* Legend:
 
1162
               1) @float Foo,lbl & no caption:    Foo 1.1
 
1163
               2) @float Foo & no caption:        Foo
 
1164
               3) @float ,lbl & no caption:       1.1
 
1165
               4) @float & no caption:                    */
 
1166
 
 
1167
          if (!xml && !html)
 
1168
            indent (current_indent);
 
1169
 
 
1170
          if (strlen (current_float_type ()))
 
1171
            execute_string ("%s", current_float_type ());
 
1172
 
 
1173
          if (strlen (current_float_id ()) > 0)
 
1174
            {
 
1175
              if (strlen (current_float_type ()) > 0)
 
1176
                add_char (' ');
 
1177
 
 
1178
              add_word (current_float_number ());
 
1179
            }
 
1180
 
 
1181
          if (strlen (current_float_title ()) > 0)
 
1182
            {
 
1183
              if (strlen (current_float_type ()) > 0
 
1184
                  || strlen (current_float_id ()) > 0)
 
1185
                insert_string (": ");
 
1186
 
 
1187
              execute_string ("%s", current_float_title ());
 
1188
            }
 
1189
 
 
1190
          /* Indent the following paragraph. */
 
1191
          inhibit_paragraph_indentation = 0;
 
1192
 
 
1193
          if (html)
 
1194
            add_word ("</strong></p></div>\n");
 
1195
          else
 
1196
            close_paragraph ();
 
1197
        }
 
1198
      float_active--;
774
1199
      break;
775
1200
 
776
1201
    case format:
784
1209
    case quotation:
785
1210
      /* @format and @smallformat are the only fixed_width insertion
786
1211
         without a change in indentation. */
787
 
      if (type != format && type != smallformat)
 
1212
      if (type != format && type != smallformat && type != quotation)
 
1213
        current_indent -= example_indentation_increment;
 
1214
      else if (type == quotation)
788
1215
        current_indent -= default_indentation_increment;
789
1216
 
790
1217
      if (html)
791
 
        add_word (type == quotation ? "</blockquote>\n" : "</pre>\n");
 
1218
        { /* The complex code in close_paragraph that kills whitespace
 
1219
             does not function here, since we've inserted non-whitespace
 
1220
             (the </whatever>) before it.  The indentation already got
 
1221
             inserted at the end of the last example line, so we have to
 
1222
             delete it, or browsers wind up showing an extra blank line.  */
 
1223
          kill_self_indent (default_indentation_increment);
 
1224
          add_html_block_elt (type == quotation
 
1225
              ? "</blockquote>\n" : "</pre>\n");
 
1226
        }
792
1227
 
793
1228
      /* The ending of one of these insertions always marks the
794
 
         start of a new paragraph. */
795
 
      close_insertion_paragraph ();
 
1229
         start of a new paragraph, except for the XML output. */
 
1230
      if (!xml || docbook)
 
1231
        close_insertion_paragraph ();
 
1232
 
 
1233
      /* </pre> closes paragraph without messing with </p>.  */
 
1234
      if (html && type != quotation)
 
1235
          paragraph_is_open = 0;
796
1236
      break;
797
1237
 
798
1238
    case table:
800
1240
    case vtable:
801
1241
      current_indent -= default_indentation_increment;
802
1242
      if (html)
803
 
        add_word ("</dl>\n");
 
1243
        add_html_block_elt ("</dl>\n");
 
1244
      close_insertion_paragraph ();
804
1245
      break;
805
1246
 
806
1247
    case itemize:
807
1248
      current_indent -= default_indentation_increment;
808
1249
      if (html)
809
 
        add_word ("</ul>\n");
 
1250
        add_html_block_elt ("</ul>\n");
810
1251
      close_insertion_paragraph ();
811
1252
      break;
812
1253
 
813
1254
    case flushright:
814
1255
      force_flush_right--;
815
1256
      if (html)
816
 
        add_word ("</div>\n");
 
1257
        add_html_block_elt ("</div>\n");
817
1258
      close_insertion_paragraph ();
818
1259
      break;
819
1260
 
820
1261
    /* Handle the @defun insertions with this default clause. */
821
1262
    default:
822
1263
      {
823
 
        enum insertion_type base_type;
 
1264
        int base_type;
824
1265
 
825
1266
        if (type < defcv || type > defvr)
826
1267
          line_error ("end_insertion internal error: type=%d", type);
831
1272
          case deffn:
832
1273
          case defvr:
833
1274
          case deftp:
 
1275
          case deftypecv:
834
1276
          case deftypefn:
835
1277
          case deftypevr:
836
1278
          case defcv:
837
1279
          case defop:
838
 
          case deftypemethod:
839
 
          case deftypeop:
840
 
          case deftypeivar:
841
 
            if (html)
842
 
              /* close the tables which has been opened in defun.c */
843
 
              add_word ("</td></tr>\n</table>\n");
 
1280
          case deftypemethod:
 
1281
          case deftypeop:
 
1282
          case deftypeivar:
 
1283
            if (html)
 
1284
              {
 
1285
                if (paragraph_is_open)
 
1286
                  add_html_block_elt ("</p>");
 
1287
                /* close the div and blockquote which has been opened in defun.c */
 
1288
                if (!rollback_empty_tag ("blockquote"))
 
1289
                  add_html_block_elt ("</blockquote>");
 
1290
                add_html_block_elt ("</div>\n");
 
1291
              }
 
1292
            if (xml)
 
1293
              xml_end_definition ();
844
1294
            break;
845
1295
          } /* switch (base_type)... */
846
1296
  
865
1315
   @if... conditionals, otherwise not.  This is because conditionals can
866
1316
   cross node boundaries.  Always happens with the @top node, for example.  */
867
1317
void
868
 
discard_insertions (specials_ok)
869
 
    int specials_ok;
 
1318
discard_insertions (int specials_ok)
870
1319
{
871
1320
  int real_line_number = line_number;
872
1321
  while (insertion_stack)
874
1323
      if (specials_ok
875
1324
          && ((ifclear <= insertion_stack->insertion
876
1325
               && insertion_stack->insertion <= iftex)
 
1326
              || insertion_stack->insertion == rawdocbook
877
1327
              || insertion_stack->insertion == rawhtml
 
1328
              || insertion_stack->insertion == rawxml
878
1329
              || insertion_stack->insertion == rawtex))
879
1330
        break;
880
1331
      else
881
1332
        {
882
 
          char *offender = insertion_type_pname (insertion_stack->insertion);
 
1333
          const char *offender = insertion_type_pname (insertion_stack->insertion);
883
1334
 
884
1335
          file_line_error (insertion_stack->filename,
885
 
                           insertion_stack->line_number,
886
 
                           _("No matching `%cend %s'"), COMMAND_PREFIX,
887
 
                           offender);
 
1336
                           insertion_stack->line_number,
 
1337
                           _("No matching `%cend %s'"), COMMAND_PREFIX,
 
1338
                           offender);
888
1339
          pop_insertion ();
889
1340
        }
890
1341
    }
894
1345
/* Insertion (environment) commands.  */
895
1346
 
896
1347
void
897
 
cm_quotation ()
 
1348
cm_quotation (void)
898
1349
{
899
 
  if (xml)
900
 
    xml_insert_element (QUOTATION, START);
 
1350
  /* We start the blockquote element in the insertion.  */
901
1351
  begin_insertion (quotation);
902
1352
}
903
1353
 
904
1354
void
905
 
cm_example ()
 
1355
cm_example (void)
906
1356
{
 
1357
  if (docbook && current_insertion_type () == floatenv)
 
1358
    xml_begin_docbook_float (FLOATEXAMPLE);
 
1359
 
907
1360
  if (xml)
908
 
    xml_insert_element (EXAMPLE, START);
 
1361
    {
 
1362
      /* Rollback previous newlines.  These occur between
 
1363
         </para> and <example>.  */
 
1364
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1365
        output_paragraph_offset--;
 
1366
 
 
1367
      xml_insert_element (EXAMPLE, START);
 
1368
 
 
1369
      /* Make sure example text is starting on a new line
 
1370
         for improved readability.  */
 
1371
      if (docbook)
 
1372
        add_char ('\n');
 
1373
    }
 
1374
 
909
1375
  begin_insertion (example);
910
1376
}
911
1377
 
912
1378
void
913
 
cm_smallexample ()
 
1379
cm_smallexample (void)
914
1380
{
 
1381
  if (docbook && current_insertion_type () == floatenv)
 
1382
    xml_begin_docbook_float (FLOATEXAMPLE);
 
1383
 
915
1384
  if (xml)
916
 
    xml_insert_element (SMALLEXAMPLE, START);
 
1385
    {
 
1386
      /* See cm_example comments about newlines.  */
 
1387
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1388
        output_paragraph_offset--;
 
1389
      xml_insert_element (SMALLEXAMPLE, START);
 
1390
      if (docbook)
 
1391
        add_char ('\n');
 
1392
    }
 
1393
 
917
1394
  begin_insertion (smallexample);
918
1395
}
919
1396
 
920
1397
void
921
 
cm_lisp ()
 
1398
cm_lisp (void)
922
1399
{
 
1400
  if (docbook && current_insertion_type () == floatenv)
 
1401
    xml_begin_docbook_float (FLOATEXAMPLE);
 
1402
 
923
1403
  if (xml)
924
 
    xml_insert_element (LISP, START);
 
1404
    {
 
1405
      /* See cm_example comments about newlines.  */
 
1406
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1407
        output_paragraph_offset--;
 
1408
      xml_insert_element (LISP, START);
 
1409
      if (docbook)
 
1410
        add_char ('\n');
 
1411
    }
 
1412
 
925
1413
  begin_insertion (lisp);
926
1414
}
927
1415
 
928
1416
void
929
 
cm_smalllisp ()
 
1417
cm_smalllisp (void)
930
1418
{
 
1419
  if (docbook && current_insertion_type () == floatenv)
 
1420
    xml_begin_docbook_float (FLOATEXAMPLE);
 
1421
 
931
1422
  if (xml)
932
 
    xml_insert_element (SMALLLISP, START);
 
1423
    {
 
1424
      /* See cm_example comments about newlines.  */
 
1425
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1426
        output_paragraph_offset--;
 
1427
      xml_insert_element (SMALLLISP, START);
 
1428
      if (docbook)
 
1429
        add_char ('\n');
 
1430
    }
 
1431
 
933
1432
  begin_insertion (smalllisp);
934
1433
}
935
1434
 
936
1435
void
937
 
cm_cartouche ()
 
1436
cm_cartouche (void)
938
1437
{
 
1438
  if (docbook && current_insertion_type () == floatenv)
 
1439
    xml_begin_docbook_float (CARTOUCHE);
 
1440
 
939
1441
  if (xml)
940
1442
    xml_insert_element (CARTOUCHE, START);
941
1443
  begin_insertion (cartouche);
942
1444
}
943
1445
 
944
1446
void
945
 
cm_format ()
 
1447
cm_copying (void)
 
1448
{
 
1449
  begin_insertion (copying);
 
1450
}
 
1451
 
 
1452
/* Not an insertion, despite the name, but it goes with cm_copying.  */
 
1453
void
 
1454
cm_insert_copying (void)
 
1455
{
 
1456
  if (!copying_text)
 
1457
    {
 
1458
      warning ("@copying not used before %s", command);
 
1459
      return;
 
1460
    }
 
1461
 
 
1462
  execute_string ("%s", copying_text);
 
1463
 
 
1464
  if (!xml && !html)
 
1465
    {
 
1466
      add_word ("\n\n");
 
1467
      /* Update output_position so that the node positions in the tag
 
1468
         tables will take account of the copying text.  */
 
1469
      flush_output ();
 
1470
    }
 
1471
}
 
1472
 
 
1473
void
 
1474
cm_format (void)
946
1475
{
947
1476
  if (xml)
948
 
    xml_insert_element (FORMAT, START);
 
1477
    {
 
1478
      if (docbook && xml_in_bookinfo)
 
1479
        {
 
1480
          xml_insert_element (ABSTRACT, START);
 
1481
          xml_in_abstract = 1;
 
1482
        }
 
1483
      else
 
1484
        {
 
1485
          /* See cm_example comments about newlines.  */
 
1486
          if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1487
            output_paragraph_offset--;
 
1488
          xml_insert_element (FORMAT, START);
 
1489
          if (docbook)
 
1490
            add_char ('\n');
 
1491
        }
 
1492
    }
949
1493
  begin_insertion (format);
950
1494
}
951
1495
 
952
1496
void
953
 
cm_smallformat ()
 
1497
cm_smallformat (void)
954
1498
{
955
1499
  if (xml)
956
 
    xml_insert_element (SMALLFORMAT, START);
 
1500
    {
 
1501
      /* See cm_example comments about newlines.  */
 
1502
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1503
        output_paragraph_offset--;
 
1504
      xml_insert_element (SMALLFORMAT, START);
 
1505
      if (docbook)
 
1506
        add_char ('\n');
 
1507
    }
 
1508
 
957
1509
  begin_insertion (smallformat);
958
1510
}
959
1511
 
960
1512
void
961
 
cm_display ()
 
1513
cm_display (void)
962
1514
{
963
1515
  if (xml)
964
 
    xml_insert_element (DISPLAY, START);
 
1516
    {
 
1517
      /* See cm_example comments about newlines.  */
 
1518
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1519
        output_paragraph_offset--;
 
1520
      xml_insert_element (DISPLAY, START);
 
1521
      if (docbook)
 
1522
        add_char ('\n');
 
1523
    }
 
1524
 
965
1525
  begin_insertion (display);
966
1526
}
967
1527
 
968
1528
void
969
 
cm_smalldisplay ()
 
1529
cm_smalldisplay (void)
970
1530
{
971
1531
  if (xml)
972
 
    xml_insert_element (SMALLDISPLAY, START);
 
1532
    {
 
1533
      /* See cm_example comments about newlines.  */
 
1534
      if (output_paragraph[output_paragraph_offset-1] == '\n')
 
1535
        output_paragraph_offset--;
 
1536
      xml_insert_element (SMALLDISPLAY, START);
 
1537
      if (docbook)
 
1538
        add_char ('\n');
 
1539
    }
 
1540
 
973
1541
  begin_insertion (smalldisplay);
974
1542
}
975
1543
 
976
1544
void
977
 
cm_direntry ()
 
1545
cm_direntry (void)
978
1546
{
979
 
  if (html || xml)
 
1547
  if (html || xml || no_headers)
980
1548
    command_name_condition ();
981
1549
  else
982
1550
    begin_insertion (direntry);
983
1551
}
984
1552
 
985
1553
void
986
 
cm_documentdescription ()
 
1554
cm_documentdescription (void)
987
1555
{
988
 
  if (html || xml)
 
1556
  if (html)
989
1557
    begin_insertion (documentdescription);
 
1558
 
 
1559
  else if (xml)
 
1560
    {
 
1561
      xml_insert_element (DOCUMENTDESCRIPTION, START);
 
1562
      begin_insertion (documentdescription);
 
1563
    }
 
1564
 
990
1565
  else
991
1566
    command_name_condition ();
992
1567
}
993
1568
 
994
1569
 
995
1570
void
996
 
cm_itemize ()
 
1571
cm_itemize (void)
997
1572
{
998
1573
  begin_insertion (itemize);
999
1574
}
1001
1576
/* Start an enumeration insertion of type TYPE.  If the user supplied
1002
1577
   no argument on the line, then use DEFAULT_STRING as the initial string. */
1003
1578
static void
1004
 
do_enumeration (type, default_string)
1005
 
     int type;
1006
 
     char *default_string;
 
1579
do_enumeration (int type, char *default_string)
1007
1580
{
1008
1581
  get_until_in_line (0, ".", &enumeration_arg);
1009
1582
  canon_white (enumeration_arg);
1030
1603
}
1031
1604
 
1032
1605
void
1033
 
cm_enumerate ()
 
1606
cm_enumerate (void)
1034
1607
{
1035
1608
  do_enumeration (enumerate, "1");
1036
1609
}
1044
1617
  verbatim environment may be encapsulated in an @example environment,
1045
1618
  for example. */
1046
1619
void
1047
 
handle_verbatim_environment (find_end_verbatim)
1048
 
  int find_end_verbatim;
 
1620
handle_verbatim_environment (int find_end_verbatim)
1049
1621
{
1050
1622
  int character;
1051
1623
  int seen_end = 0;
1052
1624
  int save_filling_enabled = filling_enabled;
1053
1625
  int save_inhibit_paragraph_indentation = inhibit_paragraph_indentation;
 
1626
  int save_escape_html = escape_html;
1054
1627
 
1055
 
  close_single_paragraph ();
 
1628
  if (!insertion_stack)
 
1629
    close_single_paragraph (); /* no blank lines if not at outer level */
1056
1630
  inhibit_paragraph_indentation = 1;
1057
1631
  filling_enabled = 0;
1058
1632
  in_fixed_width_font++;
1064
1638
   */
1065
1639
 
1066
1640
  if (html)
1067
 
    add_word ("<pre>");
 
1641
    { /* If inside @example, we'll be preceded by the indentation
 
1642
         already.  Browsers will ignore those spaces because we're about
 
1643
         to start another <pre> (don't ask me).  So, wipe them out for
 
1644
         cleanliness, and re-insert.  */
 
1645
      int i;
 
1646
      kill_self_indent (default_indentation_increment);
 
1647
      add_html_block_elt ("<pre class=\"verbatim\">");
 
1648
      for (i = current_indent; i > 0; i--)
 
1649
        add_char (' ');
 
1650
    }
 
1651
  else if (xml)
 
1652
    {
 
1653
      xml_insert_element (VERBATIM, START);
 
1654
      escape_html = 0;
 
1655
      add_word ("<![CDATA[");
 
1656
    }
1068
1657
 
1069
1658
  while (input_text_offset < input_text_length)
1070
1659
    {
1072
1661
 
1073
1662
      if (character == '\n')
1074
1663
        line_number++;
1075
 
      /*
1076
 
        Assume no newlines in END_VERBATIM
1077
 
      */
 
1664
 
 
1665
      /* Assume no newlines in END_VERBATIM. */
1078
1666
      else if (find_end_verbatim && (character == COMMAND_PREFIX) /* @ */
1079
 
          && (input_text_length - input_text_offset > sizeof (END_VERBATIM))
1080
 
          && !strncmp (&input_text[input_text_offset+1], END_VERBATIM,
1081
 
                       sizeof (END_VERBATIM)-1))
1082
 
        {
1083
 
          input_text_offset += sizeof (END_VERBATIM);
1084
 
          seen_end = 1;
1085
 
          break;
1086
 
        }
1087
 
 
1088
 
      add_char (character);
 
1667
          && (input_text_length - input_text_offset > sizeof (END_VERBATIM))
 
1668
          && !strncmp (&input_text[input_text_offset+1], END_VERBATIM,
 
1669
                       sizeof (END_VERBATIM)-1))
 
1670
        {
 
1671
          input_text_offset += sizeof (END_VERBATIM);
 
1672
          seen_end = 1;
 
1673
          break;
 
1674
        }
 
1675
 
 
1676
      if (html && character == '&' && escape_html)
 
1677
        add_word ("&amp;");
 
1678
      else if (html && character == '<' && escape_html)
 
1679
        add_word ("&lt;");
 
1680
      else
 
1681
        add_char (character);
 
1682
 
1089
1683
      input_text_offset++;
1090
1684
    }
1091
1685
 
1093
1687
    warning (_("end of file inside verbatim block"));
1094
1688
 
1095
1689
  if (html)
1096
 
    add_word ("</pre>");
 
1690
    { /* See comments in example case above.  */
 
1691
      kill_self_indent (default_indentation_increment);
 
1692
      add_word ("</pre>");
 
1693
    }
 
1694
  else if (xml)
 
1695
    {
 
1696
      add_word ("]]>");
 
1697
      xml_insert_element (VERBATIM, END);
 
1698
      escape_html = save_escape_html;
 
1699
    }
1097
1700
  
1098
1701
  in_fixed_width_font--;
1099
1702
  filling_enabled = save_filling_enabled;
1101
1704
}
1102
1705
 
1103
1706
void
1104
 
cm_verbatim ()
 
1707
cm_verbatim (void)
1105
1708
{
1106
1709
  handle_verbatim_environment (1);
1107
1710
}
1108
1711
 
1109
1712
void
1110
 
cm_table ()
 
1713
cm_table (void)
1111
1714
{
1112
1715
  begin_insertion (table);
1113
1716
}
1114
1717
 
1115
1718
void
1116
 
cm_multitable ()
 
1719
cm_multitable (void)
1117
1720
{
1118
1721
  begin_insertion (multitable); /* @@ */
1119
1722
}
1120
1723
 
1121
1724
void
1122
 
cm_ftable ()
 
1725
cm_ftable (void)
1123
1726
{
1124
1727
  begin_insertion (ftable);
1125
1728
}
1126
1729
 
1127
1730
void
1128
 
cm_vtable ()
 
1731
cm_vtable (void)
1129
1732
{
1130
1733
  begin_insertion (vtable);
1131
1734
}
1132
1735
 
1133
1736
void
1134
 
cm_group ()
 
1737
cm_group (void)
1135
1738
{
1136
1739
  begin_insertion (group);
1137
1740
}
1138
1741
 
1139
 
void
1140
 
cm_ifinfo ()
1141
 
{
1142
 
  if (process_info)
1143
 
    begin_insertion (ifinfo);
1144
 
  else
1145
 
    command_name_condition ();
1146
 
}
1147
 
 
1148
 
void
1149
 
cm_ifnotinfo ()
1150
 
{
1151
 
  if (!process_info)
1152
 
    begin_insertion (ifnotinfo);
1153
 
  else
1154
 
    command_name_condition ();
1155
 
}
1156
 
 
1157
 
 
1158
1742
/* Insert raw HTML (no escaping of `<' etc.). */
1159
1743
void
1160
 
cm_html ()
 
1744
cm_html (int arg)
1161
1745
{
1162
1746
  if (process_html)
1163
1747
    begin_insertion (rawhtml);
1166
1750
}
1167
1751
 
1168
1752
void
1169
 
cm_ifhtml ()
 
1753
cm_xml (int arg)
 
1754
{
 
1755
  if (process_xml)
 
1756
    begin_insertion (rawxml);
 
1757
  else
 
1758
    command_name_condition ();
 
1759
}
 
1760
 
 
1761
void
 
1762
cm_docbook (int arg)
 
1763
{
 
1764
  if (process_docbook)
 
1765
    begin_insertion (rawdocbook);
 
1766
  else
 
1767
    command_name_condition ();
 
1768
}
 
1769
 
 
1770
void
 
1771
cm_ifdocbook (void)
 
1772
{
 
1773
  if (process_docbook)
 
1774
    begin_insertion (ifdocbook);
 
1775
  else
 
1776
    command_name_condition ();
 
1777
}
 
1778
 
 
1779
void
 
1780
cm_ifnotdocbook (void)
 
1781
{
 
1782
  if (!process_docbook)
 
1783
    begin_insertion (ifnotdocbook);
 
1784
  else
 
1785
    command_name_condition ();
 
1786
}
 
1787
 
 
1788
void
 
1789
cm_ifhtml (void)
1170
1790
{
1171
1791
  if (process_html)
1172
1792
    begin_insertion (ifhtml);
1175
1795
}
1176
1796
 
1177
1797
void
1178
 
cm_ifnothtml ()
 
1798
cm_ifnothtml (void)
1179
1799
{
1180
1800
  if (!process_html)
1181
1801
    begin_insertion (ifnothtml);
1185
1805
 
1186
1806
 
1187
1807
void
1188
 
cm_tex ()
 
1808
cm_ifinfo (void)
 
1809
{
 
1810
  if (process_info)
 
1811
    begin_insertion (ifinfo);
 
1812
  else
 
1813
    command_name_condition ();
 
1814
}
 
1815
 
 
1816
void
 
1817
cm_ifnotinfo (void)
 
1818
{
 
1819
  if (!process_info)
 
1820
    begin_insertion (ifnotinfo);
 
1821
  else
 
1822
    command_name_condition ();
 
1823
}
 
1824
 
 
1825
 
 
1826
void
 
1827
cm_ifplaintext (void)
 
1828
{
 
1829
  if (process_plaintext)
 
1830
    begin_insertion (ifplaintext);
 
1831
  else
 
1832
    command_name_condition ();
 
1833
}
 
1834
 
 
1835
void
 
1836
cm_ifnotplaintext (void)
 
1837
{
 
1838
  if (!process_plaintext)
 
1839
    begin_insertion (ifnotplaintext);
 
1840
  else
 
1841
    command_name_condition ();
 
1842
}
 
1843
 
 
1844
 
 
1845
void
 
1846
cm_tex (void)
1189
1847
{
1190
1848
  if (process_tex)
1191
1849
    begin_insertion (rawtex);
1194
1852
}
1195
1853
 
1196
1854
void
1197
 
cm_iftex ()
 
1855
cm_iftex (void)
1198
1856
{
1199
1857
  if (process_tex)
1200
1858
    begin_insertion (iftex);
1203
1861
}
1204
1862
 
1205
1863
void
1206
 
cm_ifnottex ()
 
1864
cm_ifnottex (void)
1207
1865
{
1208
1866
  if (!process_tex)
1209
1867
    begin_insertion (ifnottex);
1210
1868
  else
1211
1869
    command_name_condition ();
1212
1870
}
 
1871
 
 
1872
void
 
1873
cm_ifxml (void)
 
1874
{
 
1875
  if (process_xml)
 
1876
    begin_insertion (ifxml);
 
1877
  else
 
1878
    command_name_condition ();
 
1879
}
 
1880
 
 
1881
void
 
1882
cm_ifnotxml (void)
 
1883
{
 
1884
  if (!process_xml)
 
1885
    begin_insertion (ifnotxml);
 
1886
  else
 
1887
    command_name_condition ();
 
1888
}
 
1889
 
1213
1890
 
 
1891
/* Generic xrefable block with a caption.  */
 
1892
void
 
1893
cm_float (void)
 
1894
{
 
1895
  begin_insertion (floatenv);
 
1896
}
 
1897
 
 
1898
void
 
1899
cm_caption (int arg)
 
1900
{
 
1901
  char *temp;
 
1902
 
 
1903
  /* This is a no_op command for most formats, as we handle it during @float
 
1904
     insertion.  For XML though, we handle it here to keep document structure
 
1905
     as close as possible, to the Texinfo source.  */
 
1906
 
 
1907
  /* Everything is already handled at START.  */
 
1908
  if (arg == END)
 
1909
    return;
 
1910
 
 
1911
  /* Check if it's mislocated.  */
 
1912
  if (current_insertion_type () != floatenv)
 
1913
    line_error (_("@%s not meaningful outside `@float' environment"), command);
 
1914
 
 
1915
  get_until_in_braces ("\n@end float", &temp);
 
1916
 
 
1917
  if (xml)
 
1918
    {
 
1919
      int elt = STREQ (command, "shortcaption") ? SHORTCAPTION : CAPTION;
 
1920
      xml_insert_element (elt, START);
 
1921
      if (!docbook)
 
1922
        execute_string ("%s", temp);
 
1923
      xml_insert_element (elt, END);
 
1924
    }
 
1925
 
 
1926
  free (temp);
 
1927
}
 
1928
 
1214
1929
/* Begin an insertion where the lines are not filled or indented. */
1215
1930
void
1216
 
cm_flushleft ()
 
1931
cm_flushleft (void)
1217
1932
{
1218
1933
  begin_insertion (flushleft);
1219
1934
}
1221
1936
/* Begin an insertion where the lines are not filled, and each line is
1222
1937
   forced to the right-hand side of the page. */
1223
1938
void
1224
 
cm_flushright ()
 
1939
cm_flushright (void)
1225
1940
{
1226
1941
  begin_insertion (flushright);
1227
1942
}
1228
1943
 
1229
1944
void
1230
 
cm_menu ()
 
1945
cm_menu (void)
1231
1946
{
1232
 
  if (current_node == NULL)
 
1947
  if (current_node == NULL && !macro_expansion_output_stream)
1233
1948
    {
1234
1949
      warning (_("@menu seen before first @node, creating `Top' node"));
1235
1950
      warning (_("perhaps your @top node should be wrapped in @ifnottex rather than @ifinfo?"));
1240
1955
}
1241
1956
 
1242
1957
void
1243
 
cm_detailmenu ()
 
1958
cm_detailmenu (void)
1244
1959
{
1245
 
  if (current_node == NULL)
 
1960
  if (current_node == NULL && !macro_expansion_output_stream)
1246
1961
    { /* Problems anyway, @detailmenu should always be inside @menu.  */
1247
1962
      warning (_("@detailmenu seen before first node, creating `Top' node"));
1248
1963
      execute_string ("@node top\n@top Top\n");
1249
1964
    }
1250
1965
  begin_insertion (detailmenu);
1251
1966
}
 
1967
 
 
1968
/* Title page commands. */
 
1969
 
 
1970
void
 
1971
cm_titlepage (void)
 
1972
{
 
1973
  titlepage_cmd_present = 1;
 
1974
  if (xml && !docbook)
 
1975
    begin_insertion (titlepage);
 
1976
  else
 
1977
    command_name_condition ();
 
1978
}
 
1979
 
 
1980
void
 
1981
cm_author (void)
 
1982
{
 
1983
  char *rest;
 
1984
  get_rest_of_line (1, &rest);
 
1985
 
 
1986
  if (is_in_insertion_of_type (quotation))
 
1987
    {
 
1988
      if (html)
 
1989
        add_word_args ("&mdash; %s", rest);
 
1990
      else if (docbook)
 
1991
        {
 
1992
          /* FIXME Ideally, we should use an attribution element,
 
1993
             but they are supposed to be at the start of quotation
 
1994
             blocks.  So to avoid looking ahead mess, let's just
 
1995
             use mdash like HTML for now.  */
 
1996
          xml_insert_entity ("mdash");
 
1997
          add_word (rest);
 
1998
        }
 
1999
      else if (xml)
 
2000
        {
 
2001
          xml_insert_element (AUTHOR, START);
 
2002
          add_word (rest);
 
2003
          xml_insert_element (AUTHOR, END);
 
2004
        }
 
2005
      else
 
2006
        add_word_args ("-- %s", rest);
 
2007
    }
 
2008
  else if (is_in_insertion_of_type (titlepage))
 
2009
    {
 
2010
      if (xml && !docbook)
 
2011
        {
 
2012
          xml_insert_element (AUTHOR, START);
 
2013
          add_word (rest);
 
2014
          xml_insert_element (AUTHOR, END);
 
2015
        }
 
2016
    }
 
2017
  else
 
2018
    line_error (_("@%s not meaningful outside `@titlepage' and `@quotation' environments"),
 
2019
        command);
 
2020
 
 
2021
  free (rest);
 
2022
}
 
2023
 
 
2024
void
 
2025
cm_titlepage_cmds (void)
 
2026
{
 
2027
  char *rest;
 
2028
 
 
2029
  get_rest_of_line (1, &rest);
 
2030
 
 
2031
  if (!is_in_insertion_of_type (titlepage))
 
2032
    line_error (_("@%s not meaningful outside `@titlepage' environment"),
 
2033
        command);
 
2034
 
 
2035
  if (xml && !docbook)
 
2036
    {
 
2037
      int elt = 0;
 
2038
 
 
2039
      if (STREQ (command, "title"))
 
2040
        elt = BOOKTITLE;
 
2041
      else if (STREQ (command, "subtitle"))
 
2042
        elt = BOOKSUBTITLE;
 
2043
 
 
2044
      xml_insert_element (elt, START);
 
2045
      add_word (rest);
 
2046
      xml_insert_element (elt, END);
 
2047
    }
 
2048
 
 
2049
    free (rest);
 
2050
}
1252
2051
 
1253
2052
/* End existing insertion block. */
1254
2053
void
1255
 
cm_end ()
 
2054
cm_end (void)
1256
2055
{
1257
2056
  char *temp;
1258
 
  enum insertion_type type;
 
2057
  int type;
 
2058
 
 
2059
  get_rest_of_line (0, &temp);
1259
2060
 
1260
2061
  if (!insertion_level)
1261
2062
    {
1263
2064
      return;
1264
2065
    }
1265
2066
 
1266
 
  get_rest_of_line (0, &temp);
1267
 
 
1268
2067
  if (temp[0] == 0)
1269
2068
    line_error (_("`%c%s' needs something after it"), COMMAND_PREFIX, command);
1270
2069
 
1272
2071
 
1273
2072
  if (type == bad_type)
1274
2073
    {
1275
 
      line_error (_("Bad argument to `%s', `%s', using `%s'"),
1276
 
           command, temp, insertion_type_pname (current_insertion_type ()));
 
2074
      line_error (_("Bad argument `%s' to `@%s', using `%s'"),
 
2075
           temp, command, insertion_type_pname (current_insertion_type ()));
1277
2076
    }
1278
2077
  if (xml && type == menu) /* fixme */
1279
2078
    {
1288
2087
static int itemx_flag = 0;
1289
2088
 
1290
2089
/* Return whether CMD takes a brace-delimited {arg}.  */
1291
 
/*static */int
1292
 
command_needs_braces (cmd)
1293
 
     char *cmd;
 
2090
int
 
2091
command_needs_braces (char *cmd)
1294
2092
{
1295
2093
  int i;
1296
2094
  for (i = 0; command_table[i].name; i++)
1304
2102
 
1305
2103
 
1306
2104
void
1307
 
cm_item ()
 
2105
cm_item (void)
1308
2106
{
1309
2107
  char *rest_of_line, *item_func;
1310
2108
 
1339
2137
        case ifinfo:
1340
2138
        case ifnothtml:
1341
2139
        case ifnotinfo:
 
2140
        case ifnotplaintext:
1342
2141
        case ifnottex:
 
2142
        case ifnotxml:
 
2143
        case ifplaintext:
1343
2144
        case ifset:
1344
2145
        case iftex:
 
2146
        case ifxml:
 
2147
        case rawdocbook:
1345
2148
        case rawhtml:
 
2149
        case rawxml:
1346
2150
        case rawtex:
1347
2151
        case tex:
1348
2152
        case cartouche:
1379
2183
          else
1380
2184
            {
1381
2185
              if (html)
1382
 
                {
1383
 
                  if (in_paragraph)
1384
 
                    {
1385
 
                      add_word ("</p>");
1386
 
                      in_paragraph = 0;
1387
 
                    }
1388
 
                  add_word ("<li>");
1389
 
                }
1390
 
              else if (xml)
1391
 
                xml_begin_item ();
 
2186
                add_html_block_elt ("<li>");
 
2187
              else if (xml)
 
2188
                xml_begin_item ();
1392
2189
              else
1393
2190
                {
1394
2191
                  start_paragraph ();
1427
2224
                  must_start_paragraph = 1;
1428
2225
                }
1429
2226
 
1430
 
              /* Handle text directly after the @item.  */
1431
 
              if (*rest_of_line)
1432
 
                {
1433
 
                  line_number--;
1434
 
                  input_text_offset = original_input_text_offset;
1435
 
                }
 
2227
              /* Handle text directly after the @item.  */
 
2228
              if (*rest_of_line)
 
2229
                {
 
2230
                  line_number--;
 
2231
                  input_text_offset = original_input_text_offset;
 
2232
                }
1436
2233
            }
1437
2234
          break;
1438
2235
 
1440
2237
        case ftable:
1441
2238
        case vtable:
1442
2239
          if (html)
1443
 
            {
1444
 
              static int last_html_output_position = 0;
1445
 
 
1446
 
              /* If nothing has been output since the last <dd>,
 
2240
            { /* If nothing has been output since the last <dd>,
1447
2241
                 remove the empty <dd> element.  Some browsers render
1448
2242
                 an extra empty line for <dd><dt>, which makes @itemx
1449
2243
                 conversion look ugly.  */
1450
 
              if (last_html_output_position == output_position
1451
 
                  && strncmp ((char *) output_paragraph, "<dd>",
1452
 
                                output_paragraph_offset) == 0)
1453
 
                output_paragraph_offset = 0;
 
2244
              rollback_empty_tag ("dd");
1454
2245
 
1455
2246
              /* Force the browser to render one blank line before
1456
 
                 each new @item in a table.  But don't do that unless
 
2247
                 each new @item in a table.  But don't do that if
1457
2248
                 this is the first <dt> after the <dl>, or if we are
1458
2249
                 converting @itemx.
1459
2250
 
1460
2251
                 Note that there are some browsers which ignore <br>
1461
2252
                 in this context, but I cannot find any way to force
1462
2253
                 them all render exactly one blank line.  */
1463
 
              if (!itemx_flag
1464
 
                  && strncmp ((char *) output_paragraph
1465
 
                              + output_paragraph_offset - sizeof (dl_tag) + 1, 
1466
 
                              dl_tag, sizeof (dl_tag) - 1) != 0)
1467
 
                add_word ("<br>");
 
2254
              if (!itemx_flag && html_deflist_has_term)
 
2255
                add_html_block_elt ("<br>");
 
2256
 
 
2257
              /* We are about to insert a <dt>, so this <dl> has a term.
 
2258
                 Feel free to insert a <br> next time. :)  */
 
2259
              html_deflist_has_term = 1;
1468
2260
   
1469
 
              add_word ("<dt>");
 
2261
              add_html_block_elt ("<dt>");
1470
2262
              if (item_func && *item_func)
1471
2263
                execute_string ("%s{%s}", item_func, rest_of_line);
1472
2264
              else
1477
2269
 
1478
2270
              if (current_insertion_type () == vtable)
1479
2271
                execute_string ("%cvindex %s\n", COMMAND_PREFIX, rest_of_line);
1480
 
              /* Make sure output_position is updated, so we could
1481
 
                 remember it.  */
1482
 
              close_single_paragraph ();
1483
 
              last_html_output_position = output_position;
1484
 
              add_word ("<dd>");
 
2272
 
 
2273
              add_html_block_elt ("<dd>");
1485
2274
            }
1486
 
          else if (xml) /* && docbook)*/ /* 05-08 */
1487
 
            {
1488
 
              xml_begin_table_item ();
 
2275
          else if (xml) /* && docbook)*/ /* 05-08 */
 
2276
            {
 
2277
              xml_begin_table_item ();
 
2278
 
 
2279
              if (!docbook && current_insertion_type () == ftable)
 
2280
                execute_string ("%cfindex %s\n", COMMAND_PREFIX, rest_of_line);
 
2281
 
 
2282
              if (!docbook && current_insertion_type () == vtable)
 
2283
                execute_string ("%cvindex %s\n", COMMAND_PREFIX, rest_of_line);
 
2284
 
1489
2285
              if (item_func && *item_func)
1490
2286
                execute_string ("%s{%s}", item_func, rest_of_line);
1491
2287
              else
1492
2288
                execute_string ("%s", rest_of_line);
1493
 
              xml_continue_table_item ();
1494
 
            }
 
2289
              xml_continue_table_item ();
 
2290
            }
1495
2291
          else
1496
2292
            {
1497
2293
              /* We need this to determine if we have two @item's in a row
1563
2359
}
1564
2360
 
1565
2361
void
1566
 
cm_itemx ()
 
2362
cm_itemx (void)
1567
2363
{
1568
2364
  itemx_flag++;
1569
2365
  cm_item ();
1570
2366
  itemx_flag--;
1571
2367
}
 
2368
 
 
2369
int headitem_flag = 0;
 
2370
 
 
2371
void
 
2372
cm_headitem (void)
 
2373
{
 
2374
  headitem_flag = 1;
 
2375
  cm_item ();
 
2376
}