diff options
Diffstat (limited to 'pycco/utils.py')
-rw-r--r-- | pycco/utils.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pycco/utils.py b/pycco/utils.py index 287f401..82854dc 100644 --- a/pycco/utils.py +++ b/pycco/utils.py @@ -18,18 +18,18 @@ def get_all_files(path, extension): class Source: def __init__(self, name, start): - self.name = name - self.title = os.path.basename(self.name) - self.dirpath = os.path.dirname(self.name) or '.' - self.dirname = os.path.relpath(self.dirpath, start) - self.start = start + self.name = name + self.title = os.path.basename(self.name) + self.dirpath = os.path.dirname(self.name) or '.' + self.dirname = os.path.relpath(self.dirpath, start) + self.start = start def save_path(self): return "docs/%s/%s" % (self.dirname, self.title) def relative_path(self, source): html = lambda x: "%s.html" % os.path.splitext(x)[0] - rel = os.path.relpath(source.dirpath, self.dirpath) + rel = os.path.relpath(source.dirpath, self.dirpath) return "%s/%s" % (rel, html(source.title)) def __cmp__(self, other): @@ -40,16 +40,16 @@ class Source: list_ = [] dict_ = {} id_ = 1 - title = lambda s: {'title': s.title, 'url': self.relative_path(s)} + title = lambda s: {'title': s.title, 'url': self.relative_path(s)} new_dict = lambda s: {'id': id_, 'dirname': s.dirname, 'display': 'none', 'titles': [title(s)]} for source in sources: if source.dirpath != root_: if dict_: list_.append(dict_) - root_ = source.dirpath - dict_ = new_dict(source) - id_ += 1 + root_ = source.dirpath + dict_ = new_dict(source) + id_ += 1 else: dict_['titles'].append(title(source)) |