Adapting tree-cutter.py to deal with language codes in the filenames.
[treecutter.git] / src / tree-cutter.py
index 782f58ade4d185e699faab0608ec65d7f15812a0..c15e2c3ca7c960ae2337d94ea7e9cb89ac3047bb 100755 (executable)
@@ -11,7 +11,7 @@ from amara import bindery
 from amara.xslt import transform
 from Cheetah.Template import Template
 
-dist = "."
+dist = os.path.dirname(os.getcwd())
 style = "default"
 style_xslt = dist+"/style/"+style+"/docbook.xsl"
 style_tmpl = dist+"/style/"+style+"/index.html.tmpl"
@@ -56,8 +56,8 @@ def generateSitemap():
 
         if title and menu:
           found = 0
-          base = os.path.splitext(xfile)[0]
-          link = base.translate(None,'.').replace('index','')
+          base = xfile.split('.')[1]
+          link = base.replace('index','')
           level = len(filter(None,re.split(r'(/\w*/)',link)))
           page = dict(title=unicode(doc.article.info.title),
                       menu=unicode(doc.article.info.titleabbrev),
@@ -108,7 +108,8 @@ def xsltConvert(doc):
   tfi = open(infile,'w')
   tfi.write(doc.xml_encode())
   tfi.close()
-  cmd = ["saxon-xslt-xinclude","-o",outfile,infile,style_xslt]
+#  cmd = ["saxon-xslt-xinclude","-o",outfile,infile,style_xslt]
+  cmd = ["xsltproc","--xinclude","--output",outfile,style_xslt,infile]
   retcode = subprocess.call(cmd)
   if retcode:
     print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']'