bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: <code> tags in HTML


From: Patrice Dumas
Subject: Re: <code> tags in HTML
Date: Tue, 27 Mar 2012 22:42:00 +0200
User-agent: Mutt/1.5.20 (2009-12-10)

On Fri, Mar 23, 2012 at 09:06:26AM +0000, John Darrington wrote:
> Some of the non-english speaking PSPP users have been trying to use automatic 
> translation tools to read the HTML generated from the PSPP manual's Texinfo 
> source.
> 
> Apparently many such tools make a point of not attempting to translate text
> between <CODE></CODE> tags.
> 
> So far as I can tell makeinfo only puts in such tags when it encounters @code
> However much of our not-to-be-translated text is not in @code commands but in 
> @var, @samp, @display or @example environments.
> 
> Of course we could wrap absolutely everything in @code commands, but this 
> seems
> like a rather cumbersome approach.
> 
> Is it possible to tell the HTML generator to put <code> tags in for the other 
> commands?

With the new parser/converter, it is not that hard to change the
formatting.  Something like (in an init file)


  use vars qw(%style_commands_formatting);

  $style_commands_formatting{'normal'}->{'samp'}->{'attribute'} = 'code';

For @display or @example, it is a bit more complicated, something like

  sub add_code_in_preformatted ($$$$)
  {
    my $self = shift;
    my $cmdname = shift;
    my $command = shift;
    my $content = shift;

    return
      &{$self->default_types_conversion($cmdname)}($self,
          $cmdname, $command, '<code>'.$content.'</code>');
  }

  texinfo_register_type_formatting('preformatted', \&add_code_in_preformatted);



Subject to change and undocumented...

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]