Ticket #492: htmlhelp.patch
File htmlhelp.patch, 8.0 KB (added by bsdz, 13 years ago) |
---|
-
lib/Parrot/Docs/Group.pm
244 244 return $toc; 245 245 } 246 246 247 248 249 sub build_index_chm { 250 my $self = shift; 251 my $source = shift; 252 253 eval 'require Pod::PseudoPod::Index'; 254 return '' if $@; 255 256 sub Pod::PseudoPod::Index::ourkeys { 257 my $self = shift; 258 $self->scan($self->{'index'}); 259 return $self->{'ourkeys'}; 260 } 261 262 sub Pod::PseudoPod::Index::scan { 263 my ($self,$node) = @_; 264 foreach my $key (sort {lc($a) cmp lc($b)} keys %{$node}) { 265 next if $key eq 'page'; 266 push @{$self->{'ourkeys'}}, $key; 267 $self->scan($node->{$key}); 268 } 269 } 270 271 272 foreach my $content ( @{ $self->{CONTENTS} } ) { 273 my @to_process; 274 if ( ref $content && $content->isa( 'Parrot::Docs::Group' ) ) { 275 $content->build_index_chm( $source ); 276 } 277 elsif ( ref $content ) { 278 push @to_process, @{ $content->{CONTENTS} }; 279 } 280 else { 281 push @to_process, $content; 282 } 283 284 foreach my $item ( @to_process ) { 285 my @rel_paths = $self->file_paths_relative_to_source( $source, $item ); 286 foreach my $rel_path (@rel_paths) { 287 my $file = $source->file_with_relative_path( $rel_path ); 288 289 next if ( !$file->contains_pod && !$file->is_docs_link ); 290 my $title = $file->title || $rel_path; 291 292 my $index_parser = Pod::PseudoPod::Index->new(); 293 $index_parser->parse_file($file->{'PATH'}); 294 my $ourkeys = $index_parser->ourkeys(); 295 296 foreach my $k (@{$ourkeys}) { 297 push @{$source->{'_INDEX'}{$k}}, $rel_path; 298 } 299 } 300 } 301 } 302 } 303 247 304 =back 248 305 249 306 =head1 SEE ALSO -
lib/Parrot/Docs/Section/Parrot.pm
94 94 Parrot::Docs::Section::Tools->new, 95 95 $self->new_item( 'Syntax Highlighting for Vim & Emacs', 'editor/README.pod'), 96 96 ), 97 $self->new_group( 98 'Book', 99 '', 100 $self->new_item( 'Chapter 1 Overview', 'docs/book/ch01_overview.pod'), 101 $self->new_item( 'Chapter 2 Getting Started', 'docs/book/ch02_getting_started.pod'), 102 $self->new_item( 'Chapter 3 PIR Basics', 'docs/book/ch03_pir_basics.pod'), 103 $self->new_item( 'Chapter 4 PIR Subroutines', 'docs/book/ch04_pir_subroutines.pod'), 104 $self->new_item( 'Chapter 5 PASM', 'docs/book/ch05_pasm.pod'), 105 $self->new_item( 'Chapter 6 Library', 'docs/book/ch06_library.pod'), 106 $self->new_item( 'Chapter 7 Testing & Debugging', 'docs/book/ch07_testing_and_debugging.pod'), 107 $self->new_item( 'Chapter 8 Architecture', 'docs/book/ch08_architecture.pod'), 108 $self->new_item( 'Chapter 9 PCT', 'docs/book/ch09_pct.pod'), 109 $self->new_item( 'Chapter 10 HLL', 'docs/book/ch10_hlls.pod'), 110 $self->new_item( 'Chapter 11 PMCs', 'docs/book/ch11_pmcs.pod'), 111 $self->new_item( 'Chapter 12 Opcodes', 'docs/book/ch12_opcodes.pod'), 112 $self->new_item( 'Chapter 13 Reference', 'docs/book/ch13_reference.pod'), 113 $self->new_item( 'Appendix 1 Patch Submission', 'docs/book/appX_patch_submission.pod'), 114 ), 97 115 98 116 # Parrot::Docs::Section::C->new, 99 117 # Parrot::Docs::Section::IMCC->new, -
tools/docs/mk_chm.pl
44 44 my $dist = Parrot::Distribution->new; 45 45 my $toc = $docs->build_toc_chm( $dist ); 46 46 47 $docs->build_index_chm( $dist ); 48 my $index; 49 for my $key (%{$dist->{_INDEX}}) { 50 next if ! defined $dist->{_INDEX}{$key}; 51 next if $key =~ /^\s*$/; 52 $index .= qq{<LI> <OBJECT type="text/sitemap">\n}; 53 $index .= qq{<param name="Keyword" value="$key">\n}; 54 foreach my $ref (@{$dist->{_INDEX}{$key}}) { 55 (my $shortkey = $key) =~ s/( opcode \(PASM\)| directive| \(.*\)| \(.*\) instruction (PIR))//; 56 $index .= qq{<param name="Local" value="$ref.html#$shortkey">\n}; 57 } 58 $index .= qq{</OBJECT>\n}; 59 } 60 47 61 my $filename = 'docs/html/parrot.hhp'; 48 62 open my $OUT, '>', $filename 49 63 or die "Can't open $filename ($!)"; … … 72 86 $filename = 'docs/html/index.hhk'; 73 87 open $OUT, '>', $filename 74 88 or die "Can't open $filename ($!)"; 75 print $OUT <<'TEXT'; 76 <HTML> 77 <HEAD> 78 </HEAD> 79 <BODY> 80 <UL> 81 </UL> 82 </BODY> 83 </HTML> 84 TEXT 89 print $OUT $index; 85 90 close $OUT; 86 91 87 92 $filename = 'docs/html/toc.hhc'; … … 93 98 <meta name="generator" content="(Perl $])"> 94 99 </HEAD> 95 100 <BODY> 96 <OBJECT type="text/site properties"> 97 <param name="ImageType" value="Folder"> 98 </OBJECT> 99 <UL> 100 $toc 101 <LI> <OBJECT type="text/sitemap"> 102 <param name="Name" value="Book"> 103 </OBJECT> 104 <UL> 105 <LI> <OBJECT type="text/sitemap"> 106 <param name="Name" value="Overview"> 107 <param name="Local" value="../book/ch01_overview.html"> 108 </OBJECT> 109 <LI> <OBJECT type="text/sitemap"> 110 <param name="Name" value="Getting Started"> 111 <param name="Local" value="../book/ch02_getting_started.html"> 112 </OBJECT> 113 <LI> <OBJECT type="text/sitemap"> 114 <param name="Name" value="PIR Basics"> 115 <param name="Local" value="../book/ch03_pir_basics.html"> 116 </OBJECT> 117 <LI> <OBJECT type="text/sitemap"> 118 <param name="Name" value="PIR Subroutines"> 119 <param name="Local" value="../book/ch04_pir_subroutines.html"> 120 </OBJECT> 121 <LI> <OBJECT type="text/sitemap"> 122 <param name="Name" value="PASM"> 123 <param name="Local" value="../book/ch05_pasm.html"> 124 </OBJECT> 125 <LI> <OBJECT type="text/sitemap"> 126 <param name="Name" value="Library"> 127 <param name="Local" value="../book/ch06_library.html"> 128 </OBJECT> 129 <LI> <OBJECT type="text/sitemap"> 130 <param name="Name" value="Testing and Debugging"> 131 <param name="Local" value="../book/ch07_testing_and_debugging.html"> 132 </OBJECT> 133 <LI> <OBJECT type="text/sitemap"> 134 <param name="Name" value="Architecture"> 135 <param name="Local" value="../book/ch08_architecture.html"> 136 </OBJECT> 137 <LI> <OBJECT type="text/sitemap"> 138 <param name="Name" value="Parrot Compiler Toolkit"> 139 <param name="Local" value="../book/ch09_pct.html"> 140 </OBJECT> 141 <LI> <OBJECT type="text/sitemap"> 142 <param name="Name" value="High Level Languages"> 143 <param name="Local" value="../book/ch10_hlls.html"> 144 </OBJECT> 145 <LI> <OBJECT type="text/sitemap"> 146 <param name="Name" value="PMC"> 147 <param name="Local" value="../book/ch11_pmcs.html"> 148 </OBJECT> 149 <LI> <OBJECT type="text/sitemap"> 150 <param name="Name" value="Opcodes"> 151 <param name="Local" value="../book/ch12_opcodes.html"> 152 </OBJECT> 153 <LI> <OBJECT type="text/sitemap"> 154 <param name="Name" value="References"> 155 <param name="Local" value="../book/ch13_reference.html"> 156 </OBJECT> 157 <LI> <OBJECT type="text/sitemap"> 158 <param name="Name" value="Appendix : Patch Submission"> 159 <param name="Local" value="../book/appX_patch_submission.html"> 160 </OBJECT> 161 </UL> 162 </UL> 101 $toc 163 102 </BODY> 164 103 </HTML> 165 104 TEXT