Compare commits
No commits in common. "ec20adba405e37ac8568feb3d62721f31c4a98f8" and "410efea672e0ad1413edef216487210a82f4bc35" have entirely different histories.
ec20adba40
...
410efea672
7 changed files with 17 additions and 67 deletions
|
|
@ -94,12 +94,6 @@ def build_argparser():
|
||||||
help="Enable unfolding detecting .unfolding",
|
help="Enable unfolding detecting .unfolding",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
'--latest-first',
|
|
||||||
help="sort file/folders to be latest object comes earlier",
|
|
||||||
action="store_true",
|
|
||||||
)
|
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import re
|
||||||
|
|
||||||
MIME_TYPE = magic.Magic(mime=True)
|
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 = 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):
|
def caption(image):
|
||||||
|
|
@ -112,13 +111,10 @@ def write_index(args,index, html, html_head, html_footer):
|
||||||
|
|
||||||
|
|
||||||
def render_dir(args, root):
|
def render_dir(args, root):
|
||||||
reverse = False
|
|
||||||
if args.latest_first:
|
|
||||||
reverse = True
|
|
||||||
|
|
||||||
html = []
|
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 args.no_hidden:
|
||||||
if name.startswith('.'):
|
if name.startswith('.'):
|
||||||
|
|
@ -157,17 +153,13 @@ def render_dir(args, root):
|
||||||
#elif subtype in CODE_TYPES or name.endswith('.txt'):
|
#elif subtype in CODE_TYPES or name.endswith('.txt'):
|
||||||
elif name.endswith('.txt'):
|
elif name.endswith('.txt'):
|
||||||
#check - time string
|
#check - time string
|
||||||
m = PATTERN_TSTR_TXT.search(name)
|
m = PATTERN_TSTR.search(name)
|
||||||
tstring = ""
|
tstring = ""
|
||||||
rename = name
|
rename = name
|
||||||
if m:
|
if m:
|
||||||
tstring = m.group('tstring')
|
tstring = m.group('tstring')
|
||||||
rename = m.group('name')
|
rename = m.group('name')
|
||||||
if rename == "":
|
a = "<div>" + open(full_path).read() + "</div><time datetime={}>{}</time>"
|
||||||
a = "<div>"
|
|
||||||
else:
|
|
||||||
a = "<div><div class='named'>{}</div>".replace('{}', rename)
|
|
||||||
a = a + open(full_path).read() + "</div><time datetime={}>{}</time>"
|
|
||||||
a = a.replace('{}', tstring)
|
a = a.replace('{}', tstring)
|
||||||
else:
|
else:
|
||||||
subtype = subtype + ' unkown-file'
|
subtype = subtype + ' unkown-file'
|
||||||
|
|
@ -221,11 +213,6 @@ def render_dir(args, root):
|
||||||
|
|
||||||
|
|
||||||
def distribusify(args, directory): # noqa
|
def distribusify(args, directory): # noqa
|
||||||
|
|
||||||
reverse = False
|
|
||||||
if args.latest_first:
|
|
||||||
reverse = True
|
|
||||||
|
|
||||||
for root, dirs, files in os.walk(directory):
|
for root, dirs, files in os.walk(directory):
|
||||||
|
|
||||||
if args.exclude_directory:
|
if args.exclude_directory:
|
||||||
|
|
@ -250,7 +237,8 @@ def distribusify(args, directory): # noqa
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print('Generating directory listing for', root)
|
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:
|
if 'index.html' not in name:
|
||||||
full_path = os.path.join(root, 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 subtype in CODE_TYPES or name.endswith('.txt'):
|
||||||
elif name.endswith('.txt'):
|
elif name.endswith('.txt'):
|
||||||
#check - time string
|
#check - time string
|
||||||
m = PATTERN_TSTR_TXT.search(name)
|
m = PATTERN_TSTR.search(name)
|
||||||
tstring = ""
|
tstring = ""
|
||||||
rename = name
|
rename = name
|
||||||
if m:
|
if m:
|
||||||
tstring = m.group('tstring')
|
tstring = m.group('tstring')
|
||||||
rename = m.group('name')
|
rename = m.group('name')
|
||||||
if rename == "":
|
a = "<div>" + open(full_path).read() + "</div><time datetime={}>{}</time>"
|
||||||
a = "<div>"
|
|
||||||
else:
|
|
||||||
a = "<div><div class='named'>{}</div>".replace('{}', rename)
|
|
||||||
a = a + open(full_path).read() + "</div><time datetime={}>{}</time>"
|
|
||||||
a = a.replace('{}', tstring)
|
a = a.replace('{}', tstring)
|
||||||
|
#a = "<div>" + open(full_path).read() + "</div>"
|
||||||
else:
|
else:
|
||||||
subtype = subtype+' unkown-file'
|
subtype = subtype+' unkown-file'
|
||||||
a = "<a href='{}'>{}</a>"
|
a = "<a href='{}'>{}</a>"
|
||||||
|
|
@ -323,7 +308,8 @@ def distribusify(args, directory): # noqa
|
||||||
else:
|
else:
|
||||||
html.append('<a href="../">../</a>')
|
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
|
#check - time string
|
||||||
m = PATTERN_TSTR.search(name)
|
m = PATTERN_TSTR.search(name)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
html_head = """
|
html_head = """
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<!-- Generated with distribusi https://git.vvvvvvaria.org/varia/distribusi -->
|
<!-- Generated with distribusi https://git.vvvvvvaria.org/varia/distribusi -->
|
||||||
<meta name="generator" content="distribusi" />
|
<meta name="generator" content="distribusi" />
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,6 @@ video {
|
||||||
|
|
||||||
/* layout */
|
/* layout */
|
||||||
|
|
||||||
html {
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
div {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +58,7 @@ div {
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain div {
|
.plain div {
|
||||||
white-space: pre-wrap;
|
white-space: pre-line;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,6 @@ video {
|
||||||
|
|
||||||
/* layout */
|
/* layout */
|
||||||
|
|
||||||
html {
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
div {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
@ -62,14 +58,14 @@ div {
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain div {
|
.plain div {
|
||||||
white-space: pre-wrap;
|
white-space: pre-line;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .x-c div,
|
/* .x-c div,
|
||||||
.x-shellscript div,
|
.x-shellscript div,
|
||||||
.x-python div {
|
.x-python div {
|
||||||
white-space: pre-wrap;
|
white-space: pre-line;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
|
|
@ -173,13 +169,6 @@ a:hover {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain .named {
|
|
||||||
display: block;
|
|
||||||
font-weight: 700;
|
|
||||||
border: unset;
|
|
||||||
color: rgba(127, 127, 127, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
time {
|
time {
|
||||||
color: rgba(127, 127, 127, 0.2);
|
color: rgba(127, 127, 127, 0.2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@
|
||||||
max-width: 100%%;
|
max-width: 100%%;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
html {
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pdf object {
|
.pdf object {
|
||||||
width: 640px;
|
width: 640px;
|
||||||
height: 640px;
|
height: 640px;
|
||||||
|
|
@ -62,7 +58,7 @@ div {
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain div {
|
.plain div {
|
||||||
white-space: pre-wrap;
|
white-space: pre-line;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,6 @@ video {
|
||||||
|
|
||||||
/* layout */
|
/* layout */
|
||||||
|
|
||||||
html {
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
div {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +58,7 @@ div {
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain div {
|
.plain div {
|
||||||
white-space: pre-wrap;
|
white-space: pre-line;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,13 +161,6 @@ a:hover {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plain .named {
|
|
||||||
display: block;
|
|
||||||
font-weight: 700;
|
|
||||||
border: unset;
|
|
||||||
color: rgba(37, 176, 118, 0.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
time {
|
time {
|
||||||
color: rgba(37, 176, 118, .2);
|
color: rgba(37, 176, 118, .2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue