from amara.xslt import transform
from Cheetah.Template import Template
from pkg_resources import resource_filename, resource_listdir
+from time import time
import treecutter.const as const
from treecutter.tools import mkdir_p
self._menu = unicode(self._doc.article.info.titleabbrev)
dirname = os.path.dirname(self._file)
+ cwd = os.getcwd()
code = self._doc.xml_select(u"//xi:include[@parse='text']")
if code:
for c in code:
if os.path.isfile(script):
exe.append(script)
else:
- print resource_listdir('xinclude', '')
- print resource_filename('xinclude', c.href)
if c.href in resource_listdir('xinclude', ''):
script = resource_filename('xinclude', c.href)
exe.append(script)
exe.append("lang="+alang)
if c.xml_select(u"//xi:include[@xpointer]"):
exe.append("xptr="+c.xpointer)
+ print " executing %15s" % (c.href),
+ ts = time()
+ os.chdir(dirname)
xml = subprocess.Popen(exe,stdout=subprocess.PIPE)
+ os.chdir(cwd)
xmlblock = str(xml.stdout.read())
+ te = time()
+ print " [%5.2f s]" % (round(te-ts,2))
xstr = bindery.parse(xmlblock)
idp = c.xml_index_on_parent
for x in xstr.xml_children: