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))