Compare commits

...

10 commits

Author SHA1 Message Date
ec20adba40 css bugfix
+ discard '.unfolded' classifier for '.plain .named'
2021-06-29 20:50:51 +09:00
6091e5a988 remove scrollbar @ ff upd. 2021-06-29 19:18:22 +09:00
77018d75e6 revert 'tts korean' + remove 'lang en' 2021-02-05 14:55:58 +09:00
1b3d5bb88b tts korean 2021-02-05 13:56:26 +09:00
90a4f2fbb8 . 2021-01-31 20:32:07 +09:00
86de0ac6b1 Merge branch 'main' of https://git.dianaband.info/doohoyi/expressive-distribusi into main 2021-01-31 20:31:28 +09:00
f5e76c78cb utilize titles of .txt files. 2021-01-31 20:29:52 +09:00
d5de3bd80a . 2021-01-31 20:21:47 +09:00
328f3b2189 utilize titles of .txt files. 2021-01-31 20:20:08 +09:00
ee4c33100a added latest-first option 2021-01-31 19:26:21 +09:00
7 changed files with 67 additions and 17 deletions

View file

@ -94,6 +94,12 @@ 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,6 +12,7 @@ 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):
@ -111,10 +112,13 @@ 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)):
for name in sorted(os.listdir(root),reverse=True):
for name in sorted(os.listdir(root),reverse=reverse):
if args.no_hidden:
if name.startswith('.'):
@ -153,13 +157,17 @@ def render_dir(args, root):
#elif subtype in CODE_TYPES or name.endswith('.txt'):
elif name.endswith('.txt'):
#check - time string
m = PATTERN_TSTR.search(name)
m = PATTERN_TSTR_TXT.search(name)
tstring = ""
rename = name
if m:
tstring = m.group('tstring')
rename = m.group('name')
a = "<div>" + open(full_path).read() + "</div><time datetime={}>{}</time>"
if rename == "":
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)
else:
subtype = subtype + ' unkown-file'
@ -213,6 +221,11 @@ 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:
@ -237,8 +250,7 @@ def distribusify(args, directory): # noqa
if args.verbose:
print('Generating directory listing for', root)
#for name in sorted(files):
for name in sorted(files,reverse=True):
for name in sorted(files,reverse=reverse):
if 'index.html' not in name:
full_path = os.path.join(root, name)
@ -264,15 +276,18 @@ def distribusify(args, directory): # noqa
#elif subtype in CODE_TYPES or name.endswith('.txt'):
elif name.endswith('.txt'):
#check - time string
m = PATTERN_TSTR.search(name)
m = PATTERN_TSTR_TXT.search(name)
tstring = ""
rename = name
if m:
tstring = m.group('tstring')
rename = m.group('name')
a = "<div>" + open(full_path).read() + "</div><time datetime={}>{}</time>"
if rename == "":
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 = "<div>" + open(full_path).read() + "</div>"
else:
subtype = subtype+' unkown-file'
a = "<a href='{}'>{}</a>"
@ -308,8 +323,7 @@ def distribusify(args, directory): # noqa
else:
html.append('<a href="../">../</a>')
#for name in dirs:
for name in sorted(dirs,reverse=True):
for name in sorted(dirs,reverse=reverse):
#check - time string
m = PATTERN_TSTR.search(name)

View file

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

View file

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

View file

@ -44,6 +44,10 @@ video {
/* layout */
html {
scrollbar-width: none;
}
div {
margin-bottom: 1em;
}
@ -58,14 +62,14 @@ div {
}
.plain div {
white-space: pre-line;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
/* .x-c div,
.x-shellscript div,
.x-python div {
white-space: pre-line;
white-space: pre-wrap;
} */
figure {
@ -169,6 +173,13 @@ 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,6 +6,10 @@
max-width: 100%%;
} */
html {
scrollbar-width: none;
}
.pdf object {
width: 640px;
height: 640px;
@ -58,7 +62,7 @@ div {
}
.plain div {
white-space: pre-line;
white-space: pre-wrap;
overflow-wrap: anywhere;
}

View file

@ -44,6 +44,10 @@ video {
/* layout */
html {
scrollbar-width: none;
}
div {
margin-bottom: 1em;
}
@ -58,7 +62,7 @@ div {
}
.plain div {
white-space: pre-line;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
@ -161,6 +165,13 @@ 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);
}