File: html.h

package info (click to toggle)
jp2a 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 5,028 kB
  • sloc: ansic: 2,230; sh: 160; makefile: 51
file content (181 lines) | stat: -rw-r--r-- 4,296 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*! \file
 * \noop Copyright 2020 Christoph Raitzig
 * 
 * \brief HTML/XHTML functions.
 *
 * \author Christoph Raitzig
 * \copyright Distributed under the GNU General Public License (GPL) v2.
 */

#ifndef INC_JP2A_HTML_H
#define INC_JP2A_HTML_H

#include "config.h"

/*!
 * \brief Prints the start of a HTML document.
 *
 * \param fontsize font size
 * \param fout stream to print to
 */
void print_html_document_start(const int fontsize, FILE *fout);

/*!
 * \brief Prints the start of a HTML image.
 *
 * \param f stream to print to
 */
void print_html_image_start(FILE *f);

/*!
 * \brief Prints the end of a HTML document.
 *
 * \param fout stream to print to
 */
void print_html_document_end(FILE *fout);

/*!
 * \brief Prints the end of a HTML image.
 *
 * \param f stream to print to
 */
void print_html_image_end(FILE *f);
#if ASCII

/*!
 * \brief Prints a char of the output image for HTML.
 *
 * \param fout stream to print to
 * \param ch char to print
 * \param red_fg,green_fg,blue_fg foreground color
 * \param red_bg,green_bg,blue_bg background color
 */
void print_html_char(FILE *fout, const char ch,
	const int red_fg, const int green_fg, const int blue_fg,
	const int red_bg, const int green_bg, const int blue_bg);
#else

/*!
 * \brief Prints a char of the output image for HTML.
 *
 * \param fout stream to print to
 * \param ch char to print
 * \param red_fg,green_fg,blue_fg foreground color
 * \param red_bg,green_bg,blue_bg background color
 */
void print_html_char(FILE *fout, const char* ch,
	const int red_fg, const int green_fg, const int blue_fg,
	const int red_bg, const int green_bg, const int blue_bg);
#endif

/*!
 * \brief Prints a new line (for HTML, i.e. "<br>").
 *
 * \param fout stream to print to
 */
void print_html_newline(FILE *fout);

/*!
 * \brief Prints the start of a XHTML document.
 *
 * \param fontsize font size
 * \param fout stream to print to
 */
void print_xhtml_document_start(const int fontsize, FILE *fout);

/*!
 * \brief Prints the start of a XHTML image.
 *
 * \param f stream to print to
 */
void print_xhtml_image_start(FILE *f);

/*!
 * \brief Prints the end of a XHTML document.
 *
 * \param fout stream to print to
 */
void print_xhtml_document_end(FILE *fout);

/*!
 * \brief Prints the end of a XHTML image.
 *
 * \param f stream to print to
 */
void print_xhtml_image_end(FILE *f);
#if ASCII

/*!
 * \brief Prints a char of the output image for XHTML.
 *
 * \param fout stream to print to
 * \param ch char to print
 * \param red_fg,green_fg,blue_fg foreground color
 * \param red_bg,green_bg,blue_bg background color
 */
void print_xhtml_char(FILE *fout, const char ch,
	const int red_fg, const int green_fg, const int blue_fg,
	const int red_bg, const int green_bg, const int blue_bg);
#else

/*!
 * \brief Prints a char of the output image for XHTML.
 *
 * \param fout stream to print to
 * \param ch char to print
 * \param red_fg,green_fg,blue_fg foreground color
 * \param red_bg,green_bg,blue_bg background color
 */
void print_xhtml_char(FILE *fout, const char* ch,
	const int red_fg, const int green_fg, const int blue_fg,
	const int red_bg, const int green_bg, const int blue_bg);
#endif

/*!
 * \brief Prints a new line (for XHTML, i.e. "<br/>").
 *
 * \param fout stream to print to
 */
void print_xhtml_newline(FILE *fout);
#if ASCII

/*!
 * \brief Converts a char to a HTML entity if necessary.
 *
 * For example, "<" is converted to "&lt;".
 *
 * \param ch char to convert
 * \return the HTML entity or the original char if a conversion is not necassary
 */
const char* html_entity(const char ch);
#else

/*!
 * \brief Converts a char to a HTML entity if necessary.
 *
 * For example, "<" is converted to "&lt;".
 *
 * \param ch char to convert
 * \return the HTML entity or the original char if a conversion is not necassary
 */
const char* html_entity(const char* ch);
#endif

/*!
 * \brief Prints the CSS for a HTML/XHTML document.
 *
 * \param fontsize font size
 * \param f stream to print to
 */
void print_css(const int fontsize, FILE *f);

/*!
 * \brief Escapes the title as necesary.
 *
 * Takes the title in #html_title_raw and escapes chars to HTML entities as necessary and saves the resulting title in #html_title.
 *
 * \return true if successful, false otherwise
 */
int escape_title();

#endif