#!/usr/bin/python
import os
import fnmatch
-import subprocess
-import amara
-import re
-import tempfile
-import errno
-import time
-import argparse
-import shutil
-import pygraphviz as pgv
-import glob
-import gettext
-import shutil
-from amara import bindery
-from amara.xslt import transform
-from Cheetah.Template import Template
+from lxml import etree
+import treecutter.constants as const
class Directory():
"""Class containing the state of the directory with articles"""
def __init__(self):
- self._cwd = '.'
+ self._cwd = u'.'
self._tree = []
def scan(self):
for filename in filenames:
if fnmatch.fnmatch(filename, '*.xml'):
file_ = os.path.join(dirname,filename)
- doc = bindery.parse(file_, prefixes=PREFIXES)
- title = doc.xml_select(u'/db:article/db:info/db:title')
- menu = doc.xml_select(u'/db:article/db:info/db:titleabbrev')
+ doc = etree.parse(file_)
+ title = doc.xpath(u'/db:article/db:info/db:title',namespaces=const.XPATH)
+ menu = doc.xpath(u'/db:article/db:info/db:titleabbrev',namespaces=const.XPATH)
if title and menu:
base = file_.split('.')[1]
link = base.replace('index','')