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 *);
44 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
45 fprintf(stdout,
"<html>\n<head>\n");
47 " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
48 fprintf(stdout,
" <title>%s - GRASS GIS manual</title>\n",
st->pgm_name);
49 fprintf(stdout,
" <meta name=\"description\" content=\"%s",
st->pgm_name);
50 if (
st->module_info.description)
51 fprintf(stdout,
": %s\">",
st->module_info.description);
53 fprintf(stderr,
"<%s.html> is missing the description",
st->pgm_name);
54 fprintf(stdout,
"\n");
55 if (
st->module_info.keywords) {
56 fprintf(stdout,
" <meta name=\"keywords\" content=\"");
58 fprintf(stdout,
"\">");
59 fprintf(stdout,
"\n");
62 " <link rel=\"stylesheet\" href=\"grassdocs.css\" type=\"text/css\">\n");
63 fprintf(stdout,
"</head>\n");
64 fprintf(stdout,
"<body bgcolor=\"white\">\n");
65 fprintf(stdout,
"<div id=\"container\">\n\n");
67 "<a href=\"index.html\"><img src=\"grass_logo.png\" alt=\"GRASS logo\"></a>\n");
68 fprintf(stdout,
"<hr class=\"header\">\n\n");
69 fprintf(stdout,
"<h2>%s</h2>\n",
_(
"NAME"));
70 fprintf(stdout,
"<em><b>%s</b></em> ",
st->pgm_name);
72 if (
st->module_info.label ||
st->module_info.description)
73 fprintf(stdout,
" - ");
75 if (
st->module_info.label)
76 fprintf(stdout,
"%s<BR>\n",
st->module_info.label);
78 if (
st->module_info.description)
79 fprintf(stdout,
"%s\n",
st->module_info.description);
82 fprintf(stdout,
"<h2>%s</h2>\n",
_(
"KEYWORDS"));
83 if (
st->module_info.keywords) {
85 fprintf(stdout,
"\n");
87 fprintf(stdout,
"<h2>%s</h2>\n",
_(
"SYNOPSIS"));
88 fprintf(stdout,
"<div id=\"name\"><b>%s</b><br></div>\n",
st->pgm_name);
89 fprintf(stdout,
"<b>%s --help</b><br>\n",
st->pgm_name);
91 fprintf(stdout,
"<div id=\"synopsis\"><b>%s</b>",
st->pgm_name);
95 flag = &
st->first_flag;
96 fprintf(stdout,
" [-<b>");
97 while (flag !=
NULL) {
98 fprintf(stdout,
"%c", flag->
key);
101 fprintf(stdout,
"</b>] ");
104 fprintf(stdout,
" ");
107 opt = &
st->first_option;
109 while (opt !=
NULL) {
128 fprintf(stdout,
" [");
129 fprintf(stdout,
"<b>%s</b>=<em>%s</em>", opt->
key, type);
131 fprintf(stdout,
"[,<i>%s</i>,...]", type);
134 fprintf(stdout,
"] ");
137 fprintf(stdout,
" ");
141 fprintf(stdout,
" [--<b>overwrite</b>] ");
143 fprintf(stdout,
" [--<b>help</b>] ");
144 fprintf(stdout,
" [--<b>verbose</b>] ");
145 fprintf(stdout,
" [--<b>quiet</b>] ");
146 fprintf(stdout,
" [--<b>ui</b>] ");
148 fprintf(stdout,
"\n</div>\n");
151 fprintf(stdout,
"\n");
152 fprintf(stdout,
"<div id=\"flags\">\n");
153 fprintf(stdout,
"<h3>%s:</h3>\n",
_(
"Flags"));
154 fprintf(stdout,
"<dl>\n");
156 flag = &
st->first_flag;
157 while (
st->n_flags && flag !=
NULL) {
158 fprintf(stdout,
"<dt><b>-%c</b></dt>\n", flag->
key);
161 fprintf(stdout,
"<dd>");
162 fprintf(stdout,
"%s", flag->
label);
163 fprintf(stdout,
"</dd>\n");
167 fprintf(stdout,
"<dd>");
169 fprintf(stdout,
"</dd>\n");
173 fprintf(stdout,
"\n");
177 fprintf(stdout,
"<dt><b>--overwrite</b></dt>\n");
178 fprintf(stdout,
"<dd>%s</dd>\n",
179 _(
"Allow output files to overwrite existing files"));
182 fprintf(stdout,
"<dt><b>--help</b></dt>\n");
183 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Print usage summary"));
185 fprintf(stdout,
"<dt><b>--verbose</b></dt>\n");
186 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Verbose module output"));
188 fprintf(stdout,
"<dt><b>--quiet</b></dt>\n");
189 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Quiet module output"));
191 fprintf(stdout,
"<dt><b>--ui</b></dt>\n");
192 fprintf(stdout,
"<dd>%s</dd>\n",
_(
"Force launching GUI dialog"));
194 fprintf(stdout,
"</dl>\n");
195 fprintf(stdout,
"</div>\n");
197 fprintf(stdout,
"\n");
198 fprintf(stdout,
"<div id=\"parameters\">\n");
200 opt = &
st->first_option;
201 fprintf(stdout,
"<h3>%s:</h3>\n",
_(
"Parameters"));
202 fprintf(stdout,
"<dl>\n");
204 while (opt !=
NULL) {
223 fprintf(stdout,
"<dt><b>%s</b>=<em>%s", opt->
key, type);
225 fprintf(stdout,
"[,<i>%s</i>,...]", type);
227 fprintf(stdout,
"</em>");
229 fprintf(stdout,
" <b>[required]</b>");
231 fprintf(stdout,
"</dt>\n");
234 fprintf(stdout,
"<dd>");
235 print_escaped_for_html(stdout, opt->
label);
236 fprintf(stdout,
"</dd>\n");
239 fprintf(stdout,
"<dd>");
241 fprintf(stdout,
"</dd>\n");
245 fprintf(stdout,
"<dd>%s: <em>",
_(
"Options"));
246 print_escaped_for_html_options(stdout, opt->
options);
247 fprintf(stdout,
"</em></dd>\n");
251 fprintf(stdout,
"<dd>%s: <em>",
_(
"Default"));
252 print_escaped_for_html(stdout, opt->
def);
253 fprintf(stdout,
"</em></dd>\n");
259 while (opt->
opts[i]) {
261 fprintf(stdout,
"<dd><b>");
263 char *thumbnails =
NULL;
266 "old,colortable,colortable") == 0)
267 thumbnails =
"colortables";
269 "old,barscale,barscale") == 0)
270 thumbnails =
"barscales";
272 "old,northarrow,northarrow") == 0)
273 thumbnails =
"northarrows";
276 fprintf(stdout,
"<img height=\"12\" " 277 "style=\"max-width: 80;\" " 278 "src=\"%s/%s.png\" alt=\"%s\"> ",
279 thumbnails, opt->
opts[i], opt->
opts[i]);
281 print_escaped_for_html(stdout, opt->
opts[i]);
282 fprintf(stdout,
"</b>: ");
283 print_escaped_for_html(stdout, opt->
descs[i]);
284 fprintf(stdout,
"</dd>\n");
291 fprintf(stdout,
"\n");
293 fprintf(stdout,
"</dl>\n");
295 fprintf(stdout,
"</div>\n");
297 fprintf(stdout,
"</body>\n</html>\n");
304 #define do_escape(c,escaped) case c: fputs(escaped,f);break 305 void print_escaped_for_html(FILE * f,
const char *str)
309 for (s = str; *s; s++) {
315 do_escape(
'\t',
" ");
322 void print_escaped_for_html_options(FILE * f,
const char *str)
326 for (s = str; *s; s++) {
332 do_escape(
'\t',
" ");
340 void print_escaped_for_html_keywords(FILE * f,
const char * str)
345 if (
st->n_keys > 1 &&
346 strcmp(
st->module_info.keywords[1], str) == 0) {
351 fprintf(f,
"<a href=\"topic_");
352 for (s = str; *s; s++) {
359 fprintf(f,
".html\">%s</a>", str);
362 if (
st->n_keys > 0 &&
363 strcmp(
st->module_info.keywords[0], str) == 0) {
367 fprintf(f,
"<a href=\"");
368 for (s = str; *s; s++) {
375 fprintf(f,
".html\">%s</a>", str);
378 if (
st->n_keys > 0 &&
379 strcmp(
st->module_info.keywords[2], str) == 0) {
382 fprintf(f,
"<a href=\"keywords.html#%s\">%s</a>", str, str);
384 fprintf(f,
"<a href=\"keywords.html#%s\">%s</a>", str, str);
int G__uses_new_gisprompt(void)
const char * G_program_name(void)
Return module name.
void G__usage_html(void)
Print module usage description in HTML format.
Structure that stores flag info.
Structure that stores option information.
void G__print_keywords(FILE *fd, void(*format)(FILE *, const char *))
Print list of keywords (internal use only)
#define do_escape(c, escaped)
Format text for HTML output.