|
581 | 581 | % something else. |
582 | 582 | \newcommand{\py@unspecified}{...} |
583 | 583 |
|
| 584 | + |
| 585 | +\newlength{\py@argswidth} |
| 586 | +\newcommand{\py@sigparams}[1]{% |
| 587 | + \parbox[t]{\py@argswidth}{\py@varvars{#1}\code{)}}} |
| 588 | +\newcommand{\py@sigline}[2]{% |
| 589 | + \settowidth{\py@argswidth}{#1\code{(}}% |
| 590 | + \addtolength{\py@argswidth}{-2\py@argswidth}% |
| 591 | + \addtolength{\py@argswidth}{\textwidth}% |
| 592 | + \item[#1\code{(}\py@sigparams{#2}]} |
| 593 | + |
584 | 594 | % C functions ------------------------------------------------------------ |
585 | 595 | % \begin{cfuncdesc}[refcount]{type}{name}{arglist} |
586 | 596 | % Note that the [refcount] slot should only be filled in by |
587 | 597 | % tools/anno-api.py; it pulls the value from the refcounts database. |
588 | 598 | \newcommand{\cfuncline}[3]{ |
589 | | - \item[\code{#1 \bfcode{#2}(\py@varvars{#3})}\index{#2@{\py@idxcode{#2()}}}] |
| 599 | + \py@sigline{\code{#1 \bfcode{#2}}}{#3}% |
| 600 | + \index{#2@{\py@idxcode{#2()}}} |
590 | 601 | } |
591 | 602 | \newenvironment{cfuncdesc}[4][\py@badkey]{ |
592 | 603 | \begin{fulllineitems} |
|
645 | 656 | }{\end{fulllineitems}} |
646 | 657 |
|
647 | 658 | % similar to {funcdesc}, but doesn't add to the index |
648 | | -\newcommand{\funclineni}[2]{\item[\code{\bfcode{#1}(\py@varvars{#2})}]} |
| 659 | +\newcommand{\funclineni}[2]{% |
| 660 | + \py@sigline{\bfcode{#1}}{#2}} |
649 | 661 | \newenvironment{funcdescni}[2]{ |
650 | 662 | \begin{fulllineitems} |
651 | 663 | \funclineni{#1}{#2} |
|
657 | 669 | % Using \renewcommand doesn't work for this, for unknown reasons: |
658 | 670 | \global\def\py@thisclass{#1} |
659 | 671 | \begin{fulllineitems} |
660 | | - \item[\strong{class }\code{\bfcode{#1}(\py@varvars{#2})}% |
661 | | - \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}] |
| 672 | + \py@sigline{\strong{class }\bfcode{#1}}{#2}% |
| 673 | + \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)} |
662 | 674 | }{\end{fulllineitems}} |
663 | 675 |
|
664 | 676 | % \begin{classdesc*}{name} |
|
676 | 688 | % Using \renewcommand doesn't work for this, for unknown reasons: |
677 | 689 | \global\def\py@thisclass{#1} |
678 | 690 | \begin{fulllineitems} |
679 | | - \item[\strong{exception }\code{\bfcode{#1}(\py@varvars{#2})}% |
680 | | - \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] |
| 691 | + \py@sigline{\strong{exception }\bfcode{#1}}{#2}% |
| 692 | + \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)} |
681 | 693 | }{\end{fulllineitems}} |
682 | 694 |
|
683 | 695 | % There is no corresponding {excclassdesc*} environment. To describe |
|
709 | 721 | % similar to {methoddesc}, but doesn't add to the index |
710 | 722 | % (never actually uses the optional argument) |
711 | 723 | \newcommand{\methodlineni}[3][\py@classbadkey]{% |
712 | | - \item[\code{\bfcode{#2}(\py@varvars{#3})}]} |
| 724 | + \py@sigline{\bfcode{#2}}{#3}} |
713 | 725 | \newenvironment{methoddescni}[3][\py@classbadkey]{ |
714 | 726 | \begin{fulllineitems} |
715 | 727 | \methodlineni{#2}{#3} |
|
0 commit comments