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 parser.add_argument('--subdir', nargs='?',
17 parser.add_argument('--draft', action='store_true')
18 parser.add_argument('--level', type=int, choices=[1, 2, 3, 4, 5], default=0)
20 args = parser.parse_args()
23 print "--= Treecutter =--"
25 sitemap = Sitemap(args)
27 # Scanning current directory and subdirectory for docbook articles
28 dir_.scan(args.draft, args.level)
29 # Reading the sitemap.txt building a Trie structure
32 # Comparing the current state of the dir with the sitemap
34 missing = dirset - sitemap.set()
35 removed = sitemap.set() - dirset
37 print page+' page not availible in this config'
39 print 'adding missing page '+page
40 sitemap.add_link(page)
42 print 'writing new sitemap - please adjust if needed'
45 dirsitemap = Sitemap(args)
46 for l in sitemap.linklist():
48 dirsitemap.add_link(l)
51 # Generate a pygraphviz image of the site (TODO: currently not used)
53 # Start processing the docbook articles to static html
56 # Publish static html and style data (css, images, fonts) to destination dir
60 print "Publish [%5.2f s]" % (round(t2-t1,2))
61 print "Total [%5.2f s]" % (round(t2-ts,2))
64 if __name__ == "__main__":