|
From: | Bernard Baillargeon |
Subject: | Re: simple doc point |
Date: | Thu, 9 Jun 2022 13:10:36 -0500 |
On Wed, Jun 8, 2022 at 5:14 PM Eric Blake <eblake@redhat.com> wrote:
> And it looks like back in 2006 (commit dddcc3d9), when I updated the
> manual to use @deffn instead of @example for prototypes (for better
> typesetting and indexing purposes), I intentionally separated NAME
> from ARGUMENTS, assuming that texinfo was insistent on the separation.
>
> On a whim, just now I tried removing the space between NAME and
> ARGUMENTS in the .texi file, to see if the resulting info file still
> makes sense. In 'info', it does. But in html, it is worse;
> previously, things would render something like:
>
> Builtin: <b>define</b> <i>(name, [expansion])</i>
>
> now it renders something like:
>
> Builtin: <b>define<i>(name,</i></b> <i>[expansion])</i>
>
> which is unacceptable (why is the name argument bolded, when the
> expansion argument is not).
>
> Maybe a texinfo expert would be able to help me come up with something
> that does what we want, of producing typesetting that bolds the macro
> name, but omits the space between the macro and the '(' of the
> arguments, while still getting all of the other benefits of @deffn?
This appears to be a real problem, although there isn't an easy solution.
It seems that the space is hard-coded in the HTML output. It looks like this:
$tree = $self->gdt("\@strong{{name}} \@emph{{arguments}}", {
'name' => $name,
'arguments' => $arguments});
With the following change, the space disappears:
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 47408c480b..0c93e79200 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5888,7 +5888,7 @@ sub _convert_def_line_type($$$$)
$category_result = $self->convert_tree($category_tree)
if (defined($category_tree));
if ($arguments) {
- $tree = $self->gdt("\@strong{{name}} \@emph{{arguments}}", {
+ $tree = $self->gdt("\@strong{{name}}\@emph{{arguments}}", {
'name' => $name,
'arguments' => $arguments});
} else {
I've checked with texinfo.tex and there is a similar problem there.
I think the best way to fix this would be if no space was necessary
and an ( started the arguments. Document authors would choose whether
to include the space in the source and this would be reflected in the
output. This would avoid the need for any customization settings to be
used with texi2any.
This might be hard to implement, though, especially in TeX. It is
complicated by the fact that ( is not always present, as in the
example in the manual:
@deffn Command forward-char nchars
Move point forward @var{nchars} characters.
@end deffn
I will try to look at texinfo.tex to understand the code better to see
if something can be done.
[Prev in Thread] | Current Thread | [Next in Thread] |