5 from treecutter.directory import Directory
6 from treecutter.sitemap import Sitemap
7 from treecutter.tools import translate
11 parser = argparse.ArgumentParser(description='Process docbook article tree.')
12 parser.add_argument('--style', nargs='?',
13 default=os.path.dirname(os.getcwd())+'/style/default/')
14 parser.add_argument('--output', nargs='?',
15 default=os.path.dirname(os.getcwd())+'/htdocs/')
16 parser.add_argument('--subdir', nargs='?',
18 parser.add_argument('--draft', action='store_true')
19 parser.add_argument('--level', type=int, choices=[1, 2, 3, 4, 5], default=0)
21 args = parser.parse_args()
24 print "--= Treecutter =--"
27 totrans = dir_.translations(args.style)
28 print "Translate [%d] : [" % (len(totrans)),
32 print "Translate[%5.2f s]" % (round(t2-t1,2))
35 sitemap = Sitemap(args)
37 # Scanning current directory and subdirectory for docbook articles
38 dir_.scan(args.draft, args.level)
39 # Reading the sitemap.txt building a Trie structure
42 # Comparing the current state of the dir with the sitemap
44 missing = dirset - sitemap.set()
45 removed = sitemap.set() - dirset
47 print page+' page not availible in this config'
49 print 'adding missing page '+page
50 sitemap.add_link(page)
52 print 'writing new sitemap - please adjust if needed'
55 dirsitemap = Sitemap(args)
56 for l in sitemap.linklist():
58 dirsitemap.add_link(l)
61 # Generate a pygraphviz image of the site (TODO: currently not used)
63 # Start processing the docbook articles to static html
66 # Publish static html and style data (css, images, fonts) to destination dir
70 print "Publish [%5.2f s]" % (round(t2-t1,2))
71 print "Total [%5.2f s]" % (round(t2-ts,2))
74 if __name__ == "__main__":