2 /* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007
3 * Free Software Foundation, Inc.
5 * Gaius Mulley (gaius@glam.ac.uk) wrote html-text.h
9 * provides a state machine interface which generates html text.
13 This file is part of groff.
15 groff is free software; you can redistribute it and/or modify it under
16 the terms of the GNU General Public License as published by the Free
17 Software Foundation; either version 2, or (at your option) any later
20 groff is distributed in the hope that it will be useful, but WITHOUT ANY
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 You should have received a copy of the GNU General Public License along
26 with groff; see the file COPYING. If not, write to the Free Software
27 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
30 #include "html-table.h"
32 #define STYLE_VERTICAL_SPACE "1em"
35 * supported html dialects.
38 typedef enum {xhtml
, html4
} html_dialect
;
44 typedef enum {I_TAG
, B_TAG
, P_TAG
, SUB_TAG
, SUP_TAG
, TT_TAG
,
45 PRE_TAG
, SMALL_TAG
, BIG_TAG
, BREAK_TAG
,
48 typedef struct tag_definition
{
58 * the state of the current paragraph.
59 * It allows post-html.cpp to request font changes, paragraph start/end
60 * and emits balanced tags with a small amount of peephole optimization.
65 html_text (simple_output
*op
, html_dialect d
);
67 void flush_text (void);
68 void do_emittext (const char *s
, int length
);
69 void do_italic (void);
76 void do_para (const char *arg
, int space
); // used for no indentation
77 void do_para (simple_output
*op
, const char *arg1
,
78 int indentation
, int pageoffset
, int linelength
,
84 void do_newline (void);
85 void do_table (const char *arg
);
86 void done_bold (void);
87 void done_italic (void);
88 char *done_para (void);
93 void done_small (void);
95 void do_color (color
*c
);
96 void done_color (void);
97 int emitted_text (void);
98 int ever_emitted_text (void);
99 int starts_with_space (void);
100 int retrieve_para_space (void);
101 void emit_space (void);
102 int is_in_pre (void);
103 int uses_indent (void);
104 void remove_tag (HTML_TAG tag
);
105 void remove_sub_sup (void);
106 void remove_para_align (void);
107 void remove_para_space (void);
108 char *get_alignment (void);
111 tag_definition
*stackptr
; /* the current paragraph state */
112 tag_definition
*lastptr
; /* the end of the stack */
114 html_dialect dialect
; /* which dialect of html? */
115 int space_emitted
; /* just emitted a space? */
116 int current_indentation
; /* current .in value */
117 int pageoffset
; /* .po value */
118 int linelength
; /* current line length */
119 int blank_para
; /* have we ever written text? */
120 int start_space
; /* does para start with a .sp */
121 html_indent
*indent
; /* our indent class */
123 int is_present (HTML_TAG t
);
124 void end_tag (tag_definition
*t
);
125 void start_tag (tag_definition
*t
);
126 void do_para (const char *arg
, html_indent
*in
, int space
);
127 void push_para (HTML_TAG t
);
128 void push_para (HTML_TAG t
, void *arg
, html_indent
*in
);
129 void push_para (color
*c
);
130 void do_push (tag_definition
*p
);
131 char *shutdown (HTML_TAG t
);
132 void check_emit_text (tag_definition
*t
);
133 int remove_break (void);
134 void issue_tag (const char *tagname
, const char *arg
, int space
=2);
135 void issue_color_begin (color
*c
);
136 void remove_def (tag_definition
*t
);
137 html_indent
*remove_indent (HTML_TAG tag
);
138 void dump_stack_element (tag_definition
*p
);
139 void dump_stack (void);