Op donderdag 08-04-2010 om 14:19 uur [tijdzone +0200], schreef Jan
Nieuwenhuizen:

Please see new patch attached, this does not look at the
xref file, but directly uses @translationof command and
fixes cut and paste programming for normalise_node
(thanks to anno, LeoNerd and mst in #perl).

I'd like to apply this and enable 'nl' in langs.

Jan.

> Attached is a patch for texi2html init that fixes the
> undefined node names (Changes, Manuals, Old downloads)
> problem when untranslated node names are used in
> a @ref{}, for nodes that have been translated.
> 
> This fixes all warnings in the dutch website and
> most other translations too (in the fr are a
> few oddities).

>From 94ae727be544f97a6626bfd1ba2ea52e7ce2cb05 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <[email protected]>
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..25c161d 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

_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to