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