5 from treecutter.directory import Directory
6 from treecutter.sitemap import Sitemap
10 parser = argparse.ArgumentParser(description='Process docbook article tree.')
11 parser.add_argument('--style', nargs='?',
12 default=os.path.dirname(os.getcwd())+'/style/default/')
13 parser.add_argument('--output', nargs='?',
14 default=os.path.dirname(os.getcwd())+'/htdocs/')
15 args = parser.parse_args()
21 # Scanning current directory and subdirectory for docbook articles
23 # Reading the sitemap.txt building a Trie structure
26 # Comparing the current state of the dir with the sitemap
27 missing = dir_.set() - sitemap.set()
28 removed = sitemap.set() - dir_.set()
30 print page+' pages missing!!'
32 print 'adding missing page '+page
33 sitemap.add_link(page)
34 if len(missing)+len(removed) != 0:
35 print 'writing new sitemap - please adjust if needed'
38 # Generate a pygraphviz image of the site (TODO: currently not used)
40 # Start processing the docbook articles to static html
41 sitemap.process(args.style)
43 # Publish static html and style data (css, images, fonts) to destination dir
45 sitemap.publish(args.output,args.style)
47 print "Publish [%5.2f s]" % (round(t2-t1,2))
48 print "Total [%5.2f s]" % (round(t2-ts,2))
51 if __name__ == "__main__":