doc/hgmanpage.py
author Matt Harbison <matt_harbison@yahoo.com>
Mon, 13 Dec 2021 20:45:31 -0500
changeset 48484 8a075b679918
parent 47062 f38bf44e077f
child 48720 db952cb40f18
permissions -rw-r--r--
tests: drop an obsolete comment about a pytype failure Differential Revision: https://phab.mercurial-scm.org/D11923
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     2
# $Id: manpage.py 6110 2009-08-31 14:40:33Z grubert $
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     3
# Author: Engelbert Gruber <grubert@users.sourceforge.net>
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     4
# Copyright: This module is put into the public domain.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     5
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     6
"""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     7
Simple man page writer for reStructuredText.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     8
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     9
Man pages (short for "manual pages") contain system documentation on unix-like
9712
18b134ef294c kill trailing whitespace
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9628
diff changeset
    10
systems. The pages are grouped in numbered sections:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    11
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    12
 1 executable programs and shell commands
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    13
 2 system calls
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    14
 3 library functions
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    15
 4 special files
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    16
 5 file formats
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    17
 6 games
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    18
 7 miscellaneous
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    19
 8 system administration
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    20
26193
47e60ed4834f hgmanpage: fix grammar
timeless@mozdev.org
parents: 24180
diff changeset
    21
Man pages are written in *troff*, a text file formatting system.
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    22
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    23
See http://www.tldp.org/HOWTO/Man-Page for a start.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    24
26193
47e60ed4834f hgmanpage: fix grammar
timeless@mozdev.org
parents: 24180
diff changeset
    25
Man pages have no subsections only parts.
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    26
Standard parts
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    27
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    28
  NAME ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    29
  SYNOPSIS ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    30
  DESCRIPTION ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    31
  OPTIONS ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    32
  FILES ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    33
  SEE ALSO ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    34
  BUGS ,
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    35
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    36
and
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    37
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    38
  AUTHOR .
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    39
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    40
A unix-like system keeps an index of the DESCRIPTIONs, which is accesable
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    41
by the command whatis or apropos.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    42
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    43
"""
28967
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    44
from __future__ import absolute_import
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    45
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    46
__docformat__ = 'reStructuredText'
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    47
28967
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    48
import inspect
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    49
import re
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    50
28967
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    51
from docutils import (
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    52
    languages,
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    53
    nodes,
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    54
    writers,
cd5e7195e441 py3: make hgmanpage use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26781
diff changeset
    55
)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
    56
16611
462dd183bd73 build: fix hgrc manpage building with docutils 0.9
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 14764
diff changeset
    57
try:
462dd183bd73 build: fix hgrc manpage building with docutils 0.9
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 14764
diff changeset
    58
    import roman
462dd183bd73 build: fix hgrc manpage building with docutils 0.9
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 14764
diff changeset
    59
except ImportError:
462dd183bd73 build: fix hgrc manpage building with docutils 0.9
Nikolaj Sjujskij <sterkrig@myopera.com>
parents: 14764
diff changeset
    60
    from docutils.utils import roman
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    61
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    62
FIELD_LIST_INDENT = 7
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    63
DEFINITION_LIST_INDENT = 7
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    64
OPTION_LIST_INDENT = 7
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    65
BLOCKQOUTE_INDENT = 3.5
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    66
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    67
# Define two macros so man/roff can calculate the
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    68
# indent/unindent margins by itself
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
    69
MACRO_DEF = r""".
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    70
.nr rst2man-indent-level 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    71
.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    72
.de1 rstReportMargin
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    73
\\$1 \\n[an-margin]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    74
level \\n[rst2man-indent-level]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    75
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    76
-
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    77
\\n[rst2man-indent0]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    78
\\n[rst2man-indent1]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    79
\\n[rst2man-indent2]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    80
..
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    81
.de1 INDENT
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    82
.\" .rstReportMargin pre:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    83
. RS \\$1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    84
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    85
. nr rst2man-indent-level +1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    86
.\" .rstReportMargin post:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    87
..
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    88
.de UNINDENT
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    89
. RE
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    90
.\" indent \\n[an-margin]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    91
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    92
.nr rst2man-indent-level -1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    93
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    94
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    95
..
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
    96
"""
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
    97
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    98
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    99
class Writer(writers.Writer):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   100
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   101
    supported = 'manpage'
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   102
    """Formats this writer supports."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   103
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   104
    output = None
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   105
    """Final translated form of `document`."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   106
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   107
    def __init__(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   108
        writers.Writer.__init__(self)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   109
        self.translator_class = Translator
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   110
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   111
    def translate(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   112
        visitor = self.translator_class(self.document)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   113
        self.document.walkabout(visitor)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   114
        self.output = visitor.astext()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   115
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   116
14764
a7d5816087a9 classes: fix class style problems found by b071cd58af50
Thomas Arendsen Hein <thomas@intevation.de>
parents: 14633
diff changeset
   117
class Table(object):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   118
    def __init__(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   119
        self._rows = []
10413
e433002acb05 fix up a bunch of check-code warnings
Matt Mackall <mpm@selenic.com>
parents: 10282
diff changeset
   120
        self._options = ['center']
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   121
        self._tab_char = '\t'
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   122
        self._coldefs = []
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   123
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   124
    def new_row(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   125
        self._rows.append([])
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   126
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   127
    def append_separator(self, separator):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   128
        """Append the separator for table head."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   129
        self._rows.append([separator])
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   130
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   131
    def append_cell(self, cell_lines):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   132
        """cell_lines is an array of lines"""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   133
        start = 0
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10007
diff changeset
   134
        if len(cell_lines) > 0 and cell_lines[0] == '.sp\n':
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   135
            start = 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   136
        self._rows[-1].append(cell_lines[start:])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   137
        if len(self._coldefs) < len(self._rows[-1]):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   138
            self._coldefs.append('l')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   139
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   140
    def _minimize_cell(self, cell_lines):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   141
        """Remove leading and trailing blank and ``.sp`` lines"""
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   142
        while cell_lines and cell_lines[0] in ('\n', '.sp\n'):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   143
            del cell_lines[0]
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   144
        while cell_lines and cell_lines[-1] in ('\n', '.sp\n'):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   145
            del cell_lines[-1]
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   146
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   147
    def as_list(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   148
        text = ['.TS\n']
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   149
        text.append(' '.join(self._options) + ';\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   150
        text.append('|%s|.\n' % ('|'.join(self._coldefs)))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   151
        for row in self._rows:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   152
            # row = array of cells. cell = array of lines.
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   153
            text.append('_\n')  # line above
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   154
            text.append('T{\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   155
            for i in range(len(row)):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   156
                cell = row[i]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   157
                self._minimize_cell(cell)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   158
                text.extend(cell)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   159
                if not text[-1].endswith('\n'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   160
                    text[-1] += '\n'
18054
b35e3364f94a check-code: there must also be whitespace between ')' and operator
Mads Kiilerich <madski@unity3d.com>
parents: 17517
diff changeset
   161
                if i < len(row) - 1:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   162
                    text.append('T}' + self._tab_char + 'T{\n')
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   163
                else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   164
                    text.append('T}\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   165
        text.append('_\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   166
        text.append('.TE\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   167
        return text
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   168
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   169
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   170
class Translator(nodes.NodeVisitor):
47062
f38bf44e077f black: make codebase compatible with black v21.4b2 and v20.8b1
Kyle Lippincott <spectral@google.com>
parents: 45942
diff changeset
   171
    """ """
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   172
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   173
    words_and_spaces = re.compile(r'\S+| +|\n')
17517
15036492a103 spelling: Structured
timeless@mozdev.org
parents: 17487
diff changeset
   174
    document_start = """Man page generated from reStructuredText."""
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   175
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   176
    def __init__(self, document):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   177
        nodes.NodeVisitor.__init__(self, document)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   178
        self.settings = settings = document.settings
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   179
        lcode = settings.language_code
14633
cdda48c93676 hgmanpage: adapt to Docutils 0.8 API change
Satish Balay <balay@fastmail.fm>
parents: 12865
diff changeset
   180
        arglen = len(inspect.getargspec(languages.get_language)[0])
cdda48c93676 hgmanpage: adapt to Docutils 0.8 API change
Satish Balay <balay@fastmail.fm>
parents: 12865
diff changeset
   181
        if arglen == 2:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   182
            self.language = languages.get_language(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   183
                lcode, self.document.reporter
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   184
            )
14633
cdda48c93676 hgmanpage: adapt to Docutils 0.8 API change
Satish Balay <balay@fastmail.fm>
parents: 12865
diff changeset
   185
        else:
cdda48c93676 hgmanpage: adapt to Docutils 0.8 API change
Satish Balay <balay@fastmail.fm>
parents: 12865
diff changeset
   186
            self.language = languages.get_language(lcode)
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   187
        self.head = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   188
        self.body = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   189
        self.foot = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   190
        self.section_level = 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   191
        self.context = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   192
        self.topic_class = ''
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   193
        self.colspecs = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   194
        self.compact_p = 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   195
        self.compact_simple = None
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   196
        # the list style "*" bullet or "#" numbered
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   197
        self._list_char = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   198
        # writing the header .TH and .SH NAME is postboned after
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   199
        # docinfo.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   200
        self._docinfo = {
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   201
            "title": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   202
            "title_upper": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   203
            "subtitle": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   204
            "manual_section": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   205
            "manual_group": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   206
            "author": [],
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   207
            "date": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   208
            "copyright": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   209
            "version": "",
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   210
        }
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   211
        self._docinfo_keys = []  # a list to keep the sequence as in source.
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   212
        self._docinfo_names = {}  # to get name from text not normalized.
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   213
        self._in_docinfo = None
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   214
        self._active_table = None
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   215
        self._in_literal = False
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   216
        self.header_written = 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   217
        self._line_block = 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   218
        self.authors = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   219
        self.section_level = 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   220
        self._indent = [0]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   221
        # central definition of simple processing rules
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   222
        # what to output on : visit, depart
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   223
        # Do not use paragraph requests ``.PP`` because these set indentation.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   224
        # use ``.sp``. Remove superfluous ``.sp`` in ``astext``.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   225
        #
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   226
        # Fonts are put on a stack, the top one is used.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   227
        # ``.ft P`` or ``\\fP`` pop from stack.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   228
        # ``B`` bold, ``I`` italic, ``R`` roman should be available.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   229
        # Hopefully ``C`` courier too.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   230
        self.defs = {
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   231
            'indent': ('.INDENT %.1f\n', '.UNINDENT\n'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   232
            'definition_list_item': ('.TP', ''),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   233
            'field_name': ('.TP\n.B ', '\n'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   234
            'literal': ('\\fB', '\\fP'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   235
            'literal_block': ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   236
            'option_list_item': ('.TP\n', ''),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   237
            'reference': (r'\%', r'\:'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   238
            'emphasis': ('\\fI', '\\fP'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   239
            'strong': ('\\fB', '\\fP'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   240
            'term': ('\n.B ', '\n'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   241
            'title_reference': ('\\fI', '\\fP'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   242
            'topic-title': ('.SS ',),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   243
            'sidebar-title': ('.SS ',),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   244
            'problematic': ('\n.nf\n', '\n.fi\n'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   245
        }
10007
9945a39d171f rst2man: s/dont/don't/ in comment
Christian Ebert <blacktrash@gmx.net>
parents: 10006
diff changeset
   246
        # NOTE don't specify the newline before a dot-command, but ensure
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   247
        # it is there.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   248
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   249
    def comment_begin(self, text):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   250
        """Return commented version of the passed text WITHOUT end of
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   251
        line/comment."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   252
        prefix = '.\\" '
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   253
        out_text = ''.join(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   254
            [(prefix + in_line + '\n') for in_line in text.split('\n')]
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   255
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   256
        return out_text
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   257
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   258
    def comment(self, text):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   259
        """Return commented version of the passed text."""
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   260
        return self.comment_begin(text) + '.\n'
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   261
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   262
    def ensure_eol(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   263
        """Ensure the last line in body is terminated by new line."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   264
        if self.body[-1][-1] != '\n':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   265
            self.body.append('\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   266
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   267
    def astext(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   268
        """Return the final formatted document as a string."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   269
        if not self.header_written:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   270
            # ensure we get a ".TH" as viewers require it.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   271
            self.head.append(self.header())
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   272
        # filter body
42059
51df72655b1a hgmanpage: use range instead of xrange
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 41553
diff changeset
   273
        for i in range(len(self.body) - 1, 0, -1):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   274
            # remove superfluous vertical gaps.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   275
            if self.body[i] == '.sp\n':
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   276
                if self.body[i - 1][:4] in ('.BI ', '.IP '):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   277
                    self.body[i] = '.\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   278
                elif (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   279
                    self.body[i - 1][:3] == '.B '
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   280
                    and self.body[i - 2][:4] == '.TP\n'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   281
                ):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   282
                    self.body[i] = '.\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   283
                elif (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   284
                    self.body[i - 1] == '\n'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   285
                    and self.body[i - 2][0] != '.'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   286
                    and (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   287
                        self.body[i - 3][:7] == '.TP\n.B '
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   288
                        or self.body[i - 3][:4] == '\n.B '
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   289
                    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   290
                ):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   291
                    self.body[i] = '.\n'
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   292
        return ''.join(self.head + self.body + self.foot)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   293
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   294
    def deunicode(self, text):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   295
        text = text.replace(u'\xa0', '\\ ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   296
        text = text.replace(u'\u2020', '\\(dg')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   297
        return text
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   298
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   299
    def visit_Text(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   300
        text = node.astext()
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   301
        text = text.replace('\\', '\\e')
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   302
        replace_pairs = [
30057
a8ba9a23c893 hgmanpage: stop using raw-unicode strings
Augie Fackler <augie@google.com>
parents: 29661
diff changeset
   303
            (u'-', u'\\-'),
a8ba9a23c893 hgmanpage: stop using raw-unicode strings
Augie Fackler <augie@google.com>
parents: 29661
diff changeset
   304
            (u"'", u'\\(aq'),
a8ba9a23c893 hgmanpage: stop using raw-unicode strings
Augie Fackler <augie@google.com>
parents: 29661
diff changeset
   305
            (u'´', u"\\'"),
a8ba9a23c893 hgmanpage: stop using raw-unicode strings
Augie Fackler <augie@google.com>
parents: 29661
diff changeset
   306
            (u'`', u'\\(ga'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   307
        ]
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   308
        for (in_char, out_markup) in replace_pairs:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   309
            text = text.replace(in_char, out_markup)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   310
        # unicode
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   311
        text = self.deunicode(text)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   312
        if self._in_literal:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   313
            # prevent interpretation of "." at line start
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   314
            if text[0] == '.':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   315
                text = '\\&' + text
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   316
            text = text.replace('\n.', '\n\\&.')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   317
        self.body.append(text)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   318
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   319
    def depart_Text(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   320
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   321
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   322
    def list_start(self, node):
14764
a7d5816087a9 classes: fix class style problems found by b071cd58af50
Thomas Arendsen Hein <thomas@intevation.de>
parents: 14633
diff changeset
   323
        class enum_char(object):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   324
            enum_style = {
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   325
                'bullet': '\\(bu',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   326
                'emdash': '\\(em',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   327
            }
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   328
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   329
            def __init__(self, style):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   330
                self._style = style
11643
50fede14fe4d doc: remove has_key usage in hgmanpage
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11639
diff changeset
   331
                if 'start' in node:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   332
                    self._cnt = node['start'] - 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   333
                else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   334
                    self._cnt = 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   335
                self._indent = 2
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   336
                if style == 'arabic':
26193
47e60ed4834f hgmanpage: fix grammar
timeless@mozdev.org
parents: 24180
diff changeset
   337
                    # indentation depends on number of children
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   338
                    # and start value.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   339
                    self._indent = len(str(len(node.children)))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   340
                    self._indent += len(str(self._cnt)) + 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   341
                elif style == 'loweralpha':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   342
                    self._cnt += ord('a') - 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   343
                    self._indent = 3
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   344
                elif style == 'upperalpha':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   345
                    self._cnt += ord('A') - 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   346
                    self._indent = 3
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   347
                elif style.endswith('roman'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   348
                    self._indent = 5
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   349
42060
93a1a4fef532 hgmanpage: use a py2 and py3 compatible iterable protocol
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 42059
diff changeset
   350
            def __next__(self):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   351
                if self._style == 'bullet':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   352
                    return self.enum_style[self._style]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   353
                elif self._style == 'emdash':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   354
                    return self.enum_style[self._style]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   355
                self._cnt += 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   356
                # TODO add prefix postfix
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   357
                if self._style == 'arabic':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   358
                    return "%d." % self._cnt
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   359
                elif self._style in ('loweralpha', 'upperalpha'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   360
                    return "%c." % self._cnt
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   361
                elif self._style.endswith('roman'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   362
                    res = roman.toRoman(self._cnt) + '.'
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   363
                    if self._style.startswith('upper'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   364
                        return res.upper()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   365
                    return res.lower()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   366
                else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   367
                    return "%d." % self._cnt
42060
93a1a4fef532 hgmanpage: use a py2 and py3 compatible iterable protocol
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 42059
diff changeset
   368
93a1a4fef532 hgmanpage: use a py2 and py3 compatible iterable protocol
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 42059
diff changeset
   369
            next = __next__
93a1a4fef532 hgmanpage: use a py2 and py3 compatible iterable protocol
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 42059
diff changeset
   370
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   371
            def get_width(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   372
                return self._indent
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   373
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   374
            def __repr__(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   375
                return 'enum_style-%s' % list(self._style)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   376
11643
50fede14fe4d doc: remove has_key usage in hgmanpage
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11639
diff changeset
   377
        if 'enumtype' in node:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   378
            self._list_char.append(enum_char(node['enumtype']))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   379
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   380
            self._list_char.append(enum_char('bullet'))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   381
        if len(self._list_char) > 1:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   382
            # indent nested lists
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   383
            self.indent(self._list_char[-2].get_width())
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   384
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   385
            self.indent(self._list_char[-1].get_width())
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   386
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   387
    def list_end(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   388
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   389
        self._list_char.pop()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   390
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   391
    def header(self):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   392
        tmpl = (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   393
            ".TH %(title_upper)s %(manual_section)s"
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   394
            " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n"
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   395
            ".SH NAME\n"
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   396
            "%(title)s \\- %(subtitle)s\n"
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   397
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   398
        return tmpl % self._docinfo
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   399
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   400
    def append_header(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   401
        """append header with .TH and .SH NAME"""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   402
        # NOTE before everything
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   403
        # .TH title_upper section date source manual
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   404
        if self.header_written:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   405
            return
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   406
        self.body.append(self.header())
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   407
        self.body.append(MACRO_DEF)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   408
        self.header_written = 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   409
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   410
    def visit_address(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   411
        self.visit_docinfo_item(node, 'address')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   412
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   413
    def depart_address(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   414
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   415
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   416
    def visit_admonition(self, node, name=None):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   417
        if name:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   418
            self.body.append('.IP %s\n' % self.language.labels.get(name, name))
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   419
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   420
    def depart_admonition(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   421
        self.body.append('.RE\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   422
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   423
    def visit_attention(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   424
        self.visit_admonition(node, 'attention')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   425
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   426
    depart_attention = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   427
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   428
    def visit_docinfo_item(self, node, name):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   429
        if name == 'author':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   430
            self._docinfo[name].append(node.astext())
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   431
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   432
            self._docinfo[name] = node.astext()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   433
        self._docinfo_keys.append(name)
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   434
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   435
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   436
    def depart_docinfo_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   437
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   438
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   439
    def visit_author(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   440
        self.visit_docinfo_item(node, 'author')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   441
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   442
    depart_author = depart_docinfo_item
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   443
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   444
    def visit_authors(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   445
        # _author is called anyway.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   446
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   447
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   448
    def depart_authors(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   449
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   450
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   451
    def visit_block_quote(self, node):
26781
1aee2ab0f902 spelling: trivial spell checking
Mads Kiilerich <madski@unity3d.com>
parents: 26193
diff changeset
   452
        # BUG/HACK: indent always uses the _last_ indentation,
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   453
        # thus we need two of them.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   454
        self.indent(BLOCKQOUTE_INDENT)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   455
        self.indent(0)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   456
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   457
    def depart_block_quote(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   458
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   459
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   460
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   461
    def visit_bullet_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   462
        self.list_start(node)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   463
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   464
    def depart_bullet_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   465
        self.list_end()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   466
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   467
    def visit_caption(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   468
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   469
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   470
    def depart_caption(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   471
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   472
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   473
    def visit_caution(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   474
        self.visit_admonition(node, 'caution')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   475
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   476
    depart_caution = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   477
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   478
    def visit_citation(self, node):
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10007
diff changeset
   479
        num, text = node.astext().split(None, 1)
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   480
        num = num.strip()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   481
        self.body.append('.IP [%s] 5\n' % num)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   482
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   483
    def depart_citation(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   484
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   485
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   486
    def visit_citation_reference(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   487
        self.body.append('[' + node.astext() + ']')
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   488
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   489
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   490
    def visit_classifier(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   491
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   492
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   493
    def depart_classifier(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   494
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   495
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   496
    def visit_colspec(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   497
        self.colspecs.append(node)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   498
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   499
    def depart_colspec(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   500
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   501
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   502
    def write_colspecs(self):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   503
        self.body.append("%s.\n" % ('L ' * len(self.colspecs)))
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   504
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   505
    def visit_comment(self, node, sub=re.compile('-(?=-)').sub):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   506
        self.body.append(self.comment(node.astext()))
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   507
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   508
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   509
    def visit_contact(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   510
        self.visit_docinfo_item(node, 'contact')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   511
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   512
    depart_contact = depart_docinfo_item
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   513
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   514
    def visit_container(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   515
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   516
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   517
    def depart_container(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   518
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   519
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   520
    def visit_compound(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   521
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   522
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   523
    def depart_compound(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   524
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   525
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   526
    def visit_copyright(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   527
        self.visit_docinfo_item(node, 'copyright')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   528
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   529
    def visit_danger(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   530
        self.visit_admonition(node, 'danger')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   531
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   532
    depart_danger = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   533
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   534
    def visit_date(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   535
        self.visit_docinfo_item(node, 'date')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   536
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   537
    def visit_decoration(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   538
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   539
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   540
    def depart_decoration(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   541
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   542
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   543
    def visit_definition(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   544
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   545
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   546
    def depart_definition(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   547
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   548
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   549
    def visit_definition_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   550
        self.indent(DEFINITION_LIST_INDENT)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   551
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   552
    def depart_definition_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   553
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   554
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   555
    def visit_definition_list_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   556
        self.body.append(self.defs['definition_list_item'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   557
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   558
    def depart_definition_list_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   559
        self.body.append(self.defs['definition_list_item'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   560
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   561
    def visit_description(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   562
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   563
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   564
    def depart_description(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   565
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   566
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   567
    def visit_docinfo(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   568
        self._in_docinfo = 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   569
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   570
    def depart_docinfo(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   571
        self._in_docinfo = None
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   572
        # NOTE nothing should be written before this
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   573
        self.append_header()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   574
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   575
    def visit_doctest_block(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   576
        self.body.append(self.defs['literal_block'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   577
        self._in_literal = True
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   578
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   579
    def depart_doctest_block(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   580
        self._in_literal = False
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   581
        self.body.append(self.defs['literal_block'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   582
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   583
    def visit_document(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   584
        # no blank line between comment and header.
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   585
        self.body.append(self.comment(self.document_start).rstrip() + '\n')
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   586
        # writing header is postboned
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   587
        self.header_written = 0
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   588
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   589
    def depart_document(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   590
        if self._docinfo['author']:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   591
            self.body.append(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   592
                '.SH AUTHOR\n%s\n' % ', '.join(self._docinfo['author'])
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   593
            )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   594
        skip = (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   595
            'author',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   596
            'copyright',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   597
            'date',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   598
            'manual_group',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   599
            'manual_section',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   600
            'subtitle',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   601
            'title',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   602
            'title_upper',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   603
            'version',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   604
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   605
        for name in self._docinfo_keys:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   606
            if name == 'address':
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   607
                self.body.append(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   608
                    "\n%s:\n%s%s.nf\n%s\n.fi\n%s%s"
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   609
                    % (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   610
                        self.language.labels.get(name, name),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   611
                        self.defs['indent'][0] % 0,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   612
                        self.defs['indent'][0] % BLOCKQOUTE_INDENT,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   613
                        self._docinfo[name],
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   614
                        self.defs['indent'][1],
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   615
                        self.defs['indent'][1],
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   616
                    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   617
                )
16686
67964cda8701 cleanup: "not x in y" -> "x not in y"
Brodie Rao <brodie@sf.io>
parents: 16611
diff changeset
   618
            elif name not in skip:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   619
                if name in self._docinfo_names:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   620
                    label = self._docinfo_names[name]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   621
                else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   622
                    label = self.language.labels.get(name, name)
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10007
diff changeset
   623
                self.body.append("\n%s: %s\n" % (label, self._docinfo[name]))
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   624
        if self._docinfo['copyright']:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   625
            self.body.append('.SH COPYRIGHT\n%s\n' % self._docinfo['copyright'])
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   626
        self.body.append(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   627
            self.comment('Generated by docutils manpage writer.\n')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   628
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   629
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   630
    def visit_emphasis(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   631
        self.body.append(self.defs['emphasis'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   632
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   633
    def depart_emphasis(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   634
        self.body.append(self.defs['emphasis'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   635
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   636
    def visit_entry(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   637
        # a cell in a table row
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   638
        if 'morerows' in node:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   639
            self.document.reporter.warning(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   640
                '"table row spanning" not supported', base_node=node
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   641
            )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   642
        if 'morecols' in node:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   643
            self.document.reporter.warning(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   644
                '"table cell spanning" not supported', base_node=node
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   645
            )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   646
        self.context.append(len(self.body))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   647
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   648
    def depart_entry(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   649
        start = self.context.pop()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   650
        self._active_table.append_cell(self.body[start:])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   651
        del self.body[start:]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   652
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   653
    def visit_enumerated_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   654
        self.list_start(node)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   655
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   656
    def depart_enumerated_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   657
        self.list_end()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   658
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   659
    def visit_error(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   660
        self.visit_admonition(node, 'error')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   661
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   662
    depart_error = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   663
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   664
    def visit_field(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   665
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   666
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   667
    def depart_field(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   668
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   669
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   670
    def visit_field_body(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   671
        if self._in_docinfo:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   672
            name_normalized = self._field_name.lower().replace(" ", "_")
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   673
            self._docinfo_names[name_normalized] = self._field_name
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   674
            self.visit_docinfo_item(node, name_normalized)
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   675
            raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   676
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   677
    def depart_field_body(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   678
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   679
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   680
    def visit_field_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   681
        self.indent(FIELD_LIST_INDENT)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   682
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   683
    def depart_field_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   684
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   685
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   686
    def visit_field_name(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   687
        if self._in_docinfo:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   688
            self._field_name = node.astext()
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   689
            raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   690
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   691
            self.body.append(self.defs['field_name'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   692
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   693
    def depart_field_name(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   694
        self.body.append(self.defs['field_name'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   695
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   696
    def visit_figure(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   697
        self.indent(2.5)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   698
        self.indent(0)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   699
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   700
    def depart_figure(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   701
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   702
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   703
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   704
    def visit_footer(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   705
        self.document.reporter.warning('"footer" not supported', base_node=node)
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   706
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   707
    def depart_footer(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   708
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   709
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   710
    def visit_footnote(self, node):
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10007
diff changeset
   711
        num, text = node.astext().split(None, 1)
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   712
        num = num.strip()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   713
        self.body.append('.IP [%s] 5\n' % self.deunicode(num))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   714
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   715
    def depart_footnote(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   716
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   717
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   718
    def footnote_backrefs(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   719
        self.document.reporter.warning(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   720
            '"footnote_backrefs" not supported', base_node=node
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   721
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   722
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   723
    def visit_footnote_reference(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   724
        self.body.append('[' + self.deunicode(node.astext()) + ']')
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   725
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   726
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   727
    def depart_footnote_reference(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   728
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   729
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   730
    def visit_generated(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   731
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   732
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   733
    def depart_generated(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   734
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   735
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   736
    def visit_header(self, node):
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   737
        raise NotImplementedError(node.astext())
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   738
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   739
    def depart_header(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   740
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   741
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   742
    def visit_hint(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   743
        self.visit_admonition(node, 'hint')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   744
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   745
    depart_hint = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   746
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   747
    def visit_subscript(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   748
        self.body.append('\\s-2\\d')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   749
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   750
    def depart_subscript(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   751
        self.body.append('\\u\\s0')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   752
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   753
    def visit_superscript(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   754
        self.body.append('\\s-2\\u')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   755
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   756
    def depart_superscript(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   757
        self.body.append('\\d\\s0')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   758
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   759
    def visit_attribution(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   760
        self.body.append('\\(em ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   761
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   762
    def depart_attribution(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   763
        self.body.append('\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   764
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   765
    def visit_image(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   766
        self.document.reporter.warning('"image" not supported', base_node=node)
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   767
        text = []
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   768
        if 'alt' in node.attributes:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   769
            text.append(node.attributes['alt'])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   770
        if 'uri' in node.attributes:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   771
            text.append(node.attributes['uri'])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   772
        self.body.append('[image: %s]\n' % ('/'.join(text)))
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   773
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   774
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   775
    def visit_important(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   776
        self.visit_admonition(node, 'important')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   777
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   778
    depart_important = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   779
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   780
    def visit_label(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   781
        # footnote and citation
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   782
        if isinstance(node.parent, nodes.footnote) or isinstance(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   783
            node.parent, nodes.citation
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   784
        ):
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   785
            raise nodes.SkipNode()
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   786
        self.document.reporter.warning('"unsupported "label"', base_node=node)
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   787
        self.body.append('[')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   788
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   789
    def depart_label(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   790
        self.body.append(']\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   791
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   792
    def visit_legend(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   793
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   794
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   795
    def depart_legend(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   796
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   797
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   798
    # WHAT should we use .INDENT, .UNINDENT ?
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   799
    def visit_line_block(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   800
        self._line_block += 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   801
        if self._line_block == 1:
10006
9c142ed9c405 rst2man: separate inline blocks from previous paragraphs
Christian Ebert <blacktrash@gmx.net>
parents: 9793
diff changeset
   802
            self.body.append('.sp\n')
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   803
            self.body.append('.nf\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   804
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   805
            self.body.append('.in +2\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   806
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   807
    def depart_line_block(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   808
        self._line_block -= 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   809
        if self._line_block == 0:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   810
            self.body.append('.fi\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   811
            self.body.append('.sp\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   812
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   813
            self.body.append('.in -2\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   814
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   815
    def visit_line(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   816
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   817
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   818
    def depart_line(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   819
        self.body.append('\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   820
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   821
    def visit_list_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   822
        # man 7 man argues to use ".IP" instead of ".TP"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   823
        self.body.append(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   824
            '.IP %s %d\n'
45942
89a2afe31e82 formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents: 43076
diff changeset
   825
            % (
89a2afe31e82 formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents: 43076
diff changeset
   826
                next(self._list_char[-1]),
89a2afe31e82 formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents: 43076
diff changeset
   827
                self._list_char[-1].get_width(),
89a2afe31e82 formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents: 43076
diff changeset
   828
            )
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   829
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   830
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   831
    def depart_list_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   832
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   833
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   834
    def visit_literal(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   835
        self.body.append(self.defs['literal'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   836
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   837
    def depart_literal(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   838
        self.body.append(self.defs['literal'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   839
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   840
    def visit_literal_block(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   841
        self.body.append(self.defs['literal_block'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   842
        self._in_literal = True
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   843
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   844
    def depart_literal_block(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   845
        self._in_literal = False
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   846
        self.body.append(self.defs['literal_block'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   847
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   848
    def visit_meta(self, node):
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   849
        raise NotImplementedError(node.astext())
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   850
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   851
    def depart_meta(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   852
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   853
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   854
    def visit_note(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   855
        self.visit_admonition(node, 'note')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   856
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   857
    depart_note = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   858
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   859
    def indent(self, by=0.5):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   860
        # if we are in a section ".SH" there already is a .RS
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   861
        step = self._indent[-1]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   862
        self._indent.append(by)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   863
        self.body.append(self.defs['indent'][0] % step)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   864
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   865
    def dedent(self):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   866
        self._indent.pop()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   867
        self.body.append(self.defs['indent'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   868
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   869
    def visit_option_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   870
        self.indent(OPTION_LIST_INDENT)
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   871
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   872
    def depart_option_list(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   873
        self.dedent()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   874
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   875
    def visit_option_list_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   876
        # one item of the list
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   877
        self.body.append(self.defs['option_list_item'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   878
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   879
    def depart_option_list_item(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   880
        self.body.append(self.defs['option_list_item'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   881
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   882
    def visit_option_group(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   883
        # as one option could have several forms it is a group
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   884
        # options without parameter bold only, .B, -v
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   885
        # options with parameter bold italic, .BI, -f file
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   886
        #
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   887
        # we do not know if .B or .BI
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   888
        self.context.append('.B')  # blind guess
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   889
        self.context.append(len(self.body))  # to be able to insert later
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   890
        self.context.append(0)  # option counter
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   891
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   892
    def depart_option_group(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   893
        self.context.pop()  # the counter
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   894
        start_position = self.context.pop()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   895
        text = self.body[start_position:]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   896
        del self.body[start_position:]
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   897
        self.body.append('%s%s\n' % (self.context.pop(), ''.join(text)))
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   898
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   899
    def visit_option(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   900
        # each form of the option will be presented separately
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10007
diff changeset
   901
        if self.context[-1] > 0:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   902
            self.body.append(', ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   903
        if self.context[-3] == '.BI':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   904
            self.body.append('\\')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   905
        self.body.append(' ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   906
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   907
    def depart_option(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   908
        self.context[-1] += 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   909
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   910
    def visit_option_string(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   911
        # do not know if .B or .BI
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   912
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   913
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   914
    def depart_option_string(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   915
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   916
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   917
    def visit_option_argument(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
   918
        self.context[-3] = '.BI'  # bold/italic alternate
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   919
        if node['delimiter'] != ' ':
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10007
diff changeset
   920
            self.body.append('\\fB%s ' % node['delimiter'])
18054
b35e3364f94a check-code: there must also be whitespace between ')' and operator
Mads Kiilerich <madski@unity3d.com>
parents: 17517
diff changeset
   921
        elif self.body[len(self.body) - 1].endswith('='):
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   922
            # a blank only means no blank in output, just changing font
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   923
            self.body.append(' ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   924
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   925
            # blank backslash blank, switch font then a blank
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   926
            self.body.append(' \\ ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   927
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   928
    def depart_option_argument(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   929
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   930
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   931
    def visit_organization(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   932
        self.visit_docinfo_item(node, 'organization')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   933
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   934
    def depart_organization(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   935
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   936
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   937
    def visit_paragraph(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   938
        # ``.PP`` : Start standard indented paragraph.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   939
        # ``.LP`` : Start block paragraph, all except the first.
9712
18b134ef294c kill trailing whitespace
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 9628
diff changeset
   940
        # ``.P [type]``  : Start paragraph type.
17487
1bdce7e918bb spelling: don't/do not
timeless@mozdev.org
parents: 16686
diff changeset
   941
        # NOTE don't use paragraph starts because they reset indentation.
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   942
        # ``.sp`` is only vertical space
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   943
        self.ensure_eol()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   944
        self.body.append('.sp\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   945
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   946
    def depart_paragraph(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   947
        self.body.append('\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   948
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   949
    def visit_problematic(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   950
        self.body.append(self.defs['problematic'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   951
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   952
    def depart_problematic(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   953
        self.body.append(self.defs['problematic'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   954
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   955
    def visit_raw(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   956
        if node.get('format') == 'manpage':
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   957
            self.body.append(node.astext() + "\n")
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   958
        # Keep non-manpage raw text out of output:
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   959
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   960
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   961
    def visit_reference(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   962
        """E.g. link or email address."""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   963
        self.body.append(self.defs['reference'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   964
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   965
    def depart_reference(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   966
        self.body.append(self.defs['reference'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   967
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   968
    def visit_revision(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   969
        self.visit_docinfo_item(node, 'revision')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   970
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   971
    depart_revision = depart_docinfo_item
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   972
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   973
    def visit_row(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   974
        self._active_table.new_row()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   975
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   976
    def depart_row(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   977
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   978
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   979
    def visit_section(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   980
        self.section_level += 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   981
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   982
    def depart_section(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   983
        self.section_level -= 1
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   984
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   985
    def visit_status(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   986
        self.visit_docinfo_item(node, 'status')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   987
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   988
    depart_status = depart_docinfo_item
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   989
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   990
    def visit_strong(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   991
        self.body.append(self.defs['strong'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   992
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   993
    def depart_strong(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   994
        self.body.append(self.defs['strong'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   995
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   996
    def visit_substitution_definition(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   997
        """Internal only."""
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
   998
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   999
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1000
    def visit_substitution_reference(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1001
        self.document.reporter.warning(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1002
            '"substitution_reference" not supported', base_node=node
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1003
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1004
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1005
    def visit_subtitle(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1006
        if isinstance(node.parent, nodes.sidebar):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1007
            self.body.append(self.defs['strong'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1008
        elif isinstance(node.parent, nodes.document):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1009
            self.visit_docinfo_item(node, 'subtitle')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1010
        elif isinstance(node.parent, nodes.section):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1011
            self.body.append(self.defs['strong'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1012
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1013
    def depart_subtitle(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1014
        # document subtitle calls SkipNode
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1015
        self.body.append(self.defs['strong'][1] + '\n.PP\n')
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1016
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1017
    def visit_system_message(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1018
        # TODO add report_level
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1019
        # if node['level'] < self.document.reporter['writer'].report_level:
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1020
        #    Level is too low to display:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1021
        #    raise nodes.SkipNode
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1022
        attr = {}
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1023
        if node.hasattr('id'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1024
            attr['name'] = node['id']
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1025
        if node.hasattr('line'):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1026
            line = ', line %s' % node['line']
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1027
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1028
            line = ''
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1029
        self.body.append(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1030
            '.IP "System Message: %s/%s (%s:%s)"\n'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1031
            % (node['type'], node['level'], node['source'], line)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1032
        )
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1033
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1034
    def depart_system_message(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1035
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1036
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1037
    def visit_table(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1038
        self._active_table = Table()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1039
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1040
    def depart_table(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1041
        self.ensure_eol()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1042
        self.body.extend(self._active_table.as_list())
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1043
        self._active_table = None
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1044
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1045
    def visit_target(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1046
        # targets are in-document hyper targets, without any use for man-pages.
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
  1047
        raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1048
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1049
    def visit_tbody(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1050
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1051
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1052
    def depart_tbody(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1053
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1054
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1055
    def visit_term(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1056
        self.body.append(self.defs['term'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1057
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1058
    def depart_term(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1059
        self.body.append(self.defs['term'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1060
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1061
    def visit_tgroup(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1062
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1063
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1064
    def depart_tgroup(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1065
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1066
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1067
    def visit_thead(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1068
        # MAYBE double line '='
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1069
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1070
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1071
    def depart_thead(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1072
        # MAYBE double line '='
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1073
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1074
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1075
    def visit_tip(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1076
        self.visit_admonition(node, 'tip')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1077
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1078
    depart_tip = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1079
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1080
    def visit_title(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1081
        if isinstance(node.parent, nodes.topic):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1082
            self.body.append(self.defs['topic-title'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1083
        elif isinstance(node.parent, nodes.sidebar):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1084
            self.body.append(self.defs['sidebar-title'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1085
        elif isinstance(node.parent, nodes.admonition):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1086
            self.body.append('.IP "')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1087
        elif self.section_level == 0:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1088
            self._docinfo['title'] = node.astext()
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1089
            # document title for .TH
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1090
            self._docinfo['title_upper'] = node.astext().upper()
29158
7c0297bfe8bf py3: make raise statement python3 compatible
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28967
diff changeset
  1091
            raise nodes.SkipNode()
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1092
        elif self.section_level == 1:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1093
            self.body.append('.SH ')
9793
d2006e6d1d59 rst2man: more robust uppercasing of section titles
Martin Geisler <mg@lazybytes.net>
parents: 9791
diff changeset
  1094
            for n in node.traverse(nodes.Text):
d2006e6d1d59 rst2man: more robust uppercasing of section titles
Martin Geisler <mg@lazybytes.net>
parents: 9791
diff changeset
  1095
                n.parent.replace(n, nodes.Text(n.astext().upper()))
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1096
        else:
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1097
            self.body.append('.SS ')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1098
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1099
    def depart_title(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1100
        if isinstance(node.parent, nodes.admonition):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1101
            self.body.append('"')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1102
        self.body.append('\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1103
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1104
    def visit_title_reference(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1105
        """inline citation reference"""
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1106
        self.body.append(self.defs['title_reference'][0])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1107
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1108
    def depart_title_reference(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1109
        self.body.append(self.defs['title_reference'][1])
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1110
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1111
    def visit_topic(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1112
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1113
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1114
    def depart_topic(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1115
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1116
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1117
    def visit_sidebar(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1118
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1119
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1120
    def depart_sidebar(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1121
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1122
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1123
    def visit_rubric(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1124
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1125
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1126
    def depart_rubric(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1127
        pass
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1128
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1129
    def visit_transition(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1130
        # .PP      Begin a new paragraph and reset prevailing indent.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1131
        # .sp N    leaves N lines of blank space.
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1132
        # .ce      centers the next line
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1133
        self.body.append('\n.sp\n.ce\n----\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1134
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1135
    def depart_transition(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1136
        self.body.append('\n.ce 0\n.sp\n')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1137
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1138
    def visit_version(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1139
        self.visit_docinfo_item(node, 'version')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1140
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1141
    def visit_warning(self, node):
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1142
        self.visit_admonition(node, 'warning')
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1143
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1144
    depart_warning = depart_admonition
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1145
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1146
    def unimplemented_visit(self, node):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1147
        raise NotImplementedError(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1148
            'visiting unimplemented node type: %s' % node.__class__.__name__
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1149
        )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42060
diff changeset
  1150
9418
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1151
a82db54bc3be doc: use our own rst2man.py script (issue1746)
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
  1152
# vim: set fileencoding=utf-8 et ts=4 ai :