]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added support for adding environment/macro parameters more cleanly:
authorFred Drake <fdrake@acm.org>
Thu, 22 Apr 1999 13:03:49 +0000 (13:03 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 22 Apr 1999 13:03:49 +0000 (13:03 +0000)
\op adds an optional parameter, and \p adds a required parameter.
These are only defined in the context of the parameter list parameter
of the envdesc and macrodesc environments.

Doc/texinputs/ltxmarkup.sty

index 58bb060f4bb80a707eeb3f2484f7dc85f5cb8120..440e697421d05ee9f6a1942a8cdba1b0a99726c7 100644 (file)
@@ -6,9 +6,18 @@
 \ProvidesPackage{ltxmarkup}
 \RequirePackage{python}      % fulllineitems environment
 
+% These two macros are used in constructing the last parameter to the
+% envdesc and macrodesc environments.
+
+\newcommand{\py@ltx@optparam}[1]{{[}\var{#1}{]}}
+\newcommand{\py@ltx@param}[1]{\{\var{#1}\}}
+
 \newenvironment{envdesc}[2]{
   \begin{fulllineitems}
-    \item[\code{\e begin\{{\bfseries #1}\}#2}]
+    \item[\code{\e begin\{{\bfseries #1}\}{%
+      \let\op=\py@ltx@optparam%
+      \let\p=\py@ltx@param%
+      #2}}]
     %\item[\code{\e end\{{\bfseries #1}\}}]
     \index{#1 environment@\idxcode{#1} environment}
     \index{environments!#1@\idxcode{#1}}
 
 \newenvironment{macrodesc}[2]{
   \begin{fulllineitems}
-    \item[\code{\e\bfseries#1}#2]
+    \item[\code{\e\bfseries#1}{%
+      \let\op=\py@ltx@optparam%
+      \let\p=\py@ltx@param%
+      #2}]
     \index{#1@\idxcode{\e #1}}
 }{\end{fulllineitems}}