Index: lib/Parrot/Docs/Group.pm =================================================================== --- lib/Parrot/Docs/Group.pm (revision 37687) +++ lib/Parrot/Docs/Group.pm (working copy) @@ -244,6 +244,63 @@ return $toc; } + + +sub build_index_chm { + my $self = shift; + my $source = shift; + + eval 'require Pod::PseudoPod::Index'; + return '' if $@; + + sub Pod::PseudoPod::Index::ourkeys { + my $self = shift; + $self->scan($self->{'index'}); + return $self->{'ourkeys'}; + } + + sub Pod::PseudoPod::Index::scan { + my ($self,$node) = @_; + foreach my $key (sort {lc($a) cmp lc($b)} keys %{$node}) { + next if $key eq 'page'; + push @{$self->{'ourkeys'}}, $key; + $self->scan($node->{$key}); + } + } + + + foreach my $content ( @{ $self->{CONTENTS} } ) { + my @to_process; + if ( ref $content && $content->isa( 'Parrot::Docs::Group' ) ) { + $content->build_index_chm( $source ); + } + elsif ( ref $content ) { + push @to_process, @{ $content->{CONTENTS} }; + } + else { + push @to_process, $content; + } + + foreach my $item ( @to_process ) { + my @rel_paths = $self->file_paths_relative_to_source( $source, $item ); + foreach my $rel_path (@rel_paths) { + my $file = $source->file_with_relative_path( $rel_path ); + + next if ( !$file->contains_pod && !$file->is_docs_link ); + my $title = $file->title || $rel_path; + + my $index_parser = Pod::PseudoPod::Index->new(); + $index_parser->parse_file($file->{'PATH'}); + my $ourkeys = $index_parser->ourkeys(); + + foreach my $k (@{$ourkeys}) { + push @{$source->{'_INDEX'}{$k}}, $rel_path; + } + } + } + } +} + =back =head1 SEE ALSO Index: lib/Parrot/Docs/Section/Parrot.pm =================================================================== --- lib/Parrot/Docs/Section/Parrot.pm (revision 37687) +++ lib/Parrot/Docs/Section/Parrot.pm (working copy) @@ -94,6 +94,24 @@ Parrot::Docs::Section::Tools->new, $self->new_item( 'Syntax Highlighting for Vim & Emacs', 'editor/README.pod'), ), + $self->new_group( + 'Book', + '', + $self->new_item( 'Chapter 1 Overview', 'docs/book/ch01_overview.pod'), + $self->new_item( 'Chapter 2 Getting Started', 'docs/book/ch02_getting_started.pod'), + $self->new_item( 'Chapter 3 PIR Basics', 'docs/book/ch03_pir_basics.pod'), + $self->new_item( 'Chapter 4 PIR Subroutines', 'docs/book/ch04_pir_subroutines.pod'), + $self->new_item( 'Chapter 5 PASM', 'docs/book/ch05_pasm.pod'), + $self->new_item( 'Chapter 6 Library', 'docs/book/ch06_library.pod'), + $self->new_item( 'Chapter 7 Testing & Debugging', 'docs/book/ch07_testing_and_debugging.pod'), + $self->new_item( 'Chapter 8 Architecture', 'docs/book/ch08_architecture.pod'), + $self->new_item( 'Chapter 9 PCT', 'docs/book/ch09_pct.pod'), + $self->new_item( 'Chapter 10 HLL', 'docs/book/ch10_hlls.pod'), + $self->new_item( 'Chapter 11 PMCs', 'docs/book/ch11_pmcs.pod'), + $self->new_item( 'Chapter 12 Opcodes', 'docs/book/ch12_opcodes.pod'), + $self->new_item( 'Chapter 13 Reference', 'docs/book/ch13_reference.pod'), + $self->new_item( 'Appendix 1 Patch Submission', 'docs/book/appX_patch_submission.pod'), + ), # Parrot::Docs::Section::C->new, # Parrot::Docs::Section::IMCC->new, Index: tools/docs/mk_chm.pl =================================================================== --- tools/docs/mk_chm.pl (revision 37687) +++ tools/docs/mk_chm.pl (working copy) @@ -44,6 +44,20 @@ my $dist = Parrot::Distribution->new; my $toc = $docs->build_toc_chm( $dist ); +$docs->build_index_chm( $dist ); +my $index; +for my $key (%{$dist->{_INDEX}}) { + next if ! defined $dist->{_INDEX}{$key}; + next if $key =~ /^\s*$/; + $index .= qq{
  • \n}; + $index .= qq{\n}; + foreach my $ref (@{$dist->{_INDEX}{$key}}) { + (my $shortkey = $key) =~ s/( opcode \(PASM\)| directive| \(.*\)| \(.*\) instruction (PIR))//; + $index .= qq{\n}; + } + $index .= qq{\n}; +} + my $filename = 'docs/html/parrot.hhp'; open my $OUT, '>', $filename or die "Can't open $filename ($!)"; @@ -72,16 +86,7 @@ $filename = 'docs/html/index.hhk'; open $OUT, '>', $filename or die "Can't open $filename ($!)"; -print $OUT <<'TEXT'; - - - - - - - -TEXT +print $OUT $index; close $OUT; $filename = 'docs/html/toc.hhc'; @@ -93,73 +98,7 @@ - - - - + $toc TEXT