Hi,
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).
Greetings,
Jan.
>From 0a5c0e703f3c2762466a142f59d9ac202e8d89d5 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <[email protected]>
Date: Thu, 8 Apr 2010 14:02:44 +0200
Subject: [PATCH] Doc: obsolete need for skeleton files. Fixes `make website' warnings.
Use map translated->english 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 | 52 ++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 1 deletions(-)
diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init
index 55548ff..588f013 100644
--- a/Documentation/lilypond-texi2html.init
+++ b/Documentation/lilypond-texi2html.init
@@ -63,8 +63,34 @@
### non-standard chars replaced by _xxxx (ascii char code) and forced to
### start with a letter by prepending t_g if necessary)
+package main;
+## FIXME: cut&paste alert: how to just copy/save old function?
+# like python: save_func = func ?
+# $t2h_default_normalise_node = \&normalise_node;
+# perlsub says: sub t2h_default_normalise_node : normalise_node;
+# sub t2h_default_normalise_node : normalise_node;
+# sub t2h_default_normalise_node : main::normalise_node;
+# but this barfs.
+
+sub t2h_default_normalise_node($)
+{
+ return undef unless (defined ($_[0]));
+ my $text = shift;
+ $text = normalise_space($text);
+ $text =~ s/^top$/Top/i;
+ return $text;
+}
+
+sub normalise_node($)
+{
+ 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);
@@ -702,7 +728,18 @@ sub load_map_file ($)
chomp($line);
my @entries = split(/\t/, $line);
if (scalar (@entries) == 3) {
- $node_map->{$entries[0]} = [$entries[1], $entries[2]];
+ $node_map->{$entries[0]} = [$entries[1], $entries[2]];
+ my $entry2 = $entries[2];
+ # FIXME: fixup for entries with spaces
+ # such as `Old downloads'
+ # Should a fourth column be added that would read `Old downloads'?
+ # Handleidingen Manuals Manuals
+ # Oude downloads Old-downloads Old-downloads
+ $entry2 =~ s/-/ /g;
+ if ("$entries[0]" ne "$entry2") {
+ our %translated_to_english_map;
+ $translated_to_english_map->{$entry2} = [$entries[1], $entries[0]];
+ }
$, = " ";
# print STDERR @entries;
# print STDERR "\n";
@@ -785,6 +822,7 @@ sub lilypond_css_lines ($$)
my $lastfilename;
my $docnr = 0;
my $node_to_filename_map = ();
+$translated_to_english_map = ();
# This function makes sure that files are only generated for numbered sections,
@@ -874,6 +912,18 @@ sub lilypond_element_file_name($$$)
return;
}
+sub lilypond_normalise_node($)
+{
+ my $text = shift;
+ my $norm = main::t2h_default_normalise_node($text);
+ if (exists ($translated_to_english_map->{$text})) {
+ (my $filename, $target) = @{$translated_to_english_map->{$text}};
+ $norm = main::t2h_default_normalise_node($target);
+ }
+
+ return $norm;
+}
+
sub lilypond_element_target_name($$$)
{
my $element = shift;
--
1.7.0
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel