в Python: создать таблицу для списков аргументов - PullRequest
0 голосов
/ 11 сентября 2018

У меня немного болит сердце от того, как списки аргументов отображаются в pydoc, pydoctor и других приложениях документирования на python. Мне бы хотелось, чтобы что-то было проще разобрать для моих старых глаз, например, то, что я помню из старого руководства по PDP 11/20.

пожалуйста, обратите внимание, я планирую сделать работу, но я ищу предложения о том, куда идти.

С учетом этой функции:

 def _getmatch(label, pattern, astring):
    """
    find pattern in astring, put label in complaint when not found
    :param str label: a name for this thing
    :param str pattern: a pattern to use to extract this thing
    :param str astring:  a string to extract this thing from
    :rtype: str
    :return: the string extracted from astring using pattern
    """

Я хотел бы сгенерировать это в документации:

<html>
<body> 
   <table border=1 rules=groups>
   <tr><th colspan=4>Instance Methods</th></tr>
   <tr><td><table border=1 rules=groups>
   <tr><td>def</td><th colspan=2>_getmatch</th><td>
      (label, pattern, astring):</td></tr>
   <tr><td colspan=4 align=center> find <i>pattern </i>in 
   <i>astring</i>, put <i>label</i> in complaint when not found </td></tr>
   <tr><th width=10%>param</th><td width=10%>str</td><th> label</th><td>
   <i> a name for this thing</i></td></tr>
   <tr><th>param</th><td>str</td><th>pattern</th><td><i> a pattern to 
    use to extract this thing</i></td></tr>
   <tr><th>param</th><td>str</td><th>astring</th><td><i>  a string to
    extract this thing from</i></td></tr>
   <tr><td colspan=4>
        <table>
  <tr><th>rtype</th><td>str</td></tr>
  <tr><th>return</th><td> the string extracted from astring 
     using pattern</td></tr>
        </table>
    </td></tr>
        </table></td></tr>
  </table>
  </body>
  </html>

Так что я могу получить что-то подобное в браузере The goal table

...