Tk Library Source Code

View Ticket
Login
Ticket UUID: 534334
Title: add tk-specific man page macro: tkoption
Type: Bug Version: None
Submitter: boakley Created on: 2002-03-24 15:51:01
Subsystem: doctools Assigned To: andreas_kupries
Priority: 8 Severity:
Status: Closed Last Modified: 2002-05-10 14:00:36
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2002-05-10 07:00:36
Description:
standard tk widget man pages have a section 
named "Widget Specific Options" that has a format that 
is tedious to code with the existing mpexpand formats. 
Options are typically described like this:

-----------------------
Command-Line Name: -value
Database Name: value
Database Class: Value


Specifies the value for the foo widget.
-----------------------

To mark this up with the existing man page markup one 
needs to create a definitions list for the list of 
option names, which is tedious. I suppose there are 
other ways, too. 

I propose a special keyword just for this construct. 
I've written one for the html renderer as a prototype. 
It is used like this:

------------------------
[tkoption -value value Value "Specifies the value for 
the foo widget."]
------------------------

It takes four arguments: the command line name, the 
database name, the database class, and a description. 
The description could be left off of the API, since 
normal paragraphs would work, too. In my prototype 
implementation, if the db name or class is null, those 
parts don't appear in the output. This, for 
megawidgets that may not have option database support.

I've attached my hacked version of fmt.html with the 
proposed macro. To make it work, one also needs to add 
the macro to a foreach command in mpexpand where it 
makes interp aliases for each of the macros. I don't 
know if this is the best implementation, but it's a 
starting point...
User Comments: andreas_kupries added on 2002-05-10 14:00:36:
Logged In: YES 
user_id=75003

Ok, all the formats are now done and committed.
Documentation is uptodate too.

andreas_kupries added on 2002-04-02 02:05:15:
Logged In: YES 
user_id=75003

After some out-of-band discussion by email we (Bryan,
Joe and I) have come to the conclusion (at least I
believe so) that this or a similar command should be
added to doctolls, as part of the special option lists
provided by TMML. This will bring doctools one step
nearer to TMML.

andreas_kupries added on 2002-03-27 01:17:44:
Logged In: YES 
user_id=75003

Actually the hair is not that fine.

The macro facility you would like to have
places styles information (= translation
of data into the output format, like HTML)
into the manpage.

Defining proc's in a manpage OTOH allows
you to write format independent macros
by using the doctools commands inside of
the proc.

I have to admit that I cannot prevent you
from directly generating HTML statements,
etc. but this is strongly discouraged. This
is luckily also difficult to get right because
the interpreter running the code for the
manpage does _not_ know to which formatting
engine it is currently connected to. IOW you
don't know whether to generate HTML or NROFF
in your proc.

Node aside: Please attach the hacked fmt.html
to this item. I would like to see if I can
rewrite this using just doctools commands.

boakley added on 2002-03-26 21:42:41:
Logged In: YES 
user_id=249075

I don't quite understand this. In the feature request for 
the "macro" macro it was argued that allowing one to code 
macros within a document was a Bad Thing. And yet this 
discussion explicitly encourages it (via proc rather than 
macro, but that's splitting a fine hair).

I guess having a subpackage with the behavior would work, 
but I don't see the point. What's the argument against 
adding this feature to the toplevel doctools package?

I guess my biggest concern is that someone down the line 
might change the format of a definition list. Maybe add 
blank lines between the list items, or add a bullet or 
different coloring. That change will affect this sort of 
markup when (arguably) it shouldn't. After all, this isn't 
quite a bona fide definition list, IMHO. It's a specific, 
unique construct that's been in tk man pages probably since 
day one.

What about instead of calling this a tk-specific feature we 
add another type of list -- compact (eg: [list begin 
compact]). This type would guarantee that each line is a 
single physical line with no blank lines between items.

andreas_kupries added on 2002-03-26 14:48:35:
Logged In: YES 
user_id=75003

Joe, I believe that this can be handled as
described below, i.e. with a [proc] in the
manpage, or better, by defining a subpackage
of doctools which can be required by manpages
which want to use this highlevel construct.

IMHO this will give Bryan what he wants without
having to extend the language or having to add
a macro facility.

andreas_kupries added on 2002-03-26 03:02:42:
Logged In: YES 
user_id=75003

Note that the current internal architecture of
mpexpand (with its two slave interps) was chosen
to expressly allow the definition and usage of
[proc]s inside of doctools manpages without
disturbing neither the high-level control in
mpexpand nor the loaded formatting engine. The
procecedures may use only the declared doctools
commands and also have limited access to the
expander object itself (so that they can push/pop
contexts etc). With this it is possible to create
higher-level constructs which capture more complex
documentation structures without giving up the
separation between structure and visual appearance.

If wanted I can provide alpha code for a tcllib
module handling the FIG vector format where one
of its doctools manpages actually sources part
of the module and thus extracts documentation
directly out of the code itself.