17 #include <grass/gis.h>
18 #include <grass/glocale.h>
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");
46 fprintf(stdout,
"<title>%s - GRASS GIS manual</title>\n",
st->pgm_name);
48 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
50 "<link rel=\"stylesheet\" href=\"grassdocs.css\" type=\"text/css\">\n");
51 fprintf(stdout,
"</head>\n");
52 fprintf(stdout,
"<body bgcolor=\"white\">\n");
53 fprintf(stdout,
"<div id=\"container\">\n\n");
55 "<a href=\"index.html\"><img src=\"grass_logo.png\" alt=\"GRASS logo\"></a>\n");
56 fprintf(stdout,
"<hr class=\"header\">\n\n");
57 fprintf(stdout,
"<h2>%s</h2>\n", _(
"NAME"));
58 fprintf(stdout,
"<em><b>%s</b></em> ",
st->pgm_name);
60 if (
st->module_info.label ||
st->module_info.description)
61 fprintf(stdout,
" - ");
63 if (
st->module_info.label)
64 fprintf(stdout,
"%s<BR>\n",
st->module_info.label);
66 if (
st->module_info.description)
67 fprintf(stdout,
"%s\n",
st->module_info.description);
70 fprintf(stdout,
"<h2>%s</h2>\n", _(
"KEYWORDS"));
71 if (
st->module_info.keywords) {
73 fprintf(stdout,
"\n");
75 fprintf(stdout,
"<h2>%s</h2>\n", _(
"SYNOPSIS"));
76 fprintf(stdout,
"<div id=\"name\"><b>%s</b><br></div>\n",
st->pgm_name);
77 fprintf(stdout,
"<b>%s --help</b><br>\n",
st->pgm_name);
79 fprintf(stdout,
"<div id=\"synopsis\"><b>%s</b>",
st->pgm_name);
83 flag = &
st->first_flag;
84 fprintf(stdout,
" [-<b>");
85 while (flag !=
NULL) {
86 fprintf(stdout,
"%c", flag->key);
87 flag = flag->next_flag;
89 fprintf(stdout,
"</b>] ");
95 opt = &
st->first_option;
98 if (opt->key_desc !=
NULL)
116 fprintf(stdout,
" [");
117 fprintf(stdout,
"<b>%s</b>=<em>%s</em>", opt->key, type);
119 fprintf(stdout,
"[,<i>%s</i>,...]", type);
122 fprintf(stdout,
"] ");
125 fprintf(stdout,
" ");
129 fprintf(stdout,
" [--<b>overwrite</b>] ");
131 fprintf(stdout,
" [--<b>help</b>] ");
132 fprintf(stdout,
" [--<b>verbose</b>] ");
133 fprintf(stdout,
" [--<b>quiet</b>] ");
134 fprintf(stdout,
" [--<b>ui</b>] ");
136 fprintf(stdout,
"\n</div>\n");
139 fprintf(stdout,
"\n");
140 fprintf(stdout,
"<div id=\"flags\">\n");
141 fprintf(stdout,
"<h3>%s:</h3>\n", _(
"Flags"));
142 fprintf(stdout,
"<dl>\n");
144 flag = &
st->first_flag;
145 while (
st->n_flags && flag !=
NULL) {
146 fprintf(stdout,
"<dt><b>-%c</b></dt>\n", flag->key);
149 fprintf(stdout,
"<dd>");
150 fprintf(stdout,
"%s", flag->label);
151 fprintf(stdout,
"</dd>\n");
154 if (flag->description) {
155 fprintf(stdout,
"<dd>");
156 fprintf(stdout,
"%s", flag->description);
157 fprintf(stdout,
"</dd>\n");
160 flag = flag->next_flag;
161 fprintf(stdout,
"\n");
165 fprintf(stdout,
"<dt><b>--overwrite</b></dt>\n");
166 fprintf(stdout,
"<dd>%s</dd>\n",
167 _(
"Allow output files to overwrite existing files"));
170 fprintf(stdout,
"<dt><b>--help</b></dt>\n");
171 fprintf(stdout,
"<dd>%s</dd>\n", _(
"Print usage summary"));
173 fprintf(stdout,
"<dt><b>--verbose</b></dt>\n");
174 fprintf(stdout,
"<dd>%s</dd>\n", _(
"Verbose module output"));
176 fprintf(stdout,
"<dt><b>--quiet</b></dt>\n");
177 fprintf(stdout,
"<dd>%s</dd>\n", _(
"Quiet module output"));
179 fprintf(stdout,
"<dt><b>--ui</b></dt>\n");
180 fprintf(stdout,
"<dd>%s</dd>\n", _(
"Force launching GUI dialog"));
182 fprintf(stdout,
"</dl>\n");
183 fprintf(stdout,
"</div>\n");
185 fprintf(stdout,
"\n");
186 fprintf(stdout,
"<div id=\"parameters\">\n");
188 opt = &
st->first_option;
189 fprintf(stdout,
"<h3>%s:</h3>\n", _(
"Parameters"));
190 fprintf(stdout,
"<dl>\n");
192 while (opt !=
NULL) {
194 if (opt->key_desc !=
NULL)
195 type = opt->key_desc;
211 fprintf(stdout,
"<dt><b>%s</b>=<em>%s", opt->key, type);
213 fprintf(stdout,
"[,<i>%s</i>,...]", type);
215 fprintf(stdout,
"</em>");
217 fprintf(stdout,
" <b>[required]</b>");
219 fprintf(stdout,
"</dt>\n");
222 fprintf(stdout,
"<dd>");
223 print_escaped_for_html(stdout, opt->label);
224 fprintf(stdout,
"</dd>\n");
226 if (opt->description) {
227 fprintf(stdout,
"<dd>");
228 print_escaped_for_html(stdout, opt->description);
229 fprintf(stdout,
"</dd>\n");
233 fprintf(stdout,
"<dd>%s: <em>", _(
"Options"));
234 print_escaped_for_html_options(stdout, opt->options);
235 fprintf(stdout,
"</em></dd>\n");
239 fprintf(stdout,
"<dd>%s: <em>", _(
"Default"));
240 print_escaped_for_html(stdout, opt->def);
241 fprintf(stdout,
"</em></dd>\n");
247 while (opt->opts[i]) {
249 fprintf(stdout,
"<dd><b>");
250 if (opt->gisprompt) {
251 char *thumbnails =
NULL;
253 if (strcmp(opt->gisprompt,
254 "old,colortable,colortable") == 0)
255 thumbnails =
"colortables";
256 else if (strcmp(opt->gisprompt,
257 "old,barscale,barscale") == 0)
258 thumbnails =
"barscales";
259 else if (strcmp(opt->gisprompt,
260 "old,northarrow,northarrow") == 0)
261 thumbnails =
"northarrows";
264 fprintf(stdout,
"<img height=\"12\" "
265 "style=\"max-width: 80;\" "
266 "src=\"%s/%s.png\" alt=\"%s\"> ",
267 thumbnails, opt->opts[i], opt->opts[i]);
269 print_escaped_for_html(stdout, opt->opts[i]);
270 fprintf(stdout,
"</b>: ");
271 print_escaped_for_html(stdout, opt->descs[i]);
272 fprintf(stdout,
"</dd>\n");
279 fprintf(stdout,
"\n");
281 fprintf(stdout,
"</dl>\n");
283 fprintf(stdout,
"</div>\n");
285 fprintf(stdout,
"</body>\n</html>\n");
292 #define do_escape(c,escaped) case c: fputs(escaped,f);break
293 void print_escaped_for_html(FILE * f,
const char *str)
297 for (s = str; *s; s++) {
303 do_escape(
'\t',
" ");
310 void print_escaped_for_html_options(FILE * f,
const char *str)
314 for (s = str; *s; s++) {
320 do_escape(
'\t',
" ");
328 void print_escaped_for_html_keywords(FILE * f,
const char * str)
333 if (
st->n_keys > 1 &&
334 strcmp(
st->module_info.keywords[1], str) == 0) {
339 fprintf(f,
"<a href=\"topic_");
340 for (s = str; *s; s++) {
347 fprintf(f,
".html\">%s</a>", str);
350 if (
st->n_keys > 0 &&
351 strcmp(
st->module_info.keywords[0], str) == 0) {
355 fprintf(f,
"<a href=\"");
356 for (s = str; *s; s++) {
363 fprintf(f,
".html\">%s</a>", str);
366 if (
st->n_keys > 0 &&
367 strcmp(
st->module_info.keywords[2], str) == 0) {
370 fprintf(f,
"<a href=\"keywords.html#%s\">%s</a>", str, str);
372 fprintf(f,
"<a href=\"keywords.html#%s\">%s</a>", str, str);
int G__uses_new_gisprompt(void)
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.
void G__usage_html(void)
Print module usage description in HTML format.
const char * G_program_name(void)
Return module name.