On Fri, Jul 26, 2024 at 04:10:52PM -0700, Roger Crew wrote:
> Patrice Dumas writes:
>  > If you are ready to share the code, it could be interesting to
>  > have it in a maintained init file if it gives a result more
>  > similar with other formats.
> 
> I don't think it will be doing anything really surprising:
> 
> Texinfo::Config::texinfo_register_formatting_function(
>   format_single_comment => sub {
>     my $self = shift;
>     my ($id, $href, $mark, $text) = @_;
>     my ($pre, $post) = $text =~ m{\A\s*(<p\b.*?>)?(.*)\z}saai;
> 
>     return '<div class="footnote-text">' . $pre
>       . qq{<sup><a id="$id" href="$href">$mark</a></sup>}
>       . '&emsp;' . $post . "</div>\n";
>   }
> );
> 
> modulo various not-totally-resolved questions, e.g., what to do
> about footnote text NOT starting with <p> and other pathological
> cases (none of my footnotes have this particular problem, so the
> probable answer is, "Don't do that"), what <div> class name plays
> best with everything else in CSS Land, and whether <sup> really
> is a good idea here (vs. <span class="footnote-mark">$mark</span>
> vs. leaving it as ($mark))...

The <sup> looks ok to me but the way the text is inserted in paragraph is
not good nor generic enough, as you note.  The correct way would be to use
$converter->register_pending_formatted_inline_content (though it may not
be enough if block commands are used):
https://www.gnu.org/software/texinfo/manual/texi2any_api/html_node/Setting-Up-Content-for-the-Next-Text-Container.html

Still this is interesting, as this calls for including the call
of convert_tree_new_formatting_context in format_single_footnote. I'll
make that change.

Following existing (soft) conventions on CSS classes names, both
footnote-text and text-footnote would be ok to me.

> The reason for NOT doing it that way is I'd then miss out on
> whatever happens (bugfixes, enhancements) with that default
> handler in the future.  And seeing the extent of the changes
> between 6.7, 6.8, 7.0, 7.1, it's clear that whole section of code
> is under rather active development, making it more likely there
> will be further changes...
> 
> ... which I'll inevitably have to track (yay, life on the bleeding 
> edge), but the less I have to track, the better.

You'll still have to track the changes to the format_single_footnote.

> Um, yeah ... *that* I probably would NOT have gotten right the
> first time (suffice it to say, it's been one of my life goals to
> learn as little as possible about XS).

;-)

-- 
Pat

  • (featu... Roger Crew via Bug reports for the GNU Texinfo documentation system
    • R... Patrice Dumas
      • ... Roger Crew via Bug reports for the GNU Texinfo documentation system
        • ... Patrice Dumas
          • ... Patrice Dumas
    • R... Patrice Dumas

Reply via email to