On Sat, Aug 01, 2015 at 12:03:27AM +0100, Gavin Smith wrote: > On 31 July 2015 at 12:16, Patrice Dumas <[email protected]> wrote: > > On Fri, Jul 31, 2015 at 11:32:26AM +0100, Gavin Smith wrote: > >> > >> There is probably something you can do with an init file, maybe by > >> replacing/wrapping _convert_heading_command as the handler for @node. > >> >From looking at HTML.pm I didn't see any way to customize the > >> filenames when the output was being done. Maybe one of the "stage > >> handlers" could be used, like "init". > >> > >> Perhaps there could be a hook for customizing filenames for nodes that > >> init files could use. > > > > I think that there are already hooks for customizing file names and > > anchor names: > > > > node_target_name node_file_name sectioning_command_target_name > > element_file_name special_element_target_file_name > > So basically Kevin, these are names of possible subroutines that could > exist within the Texinfo::Config namespace. To set these, I reckon you > would have a line: > > package Texinfo::Config; > > in your init file, which switches to that namespace. (Apologies if I'm > stating the obvious here, but it's stuff I've just been learning about > myself.) This causes any following "sub" definitions to be placed in > the Texinfo::Config namespace, so they can be found in HTML.pm.
Actually this is not that obvious, as it is not required ;-). Indeed, the init files are already loaded in the package Texinfo::Config; in texi2any.pl. > There is some draft documentation of the API in the doc/draft_api.texi > file; most likely you would have to look at HTML.pm to see how these > hooks are being used. Beware that this API has never been really finalized, it could change in the future. There are examples of use of the HTML customization API in tp/init/*.pm and (used in test files so not necessarilly reala world files) tp/t/init/*.init (except for tp/t/init/l2h.init). -- Pat
