summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-03-19 15:33:03 +0000
committerwlemb <wlemb>2001-03-19 15:33:03 +0000
commite5a0b23b819595fefde823ccdbe168a70e26f6c6 (patch)
treea14bdcdb5ccedbb1c4f1e298a2d09f5c52f553fd
parentb46be234da48ac39020e859f7c60353fc6a1c3f1 (diff)
downloadgroff-e5a0b23b819595fefde823ccdbe168a70e26f6c6.tar.gz
* man/groff_font.man: Document `prepro', `postpro', and `print'.
* src/roff/groff/groff.man: Improve documentation of `-l' and `-L'. * src/devices/grohtml/grohtml.man: Fixing typos. * tmac/s.tmac (@IP): Pass `.ip' html tag. * tmac/groff_mwww.man: Remove .LINE macro * tmac/www.tmac (LINE): Add `.ti'. * src/devices/grohtml/post-html.cc (html_printer): New member `indent'. (html_printer::emit_raw): Use it. (html_printer::do_linelength): Ditto. (html_printer::do_pageoffset): Ditto. (html_printer::do_indentation): Ditto. (html_printer::do_tempindent): Ditto. (html_printer::do_break): Ditto. (html_printer::begin_page): Ditto. (html_printer::do_indentedparagraph): New function. (html_printer::troff_tag): Handle `.ip'. * src/devices/grohtml/html-text.cc (html_text::issue_table_begin): Add `<td width=...>' handling. (html_text::do_table): Add parameter. (html_text::do_indent): Updated. * src/devices/groohtml/html-text.h: Updated.
-rw-r--r--ChangeLog29
-rw-r--r--man/groff_font.man22
-rw-r--r--src/devices/grohtml/grohtml.man6
-rw-r--r--src/devices/grohtml/html-text.cc16
-rw-r--r--src/devices/grohtml/html-text.h4
-rw-r--r--src/devices/grohtml/post-html.cc76
-rw-r--r--src/roff/groff/groff.man11
-rwxr-xr-xtmac/groff_mwww.man1
-rw-r--r--tmac/s.tmac3
-rw-r--r--tmac/www.tmac1
10 files changed, 147 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 360fe5da..c3982fc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2001-03-19 Werner LEMBERG <wl@gnu.org>
+
+ * man/groff_font.man: Document `prepro', `postpro', and `print'.
+ * src/roff/groff/groff.man: Improve documentation of `-l' and `-L'.
+ * src/devices/grohtml/grohtml.man: Fixing typos.
+
+2001-03-19 Gaius Mulley <gaius@glam.ac.uk>
+
+ * tmac/s.tmac (@IP): Pass `.ip' html tag.
+ * tmac/groff_mwww.man: Remove .LINE macro
+ * tmac/www.tmac (LINE): Add `.ti'.
+
+ * src/devices/grohtml/post-html.cc (html_printer): New member
+ `indent'.
+ (html_printer::emit_raw): Use it.
+ (html_printer::do_linelength): Ditto.
+ (html_printer::do_pageoffset): Ditto.
+ (html_printer::do_indentation): Ditto.
+ (html_printer::do_tempindent): Ditto.
+ (html_printer::do_break): Ditto.
+ (html_printer::begin_page): Ditto.
+ (html_printer::do_indentedparagraph): New function.
+ (html_printer::troff_tag): Handle `.ip'.
+ * src/devices/grohtml/html-text.cc (html_text::issue_table_begin):
+ Add `<td width=...>' handling.
+ (html_text::do_table): Add parameter.
+ (html_text::do_indent): Updated.
+ * src/devices/groohtml/html-text.h: Updated.
+
2001-03-16 Gaius Mulley <gaius@glam.ac.uk>
Introduced simple html tables to implement indentation.
diff --git a/man/groff_font.man b/man/groff_font.man
index c2f7461e..9700e6a1 100644
--- a/man/groff_font.man
+++ b/man/groff_font.man
@@ -87,6 +87,16 @@ for fonts whose point size is
.I n
scaled points.
.TP
+.BI prepro\ program
+Call
+.I program
+as a preprocessor.
+.TP
+.BI postpro\ program
+Use
+.I program
+as the postprocessor.
+.TP
.B tcommand
This means that the postprocessor can handle the
.B t
@@ -143,6 +153,18 @@ This is achieved by another tcommand:
.B charset
This line and everything following in the file are ignored.
It is allowed for the sake of backwards compatibility.
+.TP
+.BI print\ program
+Use
+.I program
+as the spooler program for printing.
+If omitted, the
+.B \-l
+and
+.B \-L
+options of
+.B groff
+are ignored.
.LP
The res, unitwidth, fonts and sizes lines are compulsory.
Other commands are ignored by
diff --git a/src/devices/grohtml/grohtml.man b/src/devices/grohtml/grohtml.man
index 1e93e006..3fa302c3 100644
--- a/src/devices/grohtml/grohtml.man
+++ b/src/devices/grohtml/grohtml.man
@@ -68,8 +68,8 @@ is run by
.B groff
options can be passed to
.B grohtml
-using the
-.B groff
+using
+.BR groff 's
.B \-P
option.
.SH OPTIONS
@@ -124,7 +124,7 @@ Images are generated whenever a table, picture, equation or line is
encountered.
.SH BUGS
.B Grohtml
-has been completely redesigned and rewriten.
+has been completely redesigned and rewritten.
It is still alpha code.
.SH "SEE ALSO"
.BR afmtodit (@MAN1EXT@),
diff --git a/src/devices/grohtml/html-text.cc b/src/devices/grohtml/html-text.cc
index 63794125..14f0b5a9 100644
--- a/src/devices/grohtml/html-text.cc
+++ b/src/devices/grohtml/html-text.cc
@@ -142,7 +142,13 @@ void html_text::issue_table_begin (tag_definition *t)
if (width > 0) {
out->put_string("<table width=\"100%\" rules=\"none\" frame=\"none\"\n cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">").nl();
out->put_string("<tr valign=\"top\" align=\"left\">").nl();
- out->put_string("<td width=\"").put_number(width).put_string("%\"></td>");
+ if ((t->arg1 == 0) || (strcmp(t->arg1, "") == 0))
+ out->put_string("<td width=\"").put_number(width).put_string("%\"></td>");
+ else {
+ out->put_string("<td width=\"").put_number(width).put_string("%\">").nl();
+ out->put_string(t->arg1).put_string("</td>");
+ t->arg1[0] = (char)0;
+ }
out->put_string("<td width=\"").put_number(100-width).put_string("%\">").nl();
}
}
@@ -257,7 +263,7 @@ void html_text::push_para (HTML_TAG t, char *arg)
* then we start a html table to implement the indentation.
*/
-void html_text::do_indent (int indent, int pageoff, int linelen)
+void html_text::do_indent (char *arg, int indent, int pageoff, int linelen)
{
if ((current_indentation != -1) &&
(pageoffset+current_indentation != indent+pageoff)) {
@@ -265,14 +271,14 @@ void html_text::do_indent (int indent, int pageoff, int linelen)
* actual indentation of text has changed, we need to put
* a table tag onto the stack.
*/
- do_table();
+ do_table(arg);
}
current_indentation = indent;
pageoffset = pageoff;
linelength = linelen;
}
-void html_text::do_table (void)
+void html_text::do_table (char *arg)
{
int in_pre = is_in_pre();
// char *para_type = done_para();
@@ -283,7 +289,7 @@ void html_text::do_table (void)
do_pre();
}
// do_para(para_type);
- push_para(TABLE_TAG, "");
+ push_para(TABLE_TAG, arg);
}
/*
diff --git a/src/devices/grohtml/html-text.h b/src/devices/grohtml/html-text.h
index 47182a4c..c8ab2ac5 100644
--- a/src/devices/grohtml/html-text.h
+++ b/src/devices/grohtml/html-text.h
@@ -66,7 +66,7 @@ public:
void do_space (void);
void do_break (void);
void do_newline (void);
- void do_table (void);
+ void do_table (char *arg);
void done_bold (void);
void done_italic (void);
char *done_para (void);
@@ -76,7 +76,7 @@ public:
void done_pre (void);
void done_small (void);
void done_big (void);
- void do_indent (int indent, int pageoff, int linelen);
+ void do_indent (char *arg, int indent, int pageoff, int linelen);
int emitted_text (void);
int emit_space (void);
int is_in_pre (void);
diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc
index dc608854..d66fe94e 100644
--- a/src/devices/grohtml/post-html.cc
+++ b/src/devices/grohtml/post-html.cc
@@ -961,6 +961,7 @@ class html_printer : public printer {
char *inside_font_style;
int page_number;
title_desc title;
+ title_desc indent; // use title class to remember $1 of .ip
header_desc header;
int header_indent;
int supress_sub_sup;
@@ -1022,6 +1023,7 @@ class html_printer : public printer {
void do_pageoffset (char *arg);
void do_indentation (char *arg);
void do_tempindent (char *arg);
+ void do_indentedparagraph (void);
void do_verticalspacing (char *arg);
void do_pointsize (char *arg);
void do_centered_image (void);
@@ -1120,8 +1122,8 @@ void html_printer::emit_raw (text_glob *g)
#if defined(INDENTATION)
if (in_table) {
stop();
- current_paragraph->do_indent(0, pageoffset, linelength);
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(NULL, 0, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
}
#endif
}
@@ -1432,7 +1434,7 @@ void html_printer::do_linelength (char *arg)
#if defined(INDENTATION)
if (fill_on) {
linelength = atoi(arg);
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
}
#endif
}
@@ -1446,7 +1448,7 @@ void html_printer::do_pageoffset (char *arg)
#if defined(INDENTATION)
pageoffset = atoi(arg);
if (fill_on) {
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
}
#endif
}
@@ -1460,7 +1462,7 @@ void html_printer::do_indentation (char *arg)
#if defined(INDENTATION)
if (fill_on) {
indentation = atoi(arg);
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
}
#endif
}
@@ -1476,12 +1478,68 @@ void html_printer::do_tempindent (char *arg)
end_tempindent = 1;
prev_indent = indentation;
indentation = atoi(arg);
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
}
#endif
}
/*
+ * do_indentedparagraph - handle the .ip tag, this buffers the next line
+ * and passes this to text-text as the left hand
+ * column table entry.
+ */
+
+void html_printer::do_indentedparagraph (void)
+{
+#if defined(INDENTATION)
+ text_glob *t;
+ int removed_from_head;
+ char buf[MAX_STRING_LENGTH];
+ int found_indent_start = FALSE;
+
+ indent.has_been_found = FALSE;
+ indent.text[0] = (char)0;
+
+ if (! page_contents->glyphs.is_empty()) {
+ page_contents->glyphs.sub_move_right(); /* move onto next word */
+ do {
+ t = page_contents->glyphs.get_data();
+ removed_from_head = FALSE;
+ if (t->is_raw_command) {
+ /* skip raw commands
+ */
+ page_contents->glyphs.sub_move_right(); /* move onto next word */
+ } else if (t->is_a_tag() && (strncmp(t->text_string, "html-tag:.br", 12) == 0)) {
+ /* end of indented para found, but move back so that we read this tag and process it
+ */
+ page_contents->glyphs.move_left(); /* move backwards to last word */
+ indent.has_been_found = TRUE;
+ return;
+ } else if (t->is_a_tag()) {
+ page_contents->glyphs.sub_move_right(); /* move onto next word */
+ } else if (found_indent_start) {
+ strcat(indent.text, " ");
+ str_translate_to_html(t->text_style.f, buf, MAX_STRING_LENGTH, t->text_string, t->text_length, TRUE);
+ strcat(indent.text, buf);
+ page_contents->glyphs.sub_move_right(); /* move onto next word */
+ removed_from_head = ((!page_contents->glyphs.is_empty()) &&
+ (page_contents->glyphs.is_equal_to_head()));
+ } else {
+ str_translate_to_html(t->text_style.f, buf, MAX_STRING_LENGTH, t->text_string, t->text_length, TRUE);
+ strcpy((char *)indent.text, buf);
+ found_indent_start = TRUE;
+ indent.has_been_found = TRUE;
+ page_contents->glyphs.sub_move_right(); /* move onto next word */
+ removed_from_head = ((!page_contents->glyphs.is_empty()) &&
+ (page_contents->glyphs.is_equal_to_head()));
+ }
+ } while ((! page_contents->glyphs.is_equal_to_head()) || (removed_from_head));
+ }
+ // page_contents->glyphs.move_left(); /* move backwards to last word */
+#endif
+}
+
+/*
* do_verticalspacing - handle the .vs command from troff.
*/
@@ -1582,7 +1640,7 @@ void html_printer::do_break (void)
end_tempindent--;
if (end_tempindent == 0) {
indentation = prev_indent;
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
}
}
#endif
@@ -1646,6 +1704,8 @@ void html_printer::troff_tag (text_glob *g)
} else if (strncmp(t, ".vs", 3) == 0) {
char *a = (char *)t+3;
do_verticalspacing(a);
+ } else if (strncmp(t, ".ip", 3) == 0) {
+ do_indentedparagraph();
} else if (strcmp(t, ".links") == 0) {
do_links();
}
@@ -2585,7 +2645,7 @@ void html_printer::begin_page(int n)
output_vpos_max = -1;
current_paragraph = new html_text(&html);
#if defined(INDENTATION)
- current_paragraph->do_indent(indentation, pageoffset, linelength);
+ current_paragraph->do_indent(indent.text, indentation, pageoffset, linelength);
#endif
current_paragraph->do_para("");
}
diff --git a/src/roff/groff/groff.man b/src/roff/groff/groff.man
index 999b5121..0ee4a6f9 100644
--- a/src/roff/groff/groff.man
+++ b/src/roff/groff/groff.man
@@ -211,10 +211,12 @@ to
before passing it to the postprocessor.
.TP
.B \-l
-Send the output to a printer.
+Send the output to a spooler for printing.
The command used for this is specified by the
.B print
-command in the device description file.
+command in the device description file (if not present,
+.B \-l
+has no effect).
.TP
.BI \-L arg
Pass
@@ -230,6 +232,11 @@ does not prepend
to
.I arg
before passing it to the postprocessor.
+If there is no
+.B print
+command in the device description file,
+.B \-L
+is ignored.
.TP
.BI \-T dev
Prepare output for device
diff --git a/tmac/groff_mwww.man b/tmac/groff_mwww.man
index d57eaddb..bec719c3 100755
--- a/tmac/groff_mwww.man
+++ b/tmac/groff_mwww.man
@@ -268,7 +268,6 @@ Tbl information is currently rendered as a png image.
.B Grohtml
was written by
.MAILTO gaius@glam.ac.uk "Gaius Mulley"
-.LINE
.SH BUGS
Report bugs to the
.MAILTO bug-groff@gnu.org "Groff Bug Mailing List" .
diff --git a/tmac/s.tmac b/tmac/s.tmac
index 076a4775..ad32d70a 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1154,7 +1154,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
. di
. chop par*label
. ie '\*(.T'html' \{\
-. ti -\\n[\\n[.ev]:ai]u
+. if \\n[dl]+1n<=\\n[\\n[.ev]:ai] .HTML-TAG ".ip"
+. ti 0
\\*[par*label]
. br
. \}
diff --git a/tmac/www.tmac b/tmac/www.tmac
index fb6e146a..6115ca46 100644
--- a/tmac/www.tmac
+++ b/tmac/www.tmac
@@ -143,6 +143,7 @@
.\" LINE - produce a horizontal line
.\"
.de LINE
+. ti 0
. HTML <hr>
..
.\"