Control: forwarded -1 https://sourceforge.net/p/docutils/patches/205/

Hi all!

On Wed, Jul 26, 2023 at 05:08:44AM -0500, G. Branden Robinson wrote:
>         # ``B`` bold, ``I`` italic, ``R`` roman should be available.
>
> Yes!
>
>         # Hopefully ``C`` courier too.
>
> Yeah, no, that's never been true of groff (nor of mandoc(1)).

For some reason, with HTML output device the only way to produce a monospace
block (<pre> or <tt>) that I found is with ".ft C". The other options I tried
(".ft CR" and ".EX"/".EE") produce a paragraph with regular font (<p>):

  $ cat foo.1
  .TH FOO 1
  .SH DESCRIPTION

  .ft C
  A paragraph in C font.
  .ft P

  .ft CR
  A paragraph in CR font.
  .ft P

  .EX
  An example.
  .EE

  $ groff -man -Thtml < foo.1
  [...]
  <p style="margin-left:9%; margin-top: 1em"><tt>A paragraph
  in C font.</tt></p>

  <p style="margin-left:9%; margin-top: 1em">A paragraph in
  CR font.</p>

  <p style="margin-left:9%; margin-top: 1em">An example.</p>
  [...]

(Similar result with "man -Thtml -l foo.1".)

But I think rst2man users don't care about HTML output. If someone wanted
HTML, they would probably use rst2html.

> I have the following patch, which was super-straightforward:
> 
> $ diff -u /usr/lib/python3/dist-packages/docutils/writers/manpage.py 
> ATTIC/manpage.py
> --- /usr/lib/python3/dist-packages/docutils/writers/manpage.py  2019-12-30 
> 10:32:00.000000000 -0600
> +++ ATTIC/manpage.py    2023-07-26 04:41:54.933370003 -0500
> @@ -218,7 +218,7 @@
>                  'definition_list_item': ('.TP', ''),
>                  'field_name': ('.TP\n.B ', '\n'),
>                  'literal': ('\\fB', '\\fP'),
> -                'literal_block': ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
> +                'literal_block': ('.EX\n', '\n.EE\n'),
> 
>                  'option_list_item': ('.TP\n', ''),
>
> I'm not certain of it because I haven't yet figured out how to test it.
> (I have painful memories of "PYTHONPATH" and "virtualenv".)

I think we still need .sp, without that there is no blank line before the
example.

I have forwarded an updated patch upstream, see the Forwarded link. When it's
accepted by upstream developers, I will do a new upload.

> I see other things I'd like to improve in this man page writer (there
> are multiple mistaken claims in the comments, and some injected markup
> that _seems_ unnecessary), but one issue at a time...

That would be welcome. Please make contributions directly to upstream, they
have:

Bugs: https://sourceforge.net/p/docutils/bugs/
Patches: https://sourceforge.net/p/docutils/patches/
Mailing list: https://sourceforge.net/p/docutils/patches/

--
Dmitry Shachnev

Attachment: signature.asc
Description: PGP signature

Reply via email to