[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] New html docs

From: Gaius Mulley
Subject: [Groff] New html docs
Date: Fri, 31 Dec 1999 14:51:26 +0000 (GMT)

Hello Gentlemen,

Many thanks to Eddie for forwarding me some missing emails.
After reading much discussion about missing html documents
I thought I'd make a start on documenting the tmac.arkup
including some examples.

Eddie: I'll make a start at translating the groff homepage into groff.
I'll do from the top to the bottom of the README section - is
that ok?

Here is where I've got to in producing documentation for grohtml.
Werner: I've placed this document into the doc directory any chance
it can be checked into cvs?

Anyone please feel free to improve it - it is only a start and
needs polishing, extending etc. Also I'm sure the macro set could be
improved - so all you macro experts in groff land - go for it..

Hopefully it will allow people to experiment more easily with grohtml.
Have a good new year everyone,

cheers Gaius

The remainder of the email consists of three components:

  (i)   The first file is the new doc/Makefile in the groff source
  (ii)  The new grohtml documentation file (called doc/
  (iii) A patch for the doc/Makefile against the repository GMT 13:30

--------- cut here --------- cut here ------- cut here ------------
#Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
#     Written by James Clark (address@hidden)
#This file is part of groff.
#groff is free software; you can redistribute it and/or modify it under
#the terms of the GNU General Public License as published by the Free
#Software Foundation; either version 2, or (at your option) any later
#groff is distributed in the hope that it will be useful, but WITHOUT ANY
#WARRANTY; without even the implied warranty of MERCHANTABILITY or
#FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
#for more details.
#You should have received a copy of the GNU General Public License along
#with groff; see the file COPYING.  If not, write to the Free Software
#Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

TROFF=../troff/troff -M../tmac $(FFLAG)
GROPS=../grops/grops $(FFLAG) html.html html.ascii pic.html

all: $(DOCS)

.SUFFIXES: .tr .me .ms .ps .dit
        $(GROPS) $< >$@

        $(SOELIM) $< \
        | sed -e "s;@VERSION@;`cat ../VERSION`;" \
        | $(TROFF) -Tps $(FFLAG) -me  >$@

        $(TROFF) -Tps $< >$@

        export GROFF_TMAC_PATH=../tmac ; \
        sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
        | ../groff/groff -p -e -t -Thtml $(FFLAG) -U -ms -mhtml -markup >$@

        sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
        | ../groff/groff -p -e -t -Tascii $(FFLAG) -U -ms -markup >$@
        sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
        | ../groff/groff -p -e -t -Tps $(FFLAG) -U -ms -markup >$@ meref.dit meintro.dit

# This production must use -p -e -t so pic/eqn processing is done
        sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
        | ../groff/groff -p -e -t -Tps $(FFLAG) -ms  >$@

        sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
        | ../groff/groff -p -e -t -Thtml $(FFLAG) -ms -mhtml >$@


        -rm -f *.ps *.html *.png *.gif *.dit core
        -rm -f *.aux *.cp *.cps *.cv *.cn *.dvi *.fn *.fns *.ky *.kys \
               *.log *.op *.pg *.pgs *.ps *.toc *.tp *.tps *.tr *.vr *.vrs

distclean: clean

realclean: distclean

extraclean: clean
        -rm -f core *~ \#* junk temp grot
--------- cut here --------- cut here ------- cut here ------------
.\" user level html guide
.\"  build using:
.\"  make html.html
Authoring Web Pages with Groff
Gaius Mulley
Address: \c
.MAILTO address@hidden
As from groff-1.12 there is a html device driver for groff,
namely, grohtml.
This device driver is still in an alpha state and has
been included into the distribution so that a lot of
people have a chance to test it.
This document is a very basic guide to authoring simple web pages
using grohtml and the associated macro set -markup.
.NH 1
What is grohtml
Grohtml is a back end for groff which generates html.
The aim of grohtml is to produce respectable html given
fairly typical groff input.
.NH 1
Are there any macro sets for grohtml?
A simple macro set exists called -markup.
Here is a summary of the functions found in this macro set.
determines the cut off point for automatic link generation to
headings. By default all headings found in a troff document have
links created to them at the top of the html web page.
It maybe that many of the lower heading levels do not require
links. Alternatively some web pages may not need any heading
links at all, in which case:
\s-2\f[CR]\&.HTMLINDEX 0\fP\s+2
will tell grohtml not to generate links.
An \fCHTMLINDEX\fP of 2 will mean that a heading
\fB1.1.1 Some Title\fP
will not be included in the links either as it is said to have
a heading level of three.
takes five parameters: foreground, background, active hypertext link,
hypertext link not yet visited and visited hypertext link colour.
the only parameter to this macro is the background image file.
.IP URL 1i
generate a URL using two arguments.
$1 is the name of the link and
$2 is the actual URL. The way the
.URL "homepage for groff"
was encoded is given below:
\s-2\f[CR]\&.URL "homepage for groff"\fP\s+2
When this is processed by a device other than \fC-Thtml\fR
it appears as:
homepage for groff (<url:>).
The URL macro can be of any type for example we can
.URL "Eric Raymonds pic guide" pic.html
\s-2\f[CR]\&.URL "Eric Raymonds pic guide" pic.html\fP\s+2
generates an email html reference. The first argument is
mandatory as the email address. The optional second argument
is the text you see in your browser. For example the groff
maintainers are
.MAILTO "address@hidden" "Werner Lemberg"
.MAILTO "address@hidden" "Ted Harding."
This is achieved by the following macros:
\s-2\f[CR]\&.MAILTO "address@hidden" "Werner Lemberg"\fP
\f[CR]\&.MAILTO "address@hidden" "Ted Harding."\s+2\fR
Note that all the urls actually are treated as consuming no
textual space in groff. This could be considered as a bug
really and it does cause some problems. For example
at the top of this document I've had to prefix my email
address with \fIAddress:\fR otherwise groff believes
the authors address has zero characters width [1].
.IP "FTP" 1i
indicates that data can be obtained via ftp. The first
argument is the browser text and the second is the url.
The advantage of using this macro rather than the generic
URL macro is that if the document is processed for a different
device then the macro encapsulates the ftp address with (<ftp: address).
For example the
.FTP "current groff development distribution" \
can be found at
When this document is processed for another device the
last sentence will read, "For example the current groff development distribution
(<ftp:>) can be
found at
The macro example above was specified by:
\s-2\fC\&.FTP "current groff development distribution" \\
.IP "IMAGE" 1i
allows the document to include pictures. The first argument is
the image file. The next two arguments are optional.
Argument two is the width in pixels (default 400 pixels if absent).
The third argument is the height in pixels (default is the width value if 
.IP "HTML" 1i
all text after this macro is treated as raw html.
If the document is processed \fIwithout\fR \f[CR]-Thtml\fR then
the macro is ignored. This macro is a building block for
other higher level macros.
For example the \f[CR]BACKGROUND\fP macro is defined thus:
\&.   HTML <body background=\\$1>
.IP "TAG" 1i
generate an html name tag from $1. This can then be referenced using
macro. This link was achieved via placing a TAG in the URL description
above and the source looks like this:
\s-2\fC\&.IP URL 1i
generate a URL using two arguments.
\&.TAG "URL"
$1 is the name of the link and
$2 is the actual URL.\fR\s+2 etc
note that it is placed after the first sentence as the any raw HTML text
is currently considered to have zero width.[1]
.\" forced page break to work around a bug in grohtml :-(
.if '\*(.T'html' .bp
.IP "CDFTP" 1i
takes four arguments. Basically it is the FTP macro with optional local
reference. It was designed to allow the same groff source to be built
on two different machines and access the ftp data differently.
For example on a web server you might wish for the web page to reference
a web site. However if you were producing a CDROM of your information
your might wish for the ftp data to be also stored on your CDROM and
referenced as a file.
An example to get the current groff development distribution
.CDFTP merlin "click here." \ ../../groff.tar.gz
The source for this CDFTP invocation is:
\fC\s-2\&.CDFTP merlin "click here." \ 
which means if the html is generated on machine \s-2\fCmerlin\fR\s+2
then generate a URL to \s-2\fC../../groff.tar.gz\fR\s+2. Otherwise
construct an FTP URL to 
.NH 1
Section heading links
By default grohtml generates links to all section headings and
places these at the top of the html document.
Grohtml has to guess what a section heading looks like,
remember that all grohtml actually sees is a device independent
language telling it where to place text, draw lines, change font
sizes and faces etc. It believes a section heading to be
a line of bold text which starts at the left most margin.
Consequently it may misinterpret. Users can turn off all
heading and title guessing by giving invoking groff with
\fCgroff -P-g\fR.
.NH 1
Limitations of grohtml
Although basic text can be translated
in a straightforward fashion there are some areas where grohtml
has to try and guess text relationship. In particular whenever
grohtml encounters text tables and indented paragraphs or
two column mode it will try and utilize the html table construct
to preserve columns. Grohtml also attempts to work out which
lines should be automatically formatted by the browser.
Ultimately in trying to make reasonable guesses most of the time
it will make mistakes. Hopefully these mistakes will
happen less and less as we get bug reports and patches :-).
Tbl, pic, eqn's are also generated using images which may be
considered a limitation.
[1] This occurs
currently because the hypertext information is passed
from source to device driver using the special character
sequence \fC\\X^html:\fP. This could be fixed in the \fCtmac.arkup\fR
I believe by telling groff the width of the textual string.
However we then need to ensure that the html font set is accurate to
the browser font set, which may not be so easy.

------- cut here for the patch ------- cut here ------------
diff -r -c groff-cvs/doc/Makefile groff-html/doc/Makefile
*** groff-cvs/doc/Makefile      Thu Dec  9 09:42:29 1999
--- groff-html/doc/Makefile     Fri Dec 31 14:01:43 1999
*** 20,26 ****
  TROFF=../troff/troff -M../tmac $(FFLAG)
  GROPS=../grops/grops $(FFLAG)
--- 20,26 ----
  TROFF=../troff/troff -M../tmac $(FFLAG)
  GROPS=../grops/grops $(FFLAG)
! html.html html.ascii pic.html
*** 38,43 ****
--- 38,56 ----
        $(TROFF) -Tps $< >$@
+ %.html:
+       export GROFF_TMAC_PATH=../tmac ; \
+       sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
+       | ../groff/groff -p -e -t -Thtml $(FFLAG) -U -ms -mhtml -markup >$@
+ %.ascii:
+       sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
+       | ../groff/groff -p -e -t -Tascii $(FFLAG) -U -ms -markup >$@
+       sed -e "s;@VERSION@;`cat ../VERSION`;" $< \
+       | ../groff/groff -p -e -t -Tps $(FFLAG) -U -ms -markup >$@ meref.dit meintro.dit

reply via email to

[Prev in Thread] Current Thread [Next in Thread]