sitemap: support for draft, levels and templates
[treecutter.git] / treecutter / sitemap.py
index 34fb328a476bca305d5d1937e5194bba7f441799..347440b777eb8418158ed90d21ceaa0ac139b4fd 100644 (file)
@@ -12,7 +12,8 @@ from time import time
 from treecutter import constants as const
 from treecutter.trie import Trie
 from treecutter.link import Link
-from treecutter.tools import ssh_cmd, publish, mkdir_p
+from treecutter.tools import ssh_cmd, publish, mkdir_p,get_folder_size,sizeof_fmt
+
 
 class Sitemap():
     """Class keeping the internal site structure"""
@@ -56,11 +57,13 @@ class Sitemap():
     def set(self):
         return set(link.link() for link in self._tree)
 
+    def linklist(self):
+        return [link.link() for link in self._tree]
+
     # Main driver in the application processing the documents
     # in the collected sitemap
     def process(self):
         t1 = time()
-        print "Prepareing the input"
         for link in self._tree:
             link.prepare()
         t2 = time()
@@ -73,8 +76,10 @@ class Sitemap():
                                                            languages=[tran])
         t3 = time()
         print "Language [%5.2f s]" % (round(t3-t2,2))
+        transform = {}
+        transform['xhtml5'] = etree.XSLT(etree.parse(self._style+"docbook.xhtml5.xsl"))
         for link in self._tree:
-            link.render(self._style)
+            link.render(transform)
         t4 = time()
         print "Render   [%5.2f s]" % (round(t4-t3,2))
         for link in self._tree:
@@ -126,6 +131,7 @@ class Sitemap():
         return etree.tostring(menu,encoding='UTF-8',pretty_print=False)
 
     def publish(self):
+        print "Size [ %7s ]" % (sizeof_fmt(get_folder_size(self._tmptarget)))
         ssh_cmd(self._output,"mkdir -p")
         publish(self._tmptarget, self._output)
         for res in ["stylesheets","images","js","fonts","favicon.ico"]: