Return to DK Summary

How does it work?


The HappyList


All the indexes are organised in a tree. As an example, here are some parts of the tree created by the BeBook add-on, on the left.
All the elements of the tree are called HappyLinks. Each HappyLink has a name, a link to an html file, and a few other things I'll describe later.
The first HappyLink of the list has the name of the documentation, and points to its main html file (usually index.html). This link has some children (here 'By Kit', 'By Inheritance', 'Functions Index' and 'Topics Index'), and each child will be interpreted as an index for BeHappy (ie they will be in the popup menu). They also point on the main html file.
The grandchildren (such as the different kits) and their offspring will be put in the lists BeHappy displays under the popup menu.

A HappyLink contains the following informations: These last two elements (html file and label) are represented by an HTMLLabel object.

Parsing an HTML file


You can write your own HTML parsing code, or you can use mine, through the HTMLFile class. Please note that this class was written with the BeBook in mind, and it isn't really adapted to any html documentation.
This class uses three different objects that can be found in an HTML file:

How the Add-on does an update

Here is how an add-on should work to update BeHappy's index:
  1. Find the HTML documentation (the directory and the index file name)
  2. Create a HappyLink object, with the Add-on's name. This will be the head of the tree.
  3. Create HappyLinks objects for each indexes the add-on wants to create (such as the four used by the BeBook)
  4. Create an HTMLFile object to parse the index.html file.
And this can be done to all the html files found:
  1. Tell the HTMLFile what beacons we want it to find.
  2. Call the Search() method to parse the file
  3. Extract the labels and links found in the file, create some HappyLinks with those that seem interesting, and add the to the tree.
  4. Find what extracted links look interesting, create an HTMLFile from them, and parse it again.


Next: The Tools

Return to DK Summary