projects
/
treecutter.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sitemap: support for draft, levels and templates
[treecutter.git]
/
treecutter
/
main.py
diff --git
a/treecutter/main.py
b/treecutter/main.py
index 6d7b7ddcecbd679f4775cebaaa55f54e7a288fce..c685f7d3756951ea9a123c29461a52b49ad8aa06 100644
(file)
--- 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='')
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()
args = parser.parse_args()
ts = time()
+ print "--= Treecutter =--"
dir_ = Directory()
sitemap = Sitemap(args)
# Scanning current directory and subdirectory for docbook articles
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
# 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:
for page in removed:
- print page+' page
s missing!!
'
+ print page+' page
not availible in this config
'
for page in missing:
print 'adding missing page '+page
sitemap.add_link(page)
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()
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)
# Generate a pygraphviz image of the site (TODO: currently not used)
- sitemap.graph()
+
dir
sitemap.graph()
# Start processing the docbook articles to static html
# Start processing the docbook articles to static html
- sitemap.process()
+
dir
sitemap.process()
# Publish static html and style data (css, images, fonts) to destination dir
t1 = time()
# Publish static html and style data (css, images, fonts) to destination dir
t1 = time()
- sitemap.publish()
+
dir
sitemap.publish()
t2 = time()
print "Publish [%5.2f s]" % (round(t2-t1,2))
print "Total [%5.2f s]" % (round(t2-ts,2))
t2 = time()
print "Publish [%5.2f s]" % (round(t2-t1,2))
print "Total [%5.2f s]" % (round(t2-ts,2))