Index: Texinfo/Report.pm =================================================================== --- Texinfo/Report.pm (revision 6302) +++ Texinfo/Report.pm (working copy) @@ -49,6 +49,7 @@ use Locale::Messages; # to be able to load a parser if none was given to gdt. use Texinfo::Parser; +#use Parsetexi; # return the errors and warnings sub errors($) @@ -374,9 +375,52 @@ if (defined($re)) { # next line taken from libintl perl, copyright Guido. sub __expand $translation_result =~ s/\{($re)\}/address@hidden/g; - foreach my $substitution(keys %$context) { - #print STDERR "$translation_result $substitution $context->{$substitution}\n"; - $parser_conf->{'values'}->{'_'.$substitution} = $context->{$substitution}; + #foreach my $substitution(keys %$context) { + # #print STDERR "$translation_result $substitution $context->{$substitution}\n"; + # $parser_conf->{'values'}->{'_'.$substitution} = $context->{$substitution}; + #} + for my $substitution(keys %$context) { + my $value = $context->{$substitution}; + my $container = { 'type' => 'paragraph', 'contents' => [], }; + #warn "substituting $substitution\n"; + if (ref($value) eq 'HASH') { + $container->{'contents'} = [ $value ]; + } elsif (ref($value) eq 'ARRAY') { + $container->{'contents'} = $value; + } + my $value_string = $self->_convert($container); + #warn "value converted is $value_string\n"; + + # Remove leading and trailing whitespace (this depends on the + # type of container used). In HTML output we'd have

surrounding + # the text; maybe experiment with different container types. + $value_string =~ s/^\s*//; + $value_string =~ s/\s*$//; + + # Try to quote characters special in Texinfo syntax + # This isn't good enough: we'd need to quote <, etc. for HTML + # output. + # $value_string =~ s/@/@@/g; + # $value_string =~ s/\{/@\{/g; + # $value_string =~ s/\}/@\}/g; + $value_string =~ s/\}/\x01/g; + $value_string =~ s/\{/address@hidden/g; + $value_string =~ s/@/address@hidden/g; + $value_string =~ s/\x01/address@hidden/g; + + # This leads to blank output for some reason + #$value_string = '@inlinefmt{info, ' . $value_string . '}'; + #warn "value string is $value_string\n"; + + # The 'type' -> 'raw' here is because $value_string is already + # in the output format, so don't e.g. convert < to < in HTML. + $parser_conf->{'values'}->{'_'.$substitution} + = $value_string; + #= {'text' => $value_string, 'type' => 'raw'}; + + # What we need is a "raw values" array, with the simplicity of + # passing a value string, without the full complexity of needing + # to be able to pass Texinfo trees into the C code. } } @@ -400,6 +444,7 @@ } #my $parser = Texinfo::Parser::parser($parser_conf); my $parser = Texinfo::Parser::simple_parser($parser_conf); + #my $parser = Parsetexi::parser($parser_conf); if ($parser->{'DEBUG'}) { print STDERR "GDT $translation_result\n"; }