@@ -246,7 +246,9 @@ sub insert_index {
246246 else {
247247 $index = ` $prog --columns $columns $datafile ` ;
248248 }
249- s / $mark/ $prefix$index / ;
249+ if (!s / $mark/ $prefix$index / ) {
250+ print " \n Could not locate index mark: $mark " ;
251+ }
250252}
251253
252254sub add_idx {
@@ -309,8 +311,17 @@ sub add_module_idx {
309311# replace both indexes as needed:
310312sub add_idx_hook {
311313 add_idx() if (/ $idx_mark / );
312- add_module_idx() if (/ $idx_module_mark / );
313314 process_python_state();
315+ if ($MODULE_INDEX_FILE ) {
316+ local ($_ );
317+ open (MYFILE, " <$MODULE_INDEX_FILE " );
318+ sysread (MYFILE, $_ , 1024*1024);
319+ close (MYFILE);
320+ add_module_idx();
321+ open (MYFILE," >$MODULE_INDEX_FILE " );
322+ print MYFILE $_ ;
323+ close (MYFILE);
324+ }
314325}
315326
316327
@@ -382,31 +393,35 @@ sub do_cmd_textohtmlindex {
382393 my $heading = make_section_heading($idx_title , ' h2' ) . $idx_mark ;
383394 my ($pre ,$post ) = minimize_open_tags($heading );
384395 anchor_label(' genindex' ,$CURRENT_FILE ,$_ ); # this is added
385- ' <br>\n' . $pre . $_ ;
396+ return " <br>\n " . $pre . $_ ;
386397}
387398
399+ $MODULE_INDEX_FILE = ' ' ;
400+
388401# $idx_module_mark will be replaced with the real index at the end
389402sub do_cmd_textohtmlmoduleindex {
390403 local ($_ ) = @_ ;
391404 $TITLE = $idx_module_title ;
392- anchor_label(" modindex" ,$CURRENT_FILE ,$_ );
393- ' <p>' . make_section_heading($idx_module_title , " h2" )
394- . $idx_module_mark . $_ ;
405+ anchor_label(' modindex' , $CURRENT_FILE , $_ );
406+ $MODULE_INDEX_FILE = " $CURRENT_FILE " ;
407+ $_ = (' <p>' . make_section_heading($idx_module_title , ' h2' )
408+ . $idx_module_mark . $_ );
409+ return $_ ;
395410}
396411
397- # The bibliography and the index should be treated as separate sections
398- # in their own HTML files. The \bibliography{} command acts as a sectioning command
399- # that has the desired effect. But when the bibliography is constructed
400- # manually using the thebibliography environment, or when using the
401- # theindex environment it is not possible to use the normal sectioning
402- # mechanism. This subroutine inserts a \bibliography{} or a dummy
403- # \textohtmlindex command just before the appropriate environments
404- # to force sectioning.
412+ # The bibliography and the index should be treated as separate
413+ # sections in their own HTML files. The \bibliography{} command acts
414+ # as a sectioning command that has the desired effect. But when the
415+ # bibliography is constructed manually using the thebibliography
416+ # environment, or when using the theindex environment it is not
417+ # possible to use the normal sectioning mechanism. This subroutine
418+ # inserts a \bibliography{} or a dummy \textohtmlindex command just
419+ # before the appropriate environments to force sectioning.
405420
406- # XXX This *assumes* that if there are two {theindex} environments, the
407- # first is the module index and the second is the standard index. This
408- # is sufficient for the current Python documentation, but that's about
409- # it.
421+ # XXX This *assumes* that if there are two {theindex} environments,
422+ # the first is the module index and the second is the standard
423+ # index. This is sufficient for the current Python documentation,
424+ # but that's about it.
410425
411426sub add_bbl_and_idx_dummy_commands {
412427 my $id = $global {' max_id' };
@@ -435,10 +450,10 @@ sub add_bbl_and_idx_dummy_commands {
435450 if defined (&lib_add_bbl_and_idx_dummy_commands);
436451}
437452
438- # The bibliographic references, the appendices, the lists of figures and tables
439- # etc. must appear in the contents table at the same level as the outermost
440- # sectioning command. This subroutine finds what is the outermost level and
441- # sets the above to the same level;
453+ # The bibliographic references, the appendices, the lists of figures
454+ # and tables etc. must appear in the contents table at the same level
455+ # as the outermost sectioning command. This subroutine finds what is
456+ # the outermost level and sets the above to the same level;
442457
443458sub set_depth_levels {
444459 # Sets $outermost_level
@@ -476,17 +491,17 @@ sub set_depth_levels {
476491# <pre>...</pre>.
477492#
478493# Note that this *must* be done in the init file, not the python.perl
479- # style support file. The %declarations must be set before initialize()
480- # is called in the main LaTeX2HTML script (which happens before style files
481- # are loaded).
494+ # style support file. The %declarations must be set before
495+ # initialize() is called in the main LaTeX2HTML script (which happens
496+ # before style files are loaded).
482497#
483498%declarations = (' preform' => ' <dl><dd><pre class="verbatim"></pre></dl>' ,
484499 %declarations );
485500
486501
487- # This is added to get rid of the long comment that follows the doctype
488- # declaration; MSIE5 on NT4 SP4 barfs on it and drops the content of the
489- # page.
502+ # This is added to get rid of the long comment that follows the
503+ # doctype declaration; MSIE5 on NT4 SP4 barfs on it and drops the
504+ # content of the page.
490505sub make_head_and_body {
491506 my ($title , $body ) = @_ ;
492507 my $DTDcomment = ' ' ;
0 commit comments