]> git.donarmstrong.com Git - lilypond.git/commitdiff
Doc: obsolete need for skeleton files. Fixes `make website' warnings.
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 8 Apr 2010 13:35:35 +0000 (15:35 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 9 Apr 2010 09:36:37 +0000 (11:36 +0200)
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}

while 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

Many thanks for the swift and eager perl help (for how to do `foo =
bar; def bar (): foo ()' where bar happens to be a function) from

Documentation/lilypond-texi2html.init

index 55548ffb96dcee4b3c1042799f2093fe500f2eea..b943c3aabbb4348104db9d7f8c551e7d042ca8a1 100644 (file)
 ###    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 {