|
|
@ -51,9 +51,9 @@ def div(mime, tag, *values): |
|
|
|
id_name = values[0].split('.')[0].replace(' ', '_') |
|
|
|
|
|
|
|
if 'image' in mime: |
|
|
|
html = '<div class="{}">{}<br><span class="filename">{}</span></div>' |
|
|
|
html = '<div class="{}">{}<span class="filename">{}</span></div>' |
|
|
|
elif 'pdf' in mime: |
|
|
|
html = '<div class="{}">{}<br><class="filename">{}</span></div>' |
|
|
|
html = '<div class="{}">{}<span class="filename">{}</span></div>' |
|
|
|
else: |
|
|
|
html = '<div class="{}">{}</div>' |
|
|
|
|
|
|
@ -114,17 +114,21 @@ def distribusify(args, directory): # noqa |
|
|
|
position = '../' * root.count('/') |
|
|
|
stylesheet = '<link type="text/css" rel="stylesheet" href="{}stylesheet.css" />'.format(position) |
|
|
|
else: |
|
|
|
stylesheet = '<link type="text/css" rel="stylesheet" href="stylesheet.css" />'.format(directory) |
|
|
|
stylesheet = '<link type="text/css" rel="stylesheet" href="stylesheet.css" />' |
|
|
|
|
|
|
|
for name in dirs: |
|
|
|
a = "<a href='{}' class='dir'>{}/</a>".replace('{}', name) |
|
|
|
html.append(div('dir', a, 'folder')) |
|
|
|
html.insert(0, div('dir', a, 'folder')) |
|
|
|
|
|
|
|
with open(os.path.join(root, 'index.html'), 'w') as f: |
|
|
|
if not args.no_template: |
|
|
|
header = html_head(stylesheet) |
|
|
|
f.write(header) |
|
|
|
|
|
|
|
h1 = '<h1 class="foldername">{}</h1>'.format(''.join(root)) |
|
|
|
print('path:', h1) |
|
|
|
html.insert(0, h1) |
|
|
|
|
|
|
|
for line in html: |
|
|
|
f.write(line+'\n') |
|
|
|
|
|
|
|