From 596e5400822242a1076979102fa590054834b68a Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Wed, 7 Jul 2010 22:15:59 +0100 Subject: [PATCH] Made index have long references --- script/gen.pl | 12 +++++++++--- templates/wrapper.xsl | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/script/gen.pl b/script/gen.pl index 1b20793..7bc1309 100755 --- a/script/gen.pl +++ b/script/gen.pl @@ -185,8 +185,12 @@ sub xref_fixup { } my $section_title = $section->findvalue('title'); - $index{$section_id} = - { chapter_id => $chapter_counter, chapter_title => $chapter_title, section_id => $section_counter }; + $index{$section_id} = { + chapter_id => $chapter_counter, + chapter_title => $chapter_title, + section_id => $section_counter, + section_title => $section_title + }; } } ## Build indexes as new chapters @@ -198,7 +202,8 @@ sub xref_fixup { if ( exists $index{$linkend} ) { $xref->setAttribute( 'chapter_id', $index{$linkend}{'chapter_id'} ); $xref->setAttribute( 'chapter_title', $index{$linkend}{'chapter_title'} ); - $xref->setAttribute( 'section_id', $index{$linkend}{'section_id'} ) if $index{$linkend}{'section_id'}; + $xref->setAttribute( 'section_id', $index{$linkend}{'section_id'} ) if ( $index{$linkend}{'section_id'} ); + $xref->setAttribute( 'section_title', $index{$linkend}{'section_title'} ) if ( $index{$linkend}{'section_title'} ); $xref->setAttribute( 'url', sprintf( '%sch%02d.html', $prepend_chapter, $index{$linkend}{'chapter_id'} ) . ( $index{$linkend}{'section_id'} ? '#' . $linkend : '' ) ); @@ -271,6 +276,7 @@ sub build_indexes { if ( $count++ ); my $xrefel = XML::LibXML::Element->new('xref'); $xrefel->setAttribute( linkend => $ref ); + $xrefel->setAttribute( longref => 1 ); $spara->appendChild($xrefel); } } diff --git a/templates/wrapper.xsl b/templates/wrapper.xsl index ba0c634..c816ca2 100644 --- a/templates/wrapper.xsl +++ b/templates/wrapper.xsl @@ -141,10 +141,24 @@ - + + + + + + + + - + + + + + + + + -- 2.30.2