[Boost.Python] Printed documentation available?

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Nov 21 19:42:58 EST 2002


>>>>> "Tom" == Tom Hanks <thanks200 at hotmail.com> writes:

    Tom> I hope the subject says it all.  I'd like a printout of the
    Tom> Boost.Python documentation (found at
    Tom> http://www.boost.org/libs/python/doc/index.html) for my daily
    Tom> train trips.

    Tom> Unfortunately for me the available documentation is not
    Tom> printer-friendly. Instead it is browser-friendly, organised
    Tom> into an html tree 3-4 pages deep.

    Tom> I've googled for a couple of hours but can't find a more
    Tom> suitably formatted document.

    Tom> Can someone recommend a way to get a printable version?

If you have wget and htmldoc handly, it's not too difficult to make a
nice printed version (eg pdf).  It may take 15 or 20 minutes of work
though.  

First cd into a tmp dir and wget the docs:

 wget -rl3 -np http://www.boost.org/libs/python/doc/index.html


Then make a list of *.html files in the proper order, the best way to
do this is to mirror the order they are presented in index.html

cd www.boost.org/libs/python/doc/ and run a python script like:


import re
rgx = re.compile('.*<a href="(.*?)">.*')

for line in file('index.html'):
    m = rgx.match(line)
    if m: print m.group(1)


which prints the links.  Run the script in the tutorial dir but prefix
'tutorial' to the output.  


Take the assembled file names and put them in a python script which
calls htmldoc

from os import system
from string import join
import urllib

chapters=(
    'tutorial/index.html',
    'tutorial/doc/quickstart.html',
    'tutorial/doc/building_hello_world.html',
    'tutorial/doc/exposing_classes.html',
    'tutorial/doc/constructors.html',
    'tutorial/doc/class_data_members.html',
    'tutorial/doc/class_properties.html',
    'tutorial/doc/inheritance.html',
    'tutorial/doc/class_virtual_functions.html',
    'tutorial/doc/class_operators_special_functions.html',
    'tutorial/doc/functions.html',
    'tutorial/doc/call_policies.html',
    'tutorial/doc/default_arguments.html',
    'tutorial/doc/object_interface.html',
    'tutorial/doc/basic_interface.html',
    'tutorial/doc/derived_object_types.html',
    'tutorial/doc/extracting_c___objects.html',
    'tutorial/doc/enums.html',
    'tutorial/doc/iterators.html',
    'tutorial/doc/exception_translation.html',
    'building.html',
    'v2/reference.html',
    'v2/configuration.html',
    'v2/platforms.html',
    'v2/definitions.html',
    'v2/faq.html',
    'v2/progress_reports.html',
    'v2/acknowledgments.html',
)

guideName = 'manual.pdf'
    
command = 'htmldoc --webpage -f %s %s' % (guideName , ' '.join(chapters))

rc=system(command)
if rc==0:
    print "wrote %s" % guideName
else:
    print "failed to create %s" % guideName
        
        
        
This creates a nice, high quality pdf, with images included!

John Hunter





More information about the Python-list mailing list