On Wed, Sep 25, 2024 at 07:43:10PM -0400, Benjamin Kalish wrote:
> Thanks. I can see it both ways, but still lean towards it being a bug.
> Headings in HTML can contain HTML and I don't think the user has any reason
> to expect that the content of a heading would end up anywhere else. If it
> were up to me the deciding factor would be whether the literal content of
> the headings need to show up in HTML attributes (and I don't see why they
> would).

I had a look at the code, I could have missed some places.  Attributes
are based on Texinfo code at least in the following cases (the precise
@-command being used possibly depending on split/unsplit or other
customization):

* @image <img> alt attribute
* <abbr> title attribute based on @abbr/@acronym second argument
* icon direction formatting <img> alt (based on @node or sectioning commands)
* <meta> name="description" (based on @documentdescription or @*title and @node
  or sectioning commands).
* <meta> name="keywords" (based on @*title and @node or sectioning commands).
* <link> title attribute (based on @node or sectioning commands).
* (button name or description as title or rel in href or link elements,
  but this can be ignored here as it is not based on user Texinfo code)

I did not list the places where a file is expected (@image first
argument, @verbatiminclude), but we can assume that users do not get the idea
to use @inlineraw in those contexts.

> If it is necessary, then yes, it is up to the user to avoid the use
> of @inlineraw headings (and a warning would be most welcome!).

@inlineraw with entities but no element is ok too, so a warning may be
unnecessary.

> On the other
> hand, if it is not necessary and that content doesn't need to show up in
> attributes, or if an escaped version could be used instead,

I can't imagine any other change than removing the alt/title/metadata
output (as described above).  This is possible, as none of these
attributes are strictly needed, yet the produced HTML is better with
those, I think.  Very motivated users could use the HTML formatting API
to modify the formatting.

Also note that this issue could happen for other formats, for instance
in DocBook there could be similar issues with attributes.  In LaTeX
output, the commands that can end up in captions or table of contents
cannot contain everything.

> then the user
> should be allowed to use @inlineraw here and a change to the code is
> necessary to prevent noncompliant HTML output.

It is difficult or even impossible to avoid noncompliant HTML output when
raw HTML is output.  There is this issue of expansion of raw HTML in
attributes, but it is probably only one possible issue amng many others.
How HTML generated from Texinfo code and raw HTML interact cannot be
foreseen when parsing or outputting because HTML in raw HTML is not
analysed (Texinfo in raw HTML is parsed as usual) but simply output
unchanged.


What about the following sentence in "Inline Conditionals: ‘@inline’,
‘@inlineifelse’, ‘@inlineraw’" node?

 Beware that in some command arguments, such as @node or sectioning
 commands raw @inlineraw text is output in diverse formatting contexts.
 Raw HTML could end up in HTML attributes, raw LaTeX could be used for
 table of contents.  You should make sure that the raw code you provide
 is adequate in such contexts.

-- 
Pat

Reply via email to