[l2h] help files (.hhp .hhc .hhk)

Oscar Germán Duarte Velasco ogduartev at unal.edu.co
Thu Apr 29 14:43:12 CEST 2004


I need to create help files and I want to use latex/latex2html to do
that. I have found a previous message in this list
(http://tug.org/mailman/htdig/latex2html/2002-August/002008.html)
concerning with this topic, but no further references, so I have tried
to do it by myself, and I want to share with you the results.

The problem is to create 3 files (.hhp .hhc .hhk) whose format are
explained at:
http://www.wxwindows.org/manuals/2.4.2/wx499.htm#helpformat

In the message of August-2002 Ross Moore suggested a postproccesing of
the contents.pl or labels.pl files... I have tried a different
approach... I have used the latex2html-init file and the
custom_title_hook subroutine.

I do not know in depth the latex/latex2html code, and I have not written
any previous perl subroutine... so I am sure you can do a better job...
My init file is bellow. You will find some weak points:

1) The directory and file names managment
2) I must to add manually a "</UL>" line at the end of the .hhc and .hhk
files
3) No Anchors are proccessed, just file names

I hope this wil be useful for anybody... at least it has been useful for
me...

Oscar Duarte
Universidad Nacional de Colombia
http://www.ing.unal.edu.co/~ogduarte


=========================================

$CUSTOM_TITLES=1;
$NO_NAVIGATION=1;
$SHOW_SECTION_NUMBERS=0;
$REUSE=1;
$MAX_SPLIT_DEPTH=8;
$INFO=0;

open (HHP,">./help.hhp");
print HHP "Contents file=help.hhc\n";
print HHP "Index file=help.hhk\n";
print HHP "Title=The title\n";
print HHP "Default topic=node1.html\n";
close (HHP);

open (HHC,">/home/ogduarte/Documents/help.hhc");
close (HHC);
open (HHK,">/home/ogduarte/Documents/help.hhk");
print HHK "<UL>\n";
close (HHK);

$NodeCounter=0;
$PreviousLevel=0;

sub custom_title_hook
{
  open (HHC,">>/home/ogduarte/Documents/help.hhc");
  open (HHK,">>/home/ogduarte/Documents/help.hhk");
  $NodeCounter++;
  $return = "node" . $NodeCounter ;

  @tmp = split(/_/,$packed_curr_sec_id);
  $Level=0;
  foreach $i ( @tmp)
  {
    if($i != 0)
    {
      $Level++;
    }
  }
  if($PreviousLevel < $Level)
  {
    print HHC "<UL>\n";
  }
  if($PreviousLevel > $Level)
  {
    print HHC "</UL>\n";
  }
  print HHC "<LI> <object type='text/sitemap'>";
  print HHC "<param name='Name' value='" . $_[0] . "'>\n";
  print HHC "<param name='ID' value=" . $contadorNodos . ">\n";
  print HHC "<param name='Local' value='" . $return . ".html'>\n";
  print HHC "</object>\n";
  print HHK "<LI> <object type='text/sitemap'>";
  print HHK "<param name='Name' value='" . $_[0] . "'>\n";
  print HHK "<param name='Local' value='" . $return . ".html'>\n";
  print HHK "</object>\n";
  close (HHC);
  close (HHK);
  $PreviousLevel=$Level;
  $return;
}

1;






More information about the latex2html mailing list