Tk Library Source Code

Artifact [3d06a44dd5]
Login

Artifact 3d06a44dd58ee5a5569477a3fc2fd759e4acaddb:

Attachment "doctools.patch" to ticket [527716ffff] added by boakley 2002-03-09 12:35:40.
? doctools.patch
? modules/doctools/mpformats/old-fmt.html
? modules/doctools/mpformats/old-fmt.latex
? modules/doctools/mpformats/old-fmt.nroff
? modules/doctools/mpformats/old-fmt.tmml
Index: modules/doctools/format.man
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/format.man,v
retrieving revision 1.2
diff -u -r1.2 format.man
--- modules/doctools/format.man	12 Feb 2002 23:00:12 -0000	1.2
+++ modules/doctools/format.man	9 Mar 2002 05:30:12 -0000
@@ -100,6 +100,16 @@
 format in question. nroff and HTML for example do. A format focused on
 logical markup, like TMML, may not.
 
+[bullet]
+The command [cmd usage] is similar to [cmd call] in that it adds the
+syntax to the table of contents (synopsis) if supported by the output
+format. Unlike [cmd call],  this command doens't add any text to the
+output as a direct result of the command. Thus, it can be used
+anywhere within the document to add usage information. Typically it is
+used near the top of the document, in cases where it is not desireable
+to use [cmd call] elsehere in the document, or where additional usage
+information is desired (eg: to document a "package require" command).
+
 [list_end]
 
 [section Commands]
@@ -227,6 +237,13 @@
 
 Starts a new item in a definition list, but the term defined by it is
 a command and its arguments.
+
+[call [cmd usage] [arg args]]
+
+Defines a term to be used in the table of contents or synopsis section,
+depending on the format. This command is [emph silent], as it doesn't
+add any text to the output as a direct result of the call. It merely
+defines data to appear in another section.
 
 [list_end]
 
Index: modules/doctools/mpexpand
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpexpand,v
retrieving revision 1.3
diff -u -r1.3 mpexpand
--- modules/doctools/mpexpand	28 Feb 2002 07:03:20 -0000	1.3
+++ modules/doctools/mpexpand	9 Mar 2002 05:30:12 -0000
@@ -132,7 +132,7 @@
 	section para list_begin list_end lst_item call bullet enum
 	example example_begin example_end see_also keywords nl arg cmd opt
 	comment sectref syscmd method option widget fun type package
-	class var file uri     
+	class var file uri usage
     } {
 	interp alias $inip $cmd $mpip $cmd
     }
Index: modules/doctools/mpformats/_html.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpformats/_html.tcl,v
retrieving revision 1.3
diff -u -r1.3 _html.tcl
--- modules/doctools/mpformats/_html.tcl	28 Feb 2002 07:03:20 -0000	1.3
+++ modules/doctools/mpformats/_html.tcl	9 Mar 2002 05:30:12 -0000
@@ -9,7 +9,7 @@
 
 global textMap;
 set    textMap {
-    &    &amp;    <    &lt;     >    &gt;     \x7b &ob;     \x7d &cb;  
+    &    &amp;    <    &lt;     >    &gt;       
     \xa0 &nbsp;   \xb0 &deg;    \xc0 &Agrave; \xd0 &ETH;    \xe0 &agrave; \xf0 &eth;
     \xa1 &iexcl;  \xb1 &plusmn; \xc1 &Aacute; \xd1 &Ntilde; \xe1 &aacute; \xf1 &ntilde;
     \xa2 &cent;	  \xb2 &sup2;   \xc2 &Acirc;  \xd2 &Ograve; \xe2 &acirc;  \xf2 &ograve;
Index: modules/doctools/mpformats/fmt.html
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpformats/fmt.html,v
retrieving revision 1.6
diff -u -r1.6 fmt.html
--- modules/doctools/mpformats/fmt.html	1 Mar 2002 05:28:28 -0000	1.6
+++ modules/doctools/mpformats/fmt.html	9 Mar 2002 05:30:12 -0000
@@ -70,6 +70,14 @@
     return $result
 }
 
+proc usage {cmd args} {
+    if {[mp_pass] == 1} {
+	AddCall "[trtop][td]$cmd [join $args " "]</td></tr>\n"
+	return
+    }
+    return ""
+}
+
 proc call {cmd args} {
     if {[mp_pass] == 1} {
 	AddCall "[trtop][td]$cmd [join $args " "]</td></tr>\n"
Index: modules/doctools/mpformats/fmt.latex
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpformats/fmt.latex,v
retrieving revision 1.4
diff -u -r1.4 fmt.latex
--- modules/doctools/mpformats/fmt.latex	28 Feb 2002 07:03:20 -0000	1.4
+++ modules/doctools/mpformats/fmt.latex	9 Mar 2002 05:30:12 -0000
@@ -90,6 +90,14 @@
     return $res
 }
 
+proc usage {cmd args} {
+    if {[mp_pass] == 1} {
+	AddCall "\\item\[\] $cmd [join $args " "]\n"
+	return
+    }
+    return ""
+}
+
 proc call {cmd args} {
     if {[mp_pass] == 1} {
 	AddCall "\\item\[\] $cmd [join $args " "]\n"
Index: modules/doctools/mpformats/fmt.list
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpformats/fmt.list,v
retrieving revision 1.4
diff -u -r1.4 fmt.list
--- modules/doctools/mpformats/fmt.list	28 Feb 2002 07:03:20 -0000	1.4
+++ modules/doctools/mpformats/fmt.list	9 Mar 2002 05:30:12 -0000
@@ -35,6 +35,7 @@
 proc description {}                 {}
 proc section     {name}             {}
 proc para        {}                 {}
+proc usage       {cmd args}         {}
 proc call        {cmd args}         {}
 proc list_begin  {what}             {}
 proc list_end    {}                 {}
Index: modules/doctools/mpformats/fmt.nroff
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpformats/fmt.nroff,v
retrieving revision 1.5
diff -u -r1.5 fmt.nroff
--- modules/doctools/mpformats/fmt.nroff	1 Mar 2002 05:28:28 -0000	1.5
+++ modules/doctools/mpformats/fmt.nroff	9 Mar 2002 05:30:13 -0000
@@ -88,6 +88,14 @@
     return "[x_synopsis]package require [nr_bld]$pkg[nr_rst]\n[nl]"
 }
 
+proc usage {cmd args} {
+    if {[mp_pass] == 1} {
+	AddCall "$cmd [join $args " "][nr_rst]\n[nl]\n"
+	return
+    }
+    return ""
+}
+
 proc call {cmd args} {
     if {[mp_pass] == 1} {
 	AddCall "$cmd [join $args " "][nr_rst]\n[nl]\n"
Index: modules/doctools/mpformats/fmt.tmml
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/doctools/mpformats/fmt.tmml,v
retrieving revision 1.5
diff -u -r1.5 fmt.tmml
--- modules/doctools/mpformats/fmt.tmml	28 Feb 2002 07:03:20 -0000	1.5
+++ modules/doctools/mpformats/fmt.tmml	9 Mar 2002 05:30:13 -0000
@@ -208,6 +208,9 @@
 	;
 }
 
+pass 1 usage {cmd args} { hold synopsis [formatCall $cmd $args] }
+pass 2 usage {cmd args} NOP
+
 pass 1 call {cmd args} { hold synopsis [formatCall $cmd $args] }
 pass 2 call {cmd args} {
     sequence \