>From ba96cc185836dfa2231d1dd77578acd1490cdd22 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 8 Apr 2010 15:35:35 +0200 Subject: [PATCH] Doc: obsolete need for skeleton files. Fixes `make website' warnings. Use map source->translationof node names to rewrite any untranslated usages of already translated nodes. This occurs eg after a [2] delivery of the Dutch site, where the untranslated news.itexi has @ref{Changes} and community.itexi has @ref{Manuals} and @ref{Old downloads} but these are translated in nl/web/manuals.itexi Veranderingen @translationof Changes nl/web/manuals.itexi Handleidingen @translationof Manuals nl/web/download.itexi Oude downloads @translationof Old downloads --- Documentation/lilypond-texi2html.init | 38 ++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init index 55548ff..b943c3a 100644 --- a/Documentation/lilypond-texi2html.init +++ b/Documentation/lilypond-texi2html.init @@ -63,8 +63,25 @@ ### non-standard chars replaced by _xxxx (ascii char code) and forced to ### start with a letter by prepending t_g if necessary) +package main; +$original_normalise_node = \&normalise_node; + +sub t2h_default_normalise_node($) +{ + my $text = shift; + $original_normalise_node->($text); +} + +*normalise_node = sub($) +{ + my $text = shift; + return &$Texi2HTML::Config::normalise_node($text); +}; package Texi2HTML::Config; +##$normalise_node = \&t2h_default_normalise_node; +$normalise_node = \&lilypond_normalise_node; + use utf8; use Encode qw(decode); @@ -785,6 +802,7 @@ sub lilypond_css_lines ($$) my $lastfilename; my $docnr = 0; my $node_to_filename_map = (); +$source_to_translationof_map = (); # This function makes sure that files are only generated for numbered sections, @@ -874,6 +892,18 @@ sub lilypond_element_file_name($$$) return; } +sub lilypond_normalise_node($) +{ + my $text = shift; + my $norm = main::t2h_default_normalise_node($text); + if (exists ($source_to_translationof_map->{$text})) { + my $original = $source_to_translationof_map->{$text}; + $norm = main::t2h_default_normalise_node($original); + } + + return $norm; +} + sub lilypond_element_target_name($$$) { my $element = shift; @@ -996,7 +1026,13 @@ sub lilypond_unknown($$$$$) # python script messed up ;-) if ($pass == 1 and $macro eq "translationof") { if (ref($state->{'element'}) eq 'HASH') { - $state->{'element'}->{'translationof'} = main::normalise_space($line); + $state->{'element'}->{'translationof'} = main::normalise_space($line); + my $source = main::normalise_space ($line); + if (ref($state->{'node_ref'}) eq 'HASH') { + my $translationof = $state->{'node_ref'}->{'texi'}; + our %source_to_translationof_map; + $source_to_translationof_map->{$source} = $translationof; + } } return ('', 1, undef, undef); } else { -- 1.7.0