Compare commits

..

No commits in common. "ec20adba405e37ac8568feb3d62721f31c4a98f8" and "410efea672e0ad1413edef216487210a82f4bc35" have entirely different histories.

7 changed files with 17 additions and 67 deletions

View file

@ -94,12 +94,6 @@ def build_argparser():
help="Enable unfolding detecting .unfolding",
action="store_true")
parser.add_argument(
'--latest-first',
help="sort file/folders to be latest object comes earlier",
action="store_true",
)
return parser

View file

@ -12,7 +12,6 @@ import re
MIME_TYPE = magic.Magic(mime=True)
PATTERN_TSTR = re.compile(r"(?P<tstring>(?P<year>\d{4})(?P<month>\d{2})(?P<day>\d{2})T(?P<hour>\d{2})(?P<minute>\d{2})(?P<second>\d{2})(?P<timezone>[+|-]\d{4}))_(?P<name>.+)")
PATTERN_TSTR_TXT = re.compile(r"(?P<tstring>(?P<year>\d{4})(?P<month>\d{2})(?P<day>\d{2})T(?P<hour>\d{2})(?P<minute>\d{2})(?P<second>\d{2})(?P<timezone>[+|-]\d{4}))_(?P<name>.*)\.txt")
def caption(image):
@ -112,13 +111,10 @@ def write_index(args,index, html, html_head, html_footer):
def render_dir(args, root):
reverse = False
if args.latest_first:
reverse = True
html = []
for name in sorted(os.listdir(root),reverse=reverse):
#for name in sorted(os.listdir(root)):
for name in sorted(os.listdir(root),reverse=True):
if args.no_hidden:
if name.startswith('.'):
@ -157,17 +153,13 @@ def render_dir(args, root):
#elif subtype in CODE_TYPES or name.endswith('.txt'):
elif name.endswith('.txt'):
#check - time string
m = PATTERN_TSTR_TXT.search(name)
m = PATTERN_TSTR.search(name)
tstring = ""
rename = name
if m:
tstring = m.group('tstring')
rename = m.group('name')
if rename == "":
a = "<div>"
else:
a = "<div><div class='named'>{}</div>".replace('{}', rename)
a = a + open(full_path).read() + "</div><time datetime={}>{}</time>"
a = "<div>" + open(full_path).read() + "</div><time datetime={}>{}</time>"
a = a.replace('{}', tstring)
else:
subtype = subtype + ' unkown-file'
@ -221,11 +213,6 @@ def render_dir(args, root):
def distribusify(args, directory): # noqa
reverse = False
if args.latest_first:
reverse = True
for root, dirs, files in os.walk(directory):
if args.exclude_directory:
@ -250,7 +237,8 @@ def distribusify(args, directory): # noqa
if args.verbose:
print('Generating directory listing for', root)
for name in sorted(files,reverse=reverse):
#for name in sorted(files):
for name in sorted(files,reverse=True):
if 'index.html' not in name:
full_path = os.path.join(root, name)
@ -276,18 +264,15 @@ def distribusify(args, directory): # noqa
#elif subtype in CODE_TYPES or name.endswith('.txt'):
elif name.endswith('.txt'):
#check - time string
m = PATTERN_TSTR_TXT.search(name)
m = PATTERN_TSTR.search(name)
tstring = ""
rename = name
if m:
tstring = m.group('tstring')
rename = m.group('name')
if rename == "":
a = "<div>"
else:
a = "<div><div class='named'>{}</div>".replace('{}', rename)
a = a + open(full_path).read() + "</div><time datetime={}>{}</time>"
a = "<div>" + open(full_path).read() + "</div><time datetime={}>{}</time>"
a = a.replace('{}', tstring)
#a = "<div>" + open(full_path).read() + "</div>"
else:
subtype = subtype+' unkown-file'
a = "<a href='{}'>{}</a>"
@ -323,7 +308,8 @@ def distribusify(args, directory): # noqa
else:
html.append('<a href="../">../</a>')
for name in sorted(dirs,reverse=reverse):
#for name in dirs:
for name in sorted(dirs,reverse=True):
#check - time string
m = PATTERN_TSTR.search(name)

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
html_head = """
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<!-- Generated with distribusi https://git.vvvvvvaria.org/varia/distribusi -->
<meta name="generator" content="distribusi" />

View file

@ -44,10 +44,6 @@ video {
/* layout */
html {
scrollbar-width: none;
}
div {
margin-bottom: 1em;
}
@ -62,7 +58,7 @@ div {
}
.plain div {
white-space: pre-wrap;
white-space: pre-line;
overflow-wrap: anywhere;
}

View file

@ -44,10 +44,6 @@ video {
/* layout */
html {
scrollbar-width: none;
}
div {
margin-bottom: 1em;
}
@ -62,14 +58,14 @@ div {
}
.plain div {
white-space: pre-wrap;
white-space: pre-line;
overflow-wrap: anywhere;
}
/* .x-c div,
.x-shellscript div,
.x-python div {
white-space: pre-wrap;
white-space: pre-line;
} */
figure {
@ -173,13 +169,6 @@ a:hover {
padding-left: 0;
}
.plain .named {
display: block;
font-weight: 700;
border: unset;
color: rgba(127, 127, 127, 0.5);
}
time {
color: rgba(127, 127, 127, 0.2);
}

View file

@ -6,10 +6,6 @@
max-width: 100%%;
} */
html {
scrollbar-width: none;
}
.pdf object {
width: 640px;
height: 640px;
@ -62,7 +58,7 @@ div {
}
.plain div {
white-space: pre-wrap;
white-space: pre-line;
overflow-wrap: anywhere;
}

View file

@ -44,10 +44,6 @@ video {
/* layout */
html {
scrollbar-width: none;
}
div {
margin-bottom: 1em;
}
@ -62,7 +58,7 @@ div {
}
.plain div {
white-space: pre-wrap;
white-space: pre-line;
overflow-wrap: anywhere;
}
@ -165,13 +161,6 @@ a:hover {
padding-left: 0;
}
.plain .named {
display: block;
font-weight: 700;
border: unset;
color: rgba(37, 176, 118, 0.25);
}
time {
color: rgba(37, 176, 118, .2);
}