2 /* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
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"
38 typedef enum {I_TAG, B_TAG, P_TAG, SUB_TAG, SUP_TAG, TT_TAG,
39 PRE_TAG, SMALL_TAG, BIG_TAG, BREAK_TAG,
42 typedef struct tag_definition {
52 * the state of the current paragraph.
53 * It allows post-html.cpp to request font changes, paragraph start/end
54 * and emits balanced tags with a small amount of peephole optimization.
59 html_text (simple_output *op);
61 void flush_text (void);
62 void do_emittext (const char *s, int length);
63 void do_italic (void);
70 void do_para (const char *arg, int space); // used for no indentation
71 void do_para (simple_output *op, const char *arg1,
72 int indentation, int pageoffset, int linelength,
78 void do_newline (void);
79 void do_table (const char *arg);
80 void done_bold (void);
81 void done_italic (void);
82 char *done_para (void);
87 void done_small (void);
89 void do_color (color *c);
90 void done_color (void);
91 int emitted_text (void);
92 int ever_emitted_text (void);
93 int starts_with_space (void);
94 int retrieve_para_space (void);
95 void emit_space (void);
97 int uses_indent (void);
98 void remove_tag (HTML_TAG tag);
99 void remove_sub_sup (void);
100 void remove_para_align (void);
101 void remove_para_space (void);
102 char *get_alignment (void);
105 tag_definition *stackptr; /* the current paragraph state */
106 tag_definition *lastptr; /* the end of the stack */
108 int space_emitted; /* just emitted a space? */
109 int current_indentation; /* current .in value */
110 int pageoffset; /* .po value */
111 int linelength; /* current line length */
112 int blank_para; /* have we ever written text? */
113 int start_space; /* does para start with a .sp */
114 html_indent *indent; /* our indent class */
116 int is_present (HTML_TAG t);
117 void end_tag (tag_definition *t);
118 void start_tag (tag_definition *t);
119 void do_para (const char *arg, html_indent *in, int space);
120 void push_para (HTML_TAG t);
121 void push_para (HTML_TAG t, void *arg, html_indent *in);
122 void push_para (color *c);
123 void do_push (tag_definition *p);
124 char *shutdown (HTML_TAG t);
125 void check_emit_text (tag_definition *t);
126 int remove_break (void);
127 void issue_tag (const char *tagname, const char *arg, int space=2);
128 void issue_color_begin (color *c);
129 void remove_def (tag_definition *t);
130 html_indent *remove_indent (HTML_TAG tag);
131 void dump_stack_element (tag_definition *p);
132 void dump_stack (void);