[docutils:bugs] #477 Generated man page leads to groff warning "TE macro called with TW register undefined"

Dmitry Shachnev via Docutils-develop <[email protected]>
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/bugs/477/819bb5316e901b0b03c01926b525dcb0ec3c4107.bugs@docutils.p.sourceforge.net>
Hi Engelbert!

I think your fix is not fully correct. It adds this fragment:
```python
self._has_a_table = True
if self._has_a_table:
    # the comment to hint that preprocessor tbl should be called
    self.head.insert(0, "'\\\" t\n")
```

Here, the condition in `if` statement will be always true. So every time we encounter a table, we will add a new line to `self.head`.

Maybe you meant something like this instead?

```python
if not self._has_a_table:
    self._has_a_table = True
    # the comment to hint that preprocessor tbl should be called
    self.head.insert(0, "'\\\" t\n") 
    # single apostrophe, backslash, double apostroph, blank, character-t
```


---

**[bugs:#477] Generated man page leads to groff warning "TE macro called with TW register undefined"**

**Status:** open-fixed
**Labels:** manpage writer 
**Created:** Sun Nov 12, 2023 06:15 PM UTC by Dmitry Shachnev
**Last Updated:** Sun Nov 19, 2023 09:47 AM UTC
**Owner:** engelbert gruber


In Debian, we have a `lintian` tool which runs various checks on the built packages. Among other things, it makes sure that man pages explicitly require all preprocessors that they need.

I have received a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053355) about an error reported by that tool. It looks like that if a document contains a table, `rst2man` generates macros `.TS` and `.TE` which are recognized by [tbl](https://manpages.debian.org/testing/groff-base/tbl.1.en.html) preprocessor, but does not generate a dependency on it.

Here is a minimal reproducing example:
```
$ cat table.rst
.. list-table::

   * - Foo
     - Bar
$ rst2man table.rst | MANROFFSEQ='' man -l -Z - >/dev/null
an.tmac:<standard input>:43: warning: tbl preprocessor failed, or it or soelim was not run; table(s) likely not rendered (TE macro called with TW register undefined)
```

According to [this email](https://lists.debian.org/debian-devel/2023/08/msg00220.html), to fix this error, `rst2man` should add this line on top of the generated man page:

    '\" t

Cc @branden — I think you are interested in all manpage-related issues.


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.