Follow-up to #2950: do not include valgrind.h on Windows
[charm.git] / doc / navmenuGenerator.py
blobcadc55692c2323f538cc2cfc97f8d49d5373f201
1 #!/usr/bin/env python
3 from bs4 import BeautifulSoup
4 import sys
5 import os
7 # Accept filename as user input
8 argc = len( sys.argv )
9 if (argc < 2): raise Exception
10 fileName = sys.argv[1];
12 # Construct a DOM object
13 soup = BeautifulSoup(open(fileName), "lxml")
15 # Get just the table of contents from the index page
16 toc = soup.find("ul","ChildLinks").extract()
18 # Retain only part and chapter titles
19 for sctn in toc.select("li > ul > li > ul"):
20 sctn.extract()
22 # Discard all br tags
23 for b in toc("br"):
24 b.extract()
26 # Setup classes etc
27 toc['class'] = "manual-toc"
29 # Print cleaned up markup to stdout
30 print( toc.prettify(formatter="html") )