diff options
author | wlemb <wlemb> | 2001-12-30 14:48:02 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2001-12-30 14:48:02 +0000 |
commit | 44c8d00f312e6ed0fdf9e0e1f2fcf6aa32592640 (patch) | |
tree | 0c8ab795ad3cdc662dbcfbf27951d49e95845ce5 | |
parent | 9584a2c788cc2ef79e3ce9d80175f261fc3c2056 (diff) | |
download | groff-44c8d00f312e6ed0fdf9e0e1f2fcf6aa32592640.tar.gz |
* tmac/www.tmac: Replace\\n[www-html] with \n[www-html] since the
device is already known at start-up.
Make all names of internal macros/registers/strings lowercase, and
prepend `www-'.
Other minor changes.
* src/roff/troff/troff.man: Add preprocessor string at BOF.
Implement option `-b' in grohtml to set the HTML background colour.
* src/devices/grohtml/post-html.cc (default_background): New global
variable.
(html_printer::html_printer): Initialize `background' to
`default_background'.
(main): Implement option `-b'.
(usage): Updated.
* src/preproc/html/pre-html.cc (scanArguments): Add dummy handling
of `-b' option.
* src/devices/grohtml/grohtml.man: Updated.
* doc/Makefile (.ms.html): Use `-b'.
* tmac/html.tmac: Don't set background color.
Add new grohtml tag `.html-tl'.
* src/devices/grohtml/post-html.cc (title_desc): Add `with_h1'
member variable.
(title_desc::title_desc): Updated.
(html_printer::troff_tag): Handle `.html-tl'.
(html_printer::write_title): Use `with_h1'.
* tmac/www.tmac (www-end-nowhere): New auxiliary macro.
(HTML-TL): New macro.
Add support for unordered lists in HTML.
* tmac/www.tmac (www-level): New auxiliary register.
(www-level1, www-level2, www-level3): New auxiliary strings.
(www-push-level, www-pop-level): New auxiliary macros
(UL-BEGIN, UL-END, LI): User macros for unordered lists.
Miscellaneous.
* src/preproc/html/pre-html.cc (DEFAULT_IMAGE_RES): Increase to 100.
(DEFAULT_VERTICAL_OFFSET): Removed.
(IMAGE_BOARDER_PIXELS): Set to 0.
(A4_LENGTH, A4_OFFSET, LETTER_LENGTH, LETTER_OFFSET): New macros.
(vertical_offset): Initialize with 0.
(gsPaper): New global variable.
(get_resolution): Scan for and return unsigned int.
(get_papersize): New function to get paper length from devps/DESC.
(determine_vertical_offset): New function.
(createAllPages): Produce gray-level images and use proper page
length.
(createImage): Use `-quiet' option of pnmcrop.
(addZ): Fix passing of `-Z'.
(scanArguments): Fix handling of `-o'.
(main): Call `determine_vertical_offset'.
* src/devices/grohtml/post-html.cc (html_printer::draw): Comment out
code for `l'.
* src/libs/libgroff/tmpfile.cc (add_tmp_file): Fix buffer length.
* src/roff/troff/node.cc (troff_output_file::check_charinfo): Handle
glyph descenders properly.
* doc/homepage.ms: Include `gnubw.eps'.
* doc/Makefile (gnubw.eps): New rule.
(homepage.html): Depend on `gnubw.eps'.
-rw-r--r-- | ChangeLog | 71 | ||||
-rwxr-xr-x | doc/Makefile | 7 | ||||
-rwxr-xr-x | doc/homepage.ms | 22 | ||||
-rw-r--r-- | src/devices/grohtml/grohtml.man | 7 | ||||
-rw-r--r-- | src/devices/grohtml/post-html.cc | 30 | ||||
-rw-r--r-- | src/libs/libgroff/tmpfile.cc | 2 | ||||
-rw-r--r-- | src/preproc/html/pre-html.cc | 91 | ||||
-rw-r--r-- | src/roff/troff/node.cc | 3 | ||||
-rw-r--r-- | src/roff/troff/troff.man | 1 | ||||
-rw-r--r-- | tmac/html.tmac | 4 | ||||
-rw-r--r-- | tmac/www.tmac | 266 |
11 files changed, 373 insertions, 131 deletions
@@ -1,3 +1,74 @@ +2001-12-30 Werner LEMBERG <wl@gnu.org> + + * tmac/www.tmac: Replace\\n[www-html] with \n[www-html] since the + device is already known at start-up. + Make all names of internal macros/registers/strings lowercase, and + prepend `www-'. + Other minor changes. + + * src/roff/troff/troff.man: Add preprocessor string at BOF. + +2001-12-30 Gaius Mulley <gaius@glam.ac.uk> + + Implement option `-b' in grohtml to set the HTML background colour. + + * src/devices/grohtml/post-html.cc (default_background): New global + variable. + (html_printer::html_printer): Initialize `background' to + `default_background'. + (main): Implement option `-b'. + (usage): Updated. + * src/preproc/html/pre-html.cc (scanArguments): Add dummy handling + of `-b' option. + * src/devices/grohtml/grohtml.man: Updated. + * doc/Makefile (.ms.html): Use `-b'. + * tmac/html.tmac: Don't set background color. + + Add new grohtml tag `.html-tl'. + + * src/devices/grohtml/post-html.cc (title_desc): Add `with_h1' + member variable. + (title_desc::title_desc): Updated. + (html_printer::troff_tag): Handle `.html-tl'. + (html_printer::write_title): Use `with_h1'. + * tmac/www.tmac (www-end-nowhere): New auxiliary macro. + (HTML-TL): New macro. + + Add support for unordered lists in HTML. + + * tmac/www.tmac (www-level): New auxiliary register. + (www-level1, www-level2, www-level3): New auxiliary strings. + (www-push-level, www-pop-level): New auxiliary macros + (UL-BEGIN, UL-END, LI): User macros for unordered lists. + + Miscellaneous. + + * src/preproc/html/pre-html.cc (DEFAULT_IMAGE_RES): Increase to 100. + (DEFAULT_VERTICAL_OFFSET): Removed. + (IMAGE_BOARDER_PIXELS): Set to 0. + (A4_LENGTH, A4_OFFSET, LETTER_LENGTH, LETTER_OFFSET): New macros. + (vertical_offset): Initialize with 0. + (gsPaper): New global variable. + (get_resolution): Scan for and return unsigned int. + (get_papersize): New function to get paper length from devps/DESC. + (determine_vertical_offset): New function. + (createAllPages): Produce gray-level images and use proper page + length. + (createImage): Use `-quiet' option of pnmcrop. + (addZ): Fix passing of `-Z'. + (scanArguments): Fix handling of `-o'. + (main): Call `determine_vertical_offset'. + * src/devices/grohtml/post-html.cc (html_printer::draw): Comment out + code for `l'. + + * src/libs/libgroff/tmpfile.cc (add_tmp_file): Fix buffer length. + * src/roff/troff/node.cc (troff_output_file::check_charinfo): Handle + glyph descenders properly. + + * doc/homepage.ms: Include `gnubw.eps'. + * doc/Makefile (gnubw.eps): New rule. + (homepage.html): Depend on `gnubw.eps'. + 2001-12-25 Werner LEMBERG <wl@gnu.org> * src/roff/troff/input.cc (default_black): Fix return value. diff --git a/doc/Makefile b/doc/Makefile index 7aa8fecd..489a18bf 100755 --- a/doc/Makefile +++ b/doc/Makefile @@ -68,7 +68,7 @@ all: $(DOCS) GROFF_BIN_PATH=$(groff_bin_path); \ export GROFF_BIN_PATH; \ sed -e "s;@VERSION@;$(version)$(revision);" $< \ - | $(GROFF) -P-I`echo $< | sed -e 's|.ms$$||'` \ + | $(GROFF) -P-b -P-I`echo $< | sed -e 's|.ms$$||'` \ -P-D -Pimg -Thtml $(FFLAG) -U -ms >$@ .ms.ascii: @@ -93,6 +93,11 @@ all: $(DOCS) groff: groff.texinfo makeinfo groff.texinfo +gnubw.eps: gnubw-master-image + pngtopnm gnubw-master-image | pnmscale 0.1 | pnmtops -noturn > gnubw.eps + +homepage.html: gnubw.eps + install: clean: diff --git a/doc/homepage.ms b/doc/homepage.ms index 038f9d4f..815f654b 100755 --- a/doc/homepage.ms +++ b/doc/homepage.ms @@ -2,18 +2,21 @@ .\" with groff. .\" .\" -.\" To make it work with other output devices also, we include arkup.tmac +.\" To make it work with other output devices also, we include www.tmac .\" directly. .mso www.tmac -.\" -.LP -.\" -.\" set a longer line than the default as we have some long ftp addresses -.\" which groff cannot split -.nr LL 7i -.TL +.defcolor darkred rgb 0.65f 0.1f 0.2f +.defcolor darkgreen rgb 0.1f 0.5f 0.2f +.defcolor darkblue rgb 0.1f 0.2f 0.6f +.ds GNU \m[darkred]G\mP\m[darkgreen]N\mP\m[darkblue]U\mP +.nr LL 8i +.HTML-TL Home of Groff (GNU Troff). -.sp 1i +.HTML-IMAGE-LEFT +.PSPIC -L gnubw.eps 1i 1i +\v'-0.5i'\h'1.0i'\s[40]\*[GNU] Troff\s0 +.HTML-IMAGE-END +.sp .LP GNU Troff .URL (Groff) http://groff.ffii.org/ @@ -24,6 +27,7 @@ Hosted by .URL FFII http://ffii.org/ . .br .LINE +.LINKS .LP Groff (GNU Troff) is a document processor which reads plain text mixed with formatting commands and produces formatted output. diff --git a/src/devices/grohtml/grohtml.man b/src/devices/grohtml/grohtml.man index b39194a4..0d537108 100644 --- a/src/devices/grohtml/grohtml.man +++ b/src/devices/grohtml/grohtml.man @@ -81,6 +81,9 @@ using option. .SH OPTIONS .TP +.B -b +initialize the background color to white. +.TP .B -h Generates section and number headings by using .BR <B> .\|.\|. </B> @@ -113,8 +116,8 @@ is the name of the device, usually .TP .BI \-i resolution Select the resolution for all images. -By default this is 80 pixels per inch. -Example: -i100 indicates 100 pixels per inch. +By default this is 100 pixels per inch. +Example: -i200 indicates 200 pixels per inch. .TP .BI \-I stem Determine the image stem name. diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc index ecc2ba0a..8d8b77fe 100644 --- a/src/devices/grohtml/post-html.cc +++ b/src/devices/grohtml/post-html.cc @@ -74,6 +74,7 @@ static int auto_rule = TRUE; /* by default we enable an static int simple_anchors = FALSE; /* default to anchors with heading text */ static int manufacture_headings = FALSE; /* default is to use the Hn html headings, */ /* rather than manufacture our own. */ +static color *default_background = NULL; /* has user requested initial bg color? */ /* @@ -1075,12 +1076,13 @@ public: int has_been_written; int has_been_found; + int with_h1; string text; }; title_desc::title_desc () - : has_been_written(FALSE), has_been_found(FALSE) + : has_been_written(FALSE), has_been_found(FALSE), with_h1(FALSE) { } @@ -1994,6 +1996,11 @@ void html_printer::troff_tag (text_glob *g) do_center(a); } else if (strncmp(t, ".tl", 3) == 0) { supress_sub_sup = TRUE; + title.with_h1 = TRUE; + do_title(); + } else if (strncmp(t, ".html-tl", 8) == 0) { + supress_sub_sup = TRUE; + title.with_h1 = FALSE; do_title(); } else if (strncmp(t, ".fi", 3) == 0) { do_fill(TRUE); @@ -2360,6 +2367,7 @@ void html_printer::draw(int code, int *p, int np, const environment *env) switch (code) { case 'l': +# if 0 if (np == 2) { page_contents->add_line(&sbuf_style, line_number, @@ -2367,6 +2375,7 @@ void html_printer::draw(int code, int *p, int np, const environment *env) } else { error("2 arguments required for line"); } +# endif break; case 't': { @@ -2435,7 +2444,7 @@ html_printer::html_printer() indentation(0), prev_indent(0), line_number(0), - background(NULL) + background(default_background) { #if defined(DEBUGGING) file_list.add_new_file(stdout); @@ -2617,9 +2626,11 @@ void html_printer::write_title (int in_head) html.put_string("</title>").nl().nl(); } else { title.has_been_written = TRUE; - html.put_string("<h1 align=center>"); - html.put_string(title.text); - html.put_string("</h1>").nl().nl(); + if (title.with_h1) { + html.put_string("<h1 align=center>"); + html.put_string(title.text); + html.put_string("</h1>").nl().nl(); + } } } else if (in_head) { // place empty title tags to help conform to `tidy' @@ -2821,13 +2832,18 @@ int main(int argc, char **argv) { "version", no_argument, 0, 'v' }, { NULL, 0, 0, 0 } }; - while ((c = getopt_long(argc, argv, "o:i:I:D:F:vdhlrn", long_options, NULL)) + while ((c = getopt_long(argc, argv, "o:i:I:D:F:vbdhlrn", long_options, NULL)) != EOF) switch(c) { case 'v': printf("GNU post-grohtml (groff) version %s\n", Version_string); exit(0); break; + case 'b': + // set background color to white + default_background = new color; + default_background->set_rgb(1.0, 1.0, 1.0); + break; case 'F': font::command_line_font_dir(optarg); break; @@ -2882,6 +2898,6 @@ int main(int argc, char **argv) static void usage(FILE *stream) { - fprintf(stream, "usage: %s [-vlnh] [-D dir] [-I image_stem] [-F dir] [files ...]\n", + fprintf(stream, "usage: %s [-vblnh] [-D dir] [-I image_stem] [-F dir] [files ...]\n", program_name); } diff --git a/src/libs/libgroff/tmpfile.cc b/src/libs/libgroff/tmpfile.cc index 10fcde15..d9a5dfe2 100644 --- a/src/libs/libgroff/tmpfile.cc +++ b/src/libs/libgroff/tmpfile.cc @@ -140,7 +140,7 @@ xtmpfile_list_init::~xtmpfile_list_init() static void add_tmp_file(const char *name) { - char *s = new char[strlen(name)]; + char *s = new char[strlen(name)+1]; strcpy(s, name); xtmpfile_list *x = new xtmpfile_list(s); x->next = xtmpfiles_to_delete; diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc index 4492810b..c3f694a3 100644 --- a/src/preproc/html/pre-html.cc +++ b/src/preproc/html/pre-html.cc @@ -57,15 +57,14 @@ extern "C" const char *Version_string; #include "pushback.h" #include "html-strings.h" -#define DEFAULT_IMAGE_RES 80 // 80 pixels per inch resolution -#ifdef PAGEA4 -# define DEFAULT_VERTICAL_OFFSET 0 // DEFAULT_VERTICAL_OFFSET/72 of an inch -#else -# define DEFAULT_VERTICAL_OFFSET 50 // DEFAULT_VERTICAL_OFFSET/72 of an inch -#endif -#define IMAGE_BOARDER_PIXELS 2 +#define DEFAULT_IMAGE_RES 100 // number of pixels per inch resolution +#define IMAGE_BOARDER_PIXELS 0 #define MAX_WIDTH 8 // inches #define INLINE_LEADER_CHAR '\\' +#define A4_LENGTH 841890 // taken from devps/Makefile.sub +#define LETTER_LENGTH 792000 // taken from devps/Makefile.sub +#define A4_OFFSET 0 +#define LETTER_OFFSET 50 // 50/72 of an inch #define TRANSPARENT "-background white -transparent white" @@ -100,10 +99,11 @@ static char *regionFileName = NULL; // name of file containing all i static char *imagePageStem = NULL; // stem of all files containing page images static char *image_device = "pnmraw"; static int image_res = DEFAULT_IMAGE_RES; -static int vertical_offset= DEFAULT_VERTICAL_OFFSET; +static int vertical_offset= 0; static char *image_template = NULL; // image template filename static int troff_arg = 0; // troff arg index static char *image_dir = NULL; // user specified image directory +static char *gsPaper = NULL; // the paper size that gs must use #if defined(DEBUGGING) static int debug = FALSE; static char *troffFileName = NULL; // output of pre-html output which is sent to troff -Tps @@ -139,17 +139,42 @@ void sys_fatal (const char *s) * get_resolution - returns the postscript resolution from devps/DESC */ -static int get_resolution (void) +static unsigned int get_resolution (void) +{ + char *pathp; + FILE *f; + unsigned int res; + int n; + int c; + f = font_path.open_file("devps/DESC", &pathp); + if (f == 0) sys_fatal("fopen"); + while (1) { + n = fscanf(f, " res %u", &res); + if (n < 0) sys_fatal("EOF"); + if (n >= 1) { + fclose(f); + return res; + } + while (( c = getc(f) ) != '\n') + if (c == EOF) sys_fatal("EOF"); + } +} + +/* + * get_papersize - returns an integer determining the paper length from devps/DESC + */ + +static int get_papersize (void) { char *pathp; FILE *f; - unsigned long int res; + int res; int n; int c; f = font_path.open_file("devps/DESC", &pathp); if (f == 0) sys_fatal("fopen"); while (1) { - n = fscanf(f, " res %lu", &res); + n = fscanf(f, " paperlength %d", &res); if (n < 0) sys_fatal("EOF"); if (n >= 1) { fclose(f); @@ -161,6 +186,17 @@ static int get_resolution (void) } /* + * determine_vertical_offset - works out the default vertical offset from + * the page length + */ + +static void determine_vertical_offset (void) +{ + vertical_offset = ((A4_LENGTH-get_papersize())*72)/postscriptRes; + gsPaper = "-sPAPERSIZE=a4"; +} + +/* * html_system - a wrapper for system() */ @@ -734,9 +770,11 @@ static int createAllPages (void) } s = make_message("echo showpage | " - "gs%s -q -dSAFER -sDEVICE=%s -r%d " + "gs%s %s -q -dSAFER -sDEVICE=%s -r%d " + "-dTextAlphaBits=4 -dGraphicsAlphaBits=4 " "-sOutputFile=%s/%%d %s -", EXE_EXT, + gsPaper, image_device, image_res, imagePageStem, @@ -812,8 +850,7 @@ static void createImage (imageItem *i) int y1 = max((image_res*vertical_offset/72)+min(i->Y1, i->Y2)*image_res/postscriptRes-IMAGE_BOARDER_PIXELS, 0); int x2 = max(i->X1, i->X2)*image_res/postscriptRes+1*IMAGE_BOARDER_PIXELS; int y2 = (image_res*vertical_offset/72)+(max(i->Y1, i->Y2)*image_res/postscriptRes)+1+IMAGE_BOARDER_PIXELS; - - s = make_message("pnmcut%s %d %d %d %d < %s/%d | pnmcrop | pnmtopng%s %s > %s \n", + s = make_message("pnmcut%s %d %d %d %d < %s/%d | pnmcrop -quiet | pnmtopng%s %s > %s \n", EXE_EXT, x1, y1, x2-x1+1, y2-y1+1, imagePageStem, @@ -1022,7 +1059,7 @@ char **addZ (int argc, char *argv[]) if (new_argv == NULL) sys_fatal("malloc"); - while (i<troff_arg) { + if (argc > 0) { new_argv[i] = argv[i]; i++; } @@ -1207,18 +1244,21 @@ int scanArguments (int argc, char **argv) char *troff_name = new char[strlen(command_prefix) + strlen("troff") + 1]; strcpy(troff_name, command_prefix); strcat(troff_name, "troff"); - int c; + int c, i; static const struct option long_options[] = { { "help", no_argument, 0, CHAR_MAX + 1 }, { "version", no_argument, 0, 'v' }, { NULL, 0, 0, 0 } }; - while ((c = getopt_long(argc, argv, "+o:i:I:D:F:vdhlrn", long_options, NULL)) + while ((c = getopt_long(argc, argv, "+o:i:I:D:F:vbdhlrn", long_options, NULL)) != EOF) switch(c) { case 'v': printf("GNU pre-grohtml (groff) version %s\n", Version_string); exit(0); + case 'b': + // handled by post-grohtml (set background color to white) + break; case 'D': image_dir = optarg; break; @@ -1233,6 +1273,7 @@ int scanArguments (int argc, char **argv) break; case 'o': vertical_offset = atoi(optarg); + gsPaper = ""; // do not specify the paper size now break; case 'd': #if defined(DEBUGGING) @@ -1254,12 +1295,13 @@ int scanArguments (int argc, char **argv) break; } - while (optind < argc) { - if (strcmp(argv[optind], troff_name) == 0) - troff_arg = optind; - else if (argv[optind][0] != '-') - return optind; - optind++; + i = optind; + while (i < argc) { + if (strcmp(argv[i], troff_name) == 0) + troff_arg = i; + else if (argv[i][0] != '-') + return i; + i++; } a_delete troff_name; @@ -1322,8 +1364,9 @@ int main(int argc, char **argv) int found=0; int ok=1; - i = scanArguments(argc, argv); postscriptRes = get_resolution(); + determine_vertical_offset(); + i = scanArguments(argc, argv); checkImageDir(); makeFileName(); while (i < argc) { diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc index 68df49bf..14dce56a 100644 --- a/src/roff/troff/node.cc +++ b/src/roff/troff/node.cc @@ -977,8 +977,9 @@ void troff_output_file::check_charinfo(tfont *tf, charinfo *ci) int height = tf->get_char_height(ci).to_units(); int width = tf->get_width(ci).to_units() + tf->get_italic_correction(ci).to_units(); + int depth = tf->get_char_depth(ci).to_units(); check_output_limits(output_hpos, output_vpos - height); - check_output_limits(output_hpos + width, output_vpos); + check_output_limits(output_hpos + width, output_vpos + depth); } void troff_output_file::put_char_width(charinfo *ci, tfont *tf, hunits w, diff --git a/src/roff/troff/troff.man b/src/roff/troff/troff.man index 8968daa6..f97c258a 100644 --- a/src/roff/troff/troff.man +++ b/src/roff/troff/troff.man @@ -1,3 +1,4 @@ +'\" t .ig troff.man diff --git a/tmac/html.tmac b/tmac/html.tmac index cb4cc2f6..7f66ecfe 100644 --- a/tmac/html.tmac +++ b/tmac/html.tmac @@ -531,6 +531,6 @@ .defcolor yellow rgb #ffff00 .defcolor yellow1 rgb #fffc17 .defcolor yellowgreen rgb #52d017 -.\" background color defaults to white and glyph color to black -\M[white]\m[black]\c +.\" default glyph color to black (leave the background color alone) +\m[black]\c .\" end of file, make sure this is the last line diff --git a/tmac/www.tmac b/tmac/www.tmac index a226a68d..0f1bdd7b 100644 --- a/tmac/www.tmac +++ b/tmac/www.tmac @@ -5,28 +5,35 @@ .\" .nr _C \n(.C .cp 0 +. .nr www-html 0 -.if '\*(.T'html' .nr www-html 1 +.if '\*[.T]'html' .nr www-html 1 +. .if r ps4html \{\ -. \" remove the title command when we are generating images for html -. \" (stops a title accidentally appearing inside an image) -. tl ```` -. rm tl -. de tl -.. +. \" remove the title command when we are generating images for html +. \" (stops a title accidentally appearing inside an image) +. tl ```` +. rm tl +. de tl +. . .\} +. .\" -.\" +.\" the main auxiliary macro for the HTML interface .\" .de HTML -. if \\n[www-html] \{\ -.\" the following line makes the vertical mode leave, so to say -\& -\X^html:\\$*^ +. if \n[www-html] \{\ +. \" the following line makes the vertical mode leave, so to say +. nop \& +. nop \X^html:\\$*^ . \} .. +.\" +.\" +.\" .de HTMLINDEX -. if \\n[www-html] \X^index:\\$*^ +. if \n[www-html] \ +. nop \X^index:\\$*^ .. .\" .\" BODYCOLOR - $1 is foreground color @@ -50,24 +57,21 @@ .\" $3 is optional stuff printed immediately after $3 .\" .de URL -. ie \\n[www-html] \{\ +. ie \n[www-html] \ . HTML <a href="\\$2">\\$1</a>\\$3 -. \} -. el \{\ -\m[blue]\\$1\mP \%\(la\fC\\$2\fP\(ra\\$3 -. \} +. el \ +. nop \m[blue]\\$1\mP \%\[la]\fC\\$2\fP\[ra]\\$3 .. .\" .\" FTP - $1 is the classical underlined blue text .\" $2 is the ftp url .\" $3 is optional stuff printed immediately after $2 +.\" .de FTP -. ie \\n[www-html] \{\ +. ie \n[www-html] \ . HTML <a href=\\$2>\\$1</a>\\$3 -. \} -. el \{\ -\m[blue]\\$1\mP \%\(la\fC\\$2\fP\(ra\\$3 -. \} +. el \ +. nop \m[blue]\\$1\mP \%\[la]\fC\\$2\fP\[ra]\\$3 .. .\" .\" MAILTO - generate html email reference @@ -85,21 +89,17 @@ .\" force reset after a potential heading by performing some motion.. .\" how do we do this --fixme-- .\" \h'\w' ''\h'-\w' '' doesn't work.. -. ie \\n[www-html] \{\ -. ie '\\$2'' \{\ +. ie \n[www-html] \{\ +. ie '\\$2'' \ . HTML "<a href=mailto:\\$1>\\$1</a>\\$3" -. \} -. el \{\ +. el \ . HTML "<a href=mailto:\\$1>\\$2</a>\\$3" -. \} . \} . el \{\ -. ie '\\$2'' \{\ -\m[blue]\fC\\$1\fP\mP\\$3 -. \} -. el \{\ -\m[blue]\\$2\mP \%\(la\fC\\$1\fP\(ra\\$3 -. \} +. ie '\\$2'' \ +. nop \m[blue]\fC\\$1\fP\mP\\$3 +. el \ +. nop \m[blue]\\$2\mP \%\[la]\fC\\$1\fP\[ra]\\$3 . \} .. .\" @@ -111,87 +111,178 @@ .\" .\" IMAGE - reference an image .\" $1 is the image file -.\" $2 is the alignment r, l or c (center by default) -.\" $3 is the x width (default if absent 400 pixels) +.\" $2 is the alignment r, l or c (centered by default) +.\" $3 is the x width (default if absent is 400 pixels) .\" $4 is the y width (default if absent is the x value) .\" .de IMAGE -. ie \\n[www-html] \{\ -. ie '\\$2'r' .HTML-TAG ".right-image" +. ie \n[www-html] \{\ +. ie '\\$2'r' \ +. HTML-TAG ".right-image" . el \{\ -. ie '\\$2'l' .HTML-TAG ".left-image" -. el .HTML-TAG ".centered-image" -. \} -. nr HTMLWIDTH 400 -. if !'\\$3'' \{\ -. nr HTMLWIDTH \\$3 +. ie '\\$2'l' \ +. HTML-TAG ".left-image" +. el \ +. HTML-TAG ".centered-image" . \} -. nr HTMLHEIGHT \\n[HTMLWIDTH] -. if !'\\$4'' \{\ -. nr HTMLHEIGHT \\$4 -. \} -. HTML <img src="\\$1" width=\\n[HTMLWIDTH] height=\\n[HTMLHEIGHT]> +. nr www-width 400 +. if !'\\$3'' \ +. nr www-width \\$3 +. nr www-height \\n[www-width] +. if !'\\$4'' \ +. nr www-height \\$4 +. HTML <img src="\\$1" width=\\n[www-width] height=\\n[www-height]> . \} . el \{\ . B1 -\(la\fC\\$1\fP\(ra +. nop \[la]\fC\\$1\fP\[ra] . B2 . \} .. -.\" HTML-TAG - emit a tag for the new grohtml +.\" +.\" HTML-TAG - emit a tag for the grohtml +.\" .de HTML-TAG -. if \\n[www-html] \{\ -.\" the following line makes the vertical mode leave, so to say -\& -\X^html-tag:\\$*^ +. if \n[www-html] \{\ +. \" the following line makes the vertical mode leave, so to say +. nop \& +. nop \X^html-tag:\\$*^ . \} .. -.\" LINKS - emit the automatically collected links derived from section/numbered -.\" headings at this position. +.\" +.\" LINKS - emit the automatically collected links derived from +.\" section/numbered headings at this position. +.\" .de LINKS -. HTML-TAG ".links" +. HTML-TAG ".links" .. .\" .\" LINE - produce a horizontal line -.\" +.\" .de LINE -. ti 0 -. HTML <hr> +. ti 0 +. HTML <hr> .. .\" .\" NO-AUTO-RULE - suppresses the generation of the top and bottom rules .\" which grohtml emits by default. .\" .de NO-AUTO-RULE -. HTML-TAG ".no-auto-rule" +. HTML-TAG ".no-auto-rule" +.. +.\" +.\" www-end-nowhere - end of input trap called to finish diversion. +.\" +.de www-end-nowhere +. di +.. +.\" +.\" HTML-TL - generate a HTML title only +.\" which differs from the -ms .TL which generates +.\" both a HTML title and a H1 heading. +.\" This is useful when an author wishes to use a HTML title +.\" as search engine fodder but use a graphic in the document. +.\" +.de HTML-TL +. HTML-TAG ".html-tl" +. if !\n[www-html] \{\ +. di www-nowhere +. it 2 www-end-nowhere +. \} +.. +. +.ds www-level1 \[bu]\ \ \" +.ds www-level2 \[sq]\ \ \" +.ds www-level3 \[ci]\ \ \" +.nr www-level 0 +. +.\" +.\" auxiliary macro for UL-BEGIN +.\" +.de www-push-level +. nr www-level +1 +. if (\\n[www-level] > 3) \ +. @error "too many levels of indentation (\\n[www-level])" +.. +.\" +.\" auxiliary macro for UL-END +.\" +.de www-pop-level +. if !\\n[www-level] \ +. @error "trying to terminate a list which does not exist" +. nr www-level -1 +. HTML "</ul>" +.. +.\" +.\" start an unordered list +.\" +.de UL-BEGIN +. www-push-level +. ie \n[www-html] \ +. HTML "<ul>" +. el \{\ +. br +. in +\w'\\*[www-level\\n[www-level]]' +. \} +.. +.\" +.\" end an unordered list +.\" +.de UL-END +. ie \n[www-html] \ +. HTML "</ul>" +. el \{\ +. br +. in -\w'\\*[www-level\\n[www-level]]' +. \} +. www-pop-level +.. +.\" +.\" insert a list item +.\" +.de LI +. ie \n[www-html] \ +. HTML "<li>" +. el \{\ +. br +. ti -\w'\\*[www-level\\n[www-level]]' +. nop \\*[www-level\\n[www-level]]\c +. \} .. .\" -.\" supplimentary macros used by other macro sets +.\" supplementary macros used by other macro sets .\" .\" here are some tags specially for -Tps or -Thtml when invoked by pre-html .\" to generate png images from postscript. .\" -.\" HTML-DO-IMAGE - tells troff to issue an image marker which can be -.\" read back by pre-html +.\" www-do-image - tells troff to issue an image marker which can be +.\" read back by pre-html .\" -.de HTML-DO-IMAGE -. if r ps4html \O[3]\O[5\\$2\\$1.png]\O[0]\O[1] -. if \\n[www-html] \O[3]\O[5\\$2\\$1.png]\O[0] +.de www-do-image +. if r ps4html \ +. nop \O[3]\O[5\\$2\\$1.png]\O[0]\O[1] +. if \n[www-html] \ +. nop \O[3]\O[5\\$2\\$1.png]\O[0] .. .\" .\" HTML-IMAGE-END - terminates an image for html .\" .de HTML-IMAGE-END -. if r ps4html \O[2]\O[1]\O[4] -. if \\n[www-html] \O[2]\O[1]\O[4] +. if r ps4html \ +. nop \O[2]\O[1]\O[4] +. if \n[www-html] \ +. nop \O[2]\O[1]\O[4] .. -.nr png-no 0 +. +.nr www-png-no 0 +. .\" -.\" MAKE-UNIQUE-NAME - generates another unique name +.\" www-make-unique-name - generates another unique name in string +.\" `www-unique-name' .\" -.de MAKE-UNIQUE-NAME -. nr png-no \\n[png-no]+1 -. ds HTML-UNIQUE-NAME \\n(.F-auto-\\n[png-no] +.de www-make-unique-name +. nr www-png-no +1 +. ds www-unique-name \\n[.F]-auto-\\n[www-png-no]\" .. .\" .\" HTML-IMAGE - is the same name as a tag generated from eqn/tbl/pic. @@ -202,24 +293,31 @@ .\" not seen by pre-html. .\" .de HTML-IMAGE -.\" generates a centered image -. MAKE-UNIQUE-NAME -. HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] c +. \" generates a centered image +. www-make-unique-name +. www-do-image \\*[www-unique-name] c .. +. .de HTML-IMAGE-RIGHT -. MAKE-UNIQUE-NAME -. HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] r +. www-make-unique-name +. www-do-image \\*[www-unique-name] r .. +. .de HTML-IMAGE-LEFT -. MAKE-UNIQUE-NAME -. HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] l +. www-make-unique-name +. www-do-image \\*[www-unique-name] l .. +. .de HTML-IMAGE-INLINE -. MAKE-UNIQUE-NAME -. HTML-DO-IMAGE \\*[HTML-UNIQUE-NAME] i +. www-make-unique-name +. www-do-image \\*[www-unique-name] i .. +. +. .if \n[www-html] \{\ . nh . nr HY 0 .\} .cp \n(_C +. +.\" EOF
\ No newline at end of file |