text filename tstring added

This commit is contained in:
Dooho Yi 2021-01-09 18:33:08 +09:00
parent d8d371468b
commit 3cc1b385b8
3 changed files with 26 additions and 4 deletions

View file

@ -146,7 +146,15 @@ def render_dir(args, root):
# what types of text files to expand
a = '<section id="{}">{}</section>'.format(name, open(full_path).read())
elif subtype in CODE_TYPES or name.endswith('.txt'):
a = "<div>" + open(full_path).read() + "</div>"
#check - time string
m = PATTERN_TSTR.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>"
a = a.replace('{}', tstring)
else:
subtype = subtype + ' unkown-file'
a = "<a href='{}'>{}</a>".format(relative_path, caption)
@ -243,7 +251,16 @@ def distribusify(args, directory): # noqa
# what types of text files to expand
a = '<section id="{}">{}</section>'.format(name, open(full_path).read())
elif subtype in CODE_TYPES or name.endswith('.txt'):
a = "<div>" + open(full_path).read() + "</div>"
#check - time string
m = PATTERN_TSTR.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>"
a = a.replace('{}', tstring)
#a = "<div>" + open(full_path).read() + "</div>"
else:
subtype = subtype+' unkown-file'
a = "<a href='{}'>{}</a>"

2
run.sh
View file

@ -1,3 +1,3 @@
#!/bin/bash
python run.py -d ./data/ -nf -s styles/white.css --no-hidden --unfolding
python run.py -d ./data/ -nf -s styles/dark.css --no-hidden --unfolding

View file

@ -48,6 +48,11 @@ div {
margin-bottom: 1em;
}
.plain {
display: flex;
flex-direction: column;
}
.plain div {
white-space: pre-line;
}
@ -153,7 +158,7 @@ a:hover {
}
time {
color: rgba(100, 255, 200, .2);
color: rgba(127, 127, 127, 0.2);
}
audio::-webkit-media-controls-enclosure {