X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fdoc%2FContextManual.pl;h=45d00dc80ab5e12279bc6091424d5a5fe442106c;hb=5dd11b748e5409f8376376f51d0a18d111cbcfdc;hp=f3e25cdb20185a153f4bd9ffcaf86c711e13770e;hpb=d8393b13b37b8654f0039ec1dba9a71c02af9411;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/doc/ContextManual.pl b/cinelerra-5.1/doc/ContextManual.pl index f3e25cdb..45d00dc8 100755 --- a/cinelerra-5.1/doc/ContextManual.pl +++ b/cinelerra-5.1/doc/ContextManual.pl @@ -17,7 +17,7 @@ # Several important definitions # ContextManual.pl script API version. Must not be changed ! -$cin_cm_api = 1; +$cin_cm_api = 2; # Web browser executable, can be redefined on user's demand $cin_browser = $ENV{'CIN_BROWSER'}; @@ -34,8 +34,9 @@ $cin_browser = 'firefox' if $cin_browser eq ''; # The node with the manual contents $contents_node = 'Contents.html'; -# The node with the manual index -$index_node = 'Index.html'; +# The node with the actual index if needed will be found after parsing contents +$index_node = ''; +$index = ''; # Several special plugin names necessary to rewrite %rewrite = ( @@ -80,7 +81,6 @@ $cin_dat = '.' if $cin_dat eq ''; # Cinelerra HTML manual must reside here $cin_man = "$cin_dat/doc/CinelerraGG_Manual"; $contents = $cin_man.'/'.$contents_node; -$index = $cin_man.'/'.$index_node; #print "ContextManual: using contents $contents\n"; # Cinelerra user's config directory @@ -134,6 +134,21 @@ if ($help_key eq 'TOC') # Show index on this special request if ($help_key eq 'IDX') { + # Index node will be needed now, find it + if ($index_node eq '') + { + $node = ''; + open CONTENTS, $contents or die "Cannot open $contents: $!"; + while () + { + chomp; + last if ($node) = /^\s*HREF=\"(.+?\.html)\">\s*Index\s*<\/A>(?:<\/B>)?$/; + } + close CONTENTS; + $index_node = $node if $node ne ''; + $index_node = 'Index.html' if $index_node eq ''; + $index = $cin_man.'/'.$index_node; + } system "$cin_browser \"file://$index\" &"; exit 0; } @@ -158,6 +173,21 @@ if ($help_key eq 'TOC') # Show index on this special request if ($help_key eq 'IDX') { + # Index node will be needed now, find it + if ($index_node eq '') + { + $node = ''; + open CONTENTS, $contents or die "Cannot open $contents: $!"; + while () + { + chomp; + last if ($node) = /^\s*HREF=\"(.+?\.html)\">\s*Index\s*<\/A>(?:<\/B>)?$/; + } + close CONTENTS; + $index_node = $node if $node ne ''; + $index_node = 'Index.html' if $index_node eq ''; + $index = $cin_man.'/'.$index_node; + } system "$cin_browser \"file://$index\" &"; exit 0; } @@ -190,6 +220,21 @@ if ($node eq '') } } +# Index node will be needed now, find it +if ($node eq '' && $index_node eq '') +{ + seek CONTENTS, 0, 0; + while () + { + chomp; + last if ($node) = /^\s*HREF=\"(.+?\.html)\">\s*Index\s*<\/A>(?:<\/B>)?$/; + } + $index_node = $node if $node ne ''; + $index_node = 'Index.html' if $index_node eq ''; + $index = $cin_man.'/'.$index_node; + $node = ''; +} + # If not found, search index for the exact key if ($node eq '') {