20 #include "parser_local_proto.h"
22 static void print_escaped_for_html(FILE *,
const char *);
23 static void print_escaped_for_html_options(FILE *,
const char *);
24 static void print_escaped_for_html_keywords(FILE *,
const char *);
45 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
46 fprintf(stdout,
"<html>\n<head>\n");
47 fprintf(stdout,
" <meta http-equiv=\"Content-Type\" content=\"text/html; "
48 "charset=utf-8\">\n");
50 " <meta name=\"Author\" content=\"GRASS Development Team\">\n");
52 " <meta http-equiv=\"content-language\" content=\"en-us\">\n");
53 fprintf(stdout,
" <meta name=\"viewport\" content=\"width=device-width, "
54 "initial-scale=1\">\n");
55 fprintf(stdout,
" <title>%s - GRASS GIS manual</title>\n",
st->pgm_name);
56 fprintf(stdout,
" <meta name=\"description\" content=\"%s",
st->pgm_name);
57 if (
st->module_info.description)
58 fprintf(stdout,
": %s\">",
st->module_info.description);
60 fprintf(stderr,
"<%s.html> is missing the description",
st->pgm_name);
61 fprintf(stdout,
"\n");
62 if (
st->module_info.keywords) {
63 fprintf(stdout,
" <meta name=\"keywords\" content=\"");
65 fprintf(stdout,
"\">");
66 fprintf(stdout,
"\n");
68 fprintf(stdout,
" <link rel=\"stylesheet\" href=\"grassdocs.css\" "
69 "type=\"text/css\">\n");
70 fprintf(stdout,
"</head>\n");
71 fprintf(stdout,
"<body bgcolor=\"white\">\n");
72 fprintf(stdout,
"<div id=\"container\">\n\n");
73 fprintf(stdout,
"<a href=\"index.html\"><img src=\"grass_logo.png\" "
74 "alt=\"GRASS logo\"></a>\n");
75 fprintf(stdout,
"<hr class=\"header\">\n\n");
76 fprintf(stdout,
"<h2>%s</h2>\n",
_(
"NAME"));
77 fprintf(stdout,
"<em><b>%s</b></em> ",
st->pgm_name);
79 if (
st->module_info.label ||
st->module_info.description)
80 fprintf(stdout,
" - ");
82 if (
st->module_info.label)
83 fprintf(stdout,
"%s<BR>\n",
st->module_info.label);
85 if (
st->module_info.description)
86 fprintf(stdout,
"%s\n",
st->module_info.description);
88 fprintf(stdout,
"<h2>%s</h2>\n",
_(
"KEYWORDS"));
89 if (
st->module_info.keywords) {
91 fprintf(stdout,
"\n");
93 fprintf(stdout,
"<h2>%s</h2>\n",
_(
"SYNOPSIS"));
94 fprintf(stdout,
"<div id=\"name\"><b>%s</b><br></div>\n",
st->pgm_name);
95 fprintf(stdout,
"<b>%s --help</b><br>\n",
st->pgm_name);
97 fprintf(stdout,
"<div id=\"synopsis\"><b>%s</b>",
st->pgm_name);
101 flag = &
st->first_flag;
102 fprintf(stdout,
" [-<b>");
103 while (flag !=
NULL) {
104 fprintf(stdout,
"%c", flag->
key);
107 fprintf(stdout,
"</b>] ");
110 fprintf(stdout,
" ");
113 opt = &
st->first_option;
115 while (opt !=
NULL) {
134 fprintf(stdout,
" [");
135 fprintf(stdout,
"<b>%s</b>=<em>%s</em>", opt->
key, type);
137 fprintf(stdout,
"[,<i>%s</i>,...]", type);
140 fprintf(stdout,
"] ");
143 fprintf(stdout,
" ");
147 fprintf(stdout,
" [--<b>overwrite</b>] ");
149 fprintf(stdout,
" [--<b>help</b>] ");
150 fprintf(stdout,
" [--<b>verbose</b>] ");
151 fprintf(stdout,
" [--<b>quiet</b>] ");
152 fprintf(stdout,
" [--<b>ui</b>] ");
154 fprintf(stdout,
"\n</div>\n");
157 fprintf(stdout,
"\n");
158 fprintf(stdout,
"<div id=\"flags\">\n");
159 fprintf(stdout,
"<h3>%s:</h3>\n",
_(
"Flags"));
160 fprintf(stdout,
"<dl>\n");
162 flag = &
st->first_flag;
163 while (
st->n_flags && flag !=
NULL) {
164 fprintf(stdout,
"<dt><b>-%c</b></dt>\n", flag->
key);
167 fprintf(stdout,
"<dd>");
168 fprintf(stdout,
"%s", flag->
label);
169 fprintf(stdout,
"</dd>\n");
173 fprintf(stdout,
"<dd>");
175 fprintf(stdout,
"</dd>\n");
179 fprintf(stdout,
"\n");
183 fprintf(stdout,
"<dt><b>--overwrite</b></dt>\n");
184 fprintf(stdout,
"<dd>%s</dd>\n",
185 _(
"Allow output files to overwrite existing files"));
188 fprintf(stdout,
"<dt><b>--help</b></dt>\n");
189 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Print usage summary"));
191 fprintf(stdout,
"<dt><b>--verbose</b></dt>\n");
192 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Verbose module output"));
194 fprintf(stdout,
"<dt><b>--quiet</b></dt>\n");
195 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Quiet module output"));
197 fprintf(stdout,
"<dt><b>--ui</b></dt>\n");
198 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Force launching GUI dialog"));
200 fprintf(stdout,
"</dl>\n");
201 fprintf(stdout,
"</div>\n");
203 fprintf(stdout,
"\n");
204 fprintf(stdout,
"<div id=\"parameters\">\n");
206 opt = &
st->first_option;
207 fprintf(stdout,
"<h3>%s:</h3>\n",
_(
"Parameters"));
208 fprintf(stdout,
"<dl>\n");
210 while (opt !=
NULL) {
229 fprintf(stdout,
"<dt><b>%s</b>=<em>%s", opt->
key, type);
231 fprintf(stdout,
"[,<i>%s</i>,...]", type);
233 fprintf(stdout,
"</em>");
235 fprintf(stdout,
" <b>[required]</b>");
237 fprintf(stdout,
"</dt>\n");
240 fprintf(stdout,
"<dd>");
241 print_escaped_for_html(stdout, opt->
label);
242 fprintf(stdout,
"</dd>\n");
245 fprintf(stdout,
"<dd>");
247 fprintf(stdout,
"</dd>\n");
251 fprintf(stdout,
"<dd>%s: <em>",
_(
"Options"));
252 print_escaped_for_html_options(stdout, opt->
options);
253 fprintf(stdout,
"</em></dd>\n");
257 fprintf(stdout,
"<dd>%s: <em>",
_(
"Default"));
258 print_escaped_for_html(stdout, opt->
def);
259 fprintf(stdout,
"</em></dd>\n");
265 while (opt->
opts[i]) {
267 fprintf(stdout,
"<dd><b>");
269 char *thumbnails =
NULL;
272 "old,colortable,colortable") == 0)
273 thumbnails =
"colortables";
275 "old,barscale,barscale") == 0)
276 thumbnails =
"barscales";
278 "old,northarrow,northarrow") == 0)
279 thumbnails =
"northarrows";
283 "<img height=\"12\" "
284 "style=\"max-width: 80;\" "
285 "src=\"%s/%s.png\" alt=\"%s\"> ",
286 thumbnails, opt->
opts[i], opt->
opts[i]);
288 print_escaped_for_html(stdout, opt->
opts[i]);
289 fprintf(stdout,
"</b>: ");
290 print_escaped_for_html(stdout, opt->
descs[i]);
291 fprintf(stdout,
"</dd>\n");
298 fprintf(stdout,
"\n");
300 fprintf(stdout,
"</dl>\n");
302 fprintf(stdout,
"</div>\n");
304 fprintf(stdout,
"</div> <!-- end container -->\n");
305 fprintf(stdout,
"</body>\n</html>\n");
311 #define do_escape(c, escaped) \
315 void print_escaped_for_html(FILE *f,
const char *str)
319 for (s = str; *s; s++) {
325 do_escape(
'\t',
" ");
332 void print_escaped_for_html_options(FILE *f,
const char *str)
336 for (s = str; *s; s++) {
342 do_escape(
'\t',
" ");
350 void print_escaped_for_html_keywords(FILE *f,
const char *str)
355 if (
st->n_keys > 1 && strcmp(
st->module_info.keywords[1], str) == 0) {
360 fprintf(f,
"<a href=\"topic_");
361 for (s = str; *s; s++) {
368 fprintf(f,
".html\">%s</a>", str);
371 if (
st->n_keys > 0 && strcmp(
st->module_info.keywords[0], str) == 0) {
375 fprintf(f,
"<a href=\"");
376 for (s = str; *s; s++) {
383 fprintf(f,
".html\">%s</a>", str);
387 if (
st->n_keys > 0 &&
388 strcmp(
st->module_info.keywords[2], str) == 0) {
391 fprintf(f,
"<a href=\"keywords.html#%s\">%s</a>", str, str);
394 fprintf(f,
"<a href=\"keywords.html#%s\">%s</a>", str, str);
const char * G_program_name(void)
Return module name.
void G__print_keywords(FILE *fd, void(*format)(FILE *, const char *), int newline)
Print list of keywords (internal use only)
int G__uses_new_gisprompt(void)
#define do_escape(c, escaped)
Format text for HTML output.
void G__usage_html(void)
Print module usage description in HTML format.
Structure that stores flag info.
Structure that stores option information.