X-Git-Url: https://source.tree.se/git?p=treecutter.git;a=blobdiff_plain;f=treecutter%2Fmain.py;fp=treecutter%2Fmain.py;h=c685f7d3756951ea9a123c29461a52b49ad8aa06;hp=6d7b7ddcecbd679f4775cebaaa55f54e7a288fce;hb=86815abce0db2e449bc3b2cbc6790885f73d41d9;hpb=5ee26cbf373af8fe76d549f4f1cba1f240146a2b diff --git a/treecutter/main.py b/treecutter/main.py index 6d7b7dd..c685f7d 100644 --- a/treecutter/main.py +++ b/treecutter/main.py @@ -14,37 +14,48 @@ def main(): default=os.path.dirname(os.getcwd())+'/htdocs/') parser.add_argument('--subdir', nargs='?', default='') + parser.add_argument('--draft', action='store_true') + parser.add_argument('--level', type=int, choices=[1, 2, 3, 4, 5], default=0) + args = parser.parse_args() ts = time() + print "--= Treecutter =--" dir_ = Directory() sitemap = Sitemap(args) # Scanning current directory and subdirectory for docbook articles - dir_.scan() + dir_.scan(args.draft, args.level) # Reading the sitemap.txt building a Trie structure sitemap.read_map() # Comparing the current state of the dir with the sitemap - missing = dir_.set() - sitemap.set() - removed = sitemap.set() - dir_.set() + dirset = dir_.set() + missing = dirset - sitemap.set() + removed = sitemap.set() - dirset for page in removed: - print page+' pages missing!!' + print page+' page not availible in this config' for page in missing: print 'adding missing page '+page sitemap.add_link(page) - if len(missing)+len(removed) != 0: + if len(missing) != 0: print 'writing new sitemap - please adjust if needed' sitemap.write_map() + dirsitemap = Sitemap(args) + for l in sitemap.linklist(): + if l in dirset: + dirsitemap.add_link(l) + + # Generate a pygraphviz image of the site (TODO: currently not used) - sitemap.graph() + dirsitemap.graph() # Start processing the docbook articles to static html - sitemap.process() + dirsitemap.process() # Publish static html and style data (css, images, fonts) to destination dir t1 = time() - sitemap.publish() + dirsitemap.publish() t2 = time() print "Publish [%5.2f s]" % (round(t2-t1,2)) print "Total [%5.2f s]" % (round(t2-ts,2))