Skip to content
Tcl Source Code Artifact [97feff14f7]
Login

Artifact [97feff14f7]

Artifact 97feff14f78cdaaee1be7a5360e59746778eddcf:

Wiki page [How to edit/test tcl man pages] by dkf on 2016-09-24 16:17:42.
D 2016-09-24T16:17:42.102
L How\sto\sedit/test\stcl\sman\spages
P 8b82096b041423517e54a247d68ab97740529bbe
U dkf
W 4328
2015-06-18 Donal K. Fellows posted on the core list the following text:

<h1>Editor</h1>

I use emacs but you can use anything you want I suppose. Probably best to not use MS Word; Notepad would be a better choice. :-)

99% of what you might ever want to do when just editing docs can be done without putting a lot of effort into rendering; that's what I usually do.

<h1>Check formatting</h1>

I check the formatting with '<i>groff -Tutf8 -man</i>' and with '<i>make html</i>' (<i> make html-tcl HTML_INSTALL_DIR=~/test/html</i>) in the unix build tree (which doesn't use groff's -Thtml output mode because that sucks, or at least did a few years ago when I last had time to try it, and which requires an installed tclsh8.6).
There's a release of groff for cygwin apparently (according to Google) so it ought to be usable for you.

<h1>Producing output for reading<h1>

<h2>Printed output</h2>

If you want printed output, you'll get something very good from the -Tpdf, -Tps or -Tdvi options to groff (depending on the version installed).
While it isn't a primary target for us these days, it's what Tcl's documentation was always supposed to look like.

<h2>Plain text output</h2>

The best quality text output is with the -Tutf8 option to groff, though -Tascii also works; the ideal option depends on your system encoding. (The <tt>man</tt> command will use one of those.) The result is usually best piped straight into <tt>less</tt>.

<h2>Output for the web</h2>

Use the <tt>make html</tt> in the unix directory, which will build documentation trees for Tcl, Tk and all installed contrib packages. Assume you need an up-to-date version of Tcl installed on your local platform to run this.

<h1>groff subset</h1>

The main thing to beware of is that we actually use a small subset of the full power of groff, augmented with a few of our own macros (defined and "documented" in man.macros).
Please avoid using anything too exotic unless you update the HTML generator to support it.
Because of this, ‘make html’ is actually the check to use; it's pretty strict about diagnostics.

I don't bother with the winhelp converter these days; the HTML is better (as in “more recently maintained”) and everyone has a reader for the format it produces.

<hr />

Some additional resources:

   *   Mentioned file: [https://core.tcl.tk/tcl/artifact/0341d457d89f756d|man.macros]
   *   Groff help: [http://man7.org/linux/man-pages/man7/groff_man.7.html]
   *   A Groff manual: [http://www.premvet.co.uk/premvet/faq/roff.html]

File structure:
   *   Commands like .xx always at the beginning of a line.
   *   Comands like \xx may be within the text.

Some used markup:
   *   <tt>.SH "Text"</tt>: Section header. Text included in html TOC.
   *   <tt>.SS "Text"</tt>: Subsection header. Text included in html TOC.
   *   <tt>.TP</tt> : Paragraph label, start of indented text, text included in html TOC. The paragraph label occupies the next source line. It is often followed by a line with a single <tt>.</tt> on it (which does nothing, but makes the nroff code easier to read).
   *   <tt>\fBText\fR</tt> : Bold font
   *   <tt>\fIText\fR</tt> : Italic font (\fR (for Roman font) must always follow)
   *   <tt>.RS</tt> : Indent paragraph 3 to right start
   *   <tt>.RE</tt> : Indent end
   *   <tt>.PP</tt> : New line and reset font, margin and indent to default values

We add the following markup ourselves (i.e., these are rules defined in the <tt>man.macros</tt> file):
   *   <tt>.BS</tt> : Box Start. Puts this part in a box in some versions. (HTML version could do with updating to support this)
   *   <tt>.BE</tt> : Box End. 
   *   <tt>.VS "Text"</tt>: Mark as new version, "<tt>Text</tt>" describes version (marks as a change in some renderings, but not the HTML version at the moment)
   *   <tt>.VE "Text"</tt>: End of mark (the text is just a reminder)
   *   <tt>.CS</tt> : Source code examples
   *   <tt>.CE</tt> : Source code example end
   *   <tt>.QW "Text"</tt>: Quoted Word, puts the <tt>Text</tt> in magic quotes when rendered on systems that support that (such as html).
   *   <tt>.PQ "Text"</tt>: Parenthesized Quoted word; puts the <tt>Text</tt> in parentheses and magic quotes. Gets the spacing right which .QW doesn't in this case.
Z 156e4aae0a38a52fdf0b5b83de911b04