Merge branch 'main' of https://git.dianaband.info/doohoyi/distribusi-foh000 into main
This commit is contained in:
commit
93769a5069
2 changed files with 17 additions and 9 deletions
|
|
@ -26,6 +26,15 @@ ignore = Ignore()
|
||||||
PATTERN_TAG = re.compile(r"(?P<name>.+?)(?P<tags>\#.+)*\.(?P<ext>.{1,4}$)")
|
PATTERN_TAG = re.compile(r"(?P<name>.+?)(?P<tags>\#.+)*\.(?P<ext>.{1,4}$)")
|
||||||
PATTERN_TAG_FOLDER = re.compile(r"(?P<name>.+?)(?P<tags>\#.+)\/(?P<file>.+)")
|
PATTERN_TAG_FOLDER = re.compile(r"(?P<name>.+?)(?P<tags>\#.+)\/(?P<file>.+)")
|
||||||
|
|
||||||
|
def untag(name):
|
||||||
|
m = PATTERN_TAG.search(name)
|
||||||
|
if m:
|
||||||
|
file_name = m.group('name')
|
||||||
|
file_ext = m.group('ext')
|
||||||
|
return (file_name + "." + file_ext)
|
||||||
|
else:
|
||||||
|
return name
|
||||||
|
|
||||||
def caption(image):
|
def caption(image):
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
|
|
@ -78,7 +87,7 @@ def thumbnail(image, name, args):
|
||||||
if args.captions:
|
if args.captions:
|
||||||
cap = caption(image)
|
cap = caption(image)
|
||||||
else:
|
else:
|
||||||
cap = name
|
cap = untag(name)
|
||||||
|
|
||||||
m = PATTERN_TAG_FOLDER.search(cap)
|
m = PATTERN_TAG_FOLDER.search(cap)
|
||||||
if m:
|
if m:
|
||||||
|
|
@ -107,11 +116,7 @@ def div(args, type_, subtype, tag, name, fid):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m = PATTERN_TAG.search(name)
|
name = untag(name)
|
||||||
if m:
|
|
||||||
file_name = m.group('name')
|
|
||||||
file_ext = m.group('ext')
|
|
||||||
name = file_name + "." + file_ext
|
|
||||||
|
|
||||||
if args.no_filenames:
|
if args.no_filenames:
|
||||||
filename = ''
|
filename = ''
|
||||||
|
|
@ -231,7 +236,8 @@ def render_dir(args, directory):
|
||||||
c = caption(relative_path)
|
c = caption(relative_path)
|
||||||
a = FILE_TYPES[type_].format(quote(relative_path), c, c)
|
a = FILE_TYPES[type_].format(quote(relative_path), c, c)
|
||||||
# ALT 처리
|
# ALT 처리
|
||||||
alt_path = full_path + ".alt"
|
src = os.path.splitext(full_path)
|
||||||
|
alt_path = src[0] + ".alt"
|
||||||
if os.path.isfile(alt_path):
|
if os.path.isfile(alt_path):
|
||||||
f = open(alt_path, 'r', encoding='utf-8')
|
f = open(alt_path, 'r', encoding='utf-8')
|
||||||
alt = ''
|
alt = ''
|
||||||
|
|
@ -345,7 +351,8 @@ def distribusify(args, directory, freg): # noqa
|
||||||
c = caption(full_path)
|
c = caption(full_path)
|
||||||
a = FILE_TYPES[type_].format(quote(name), c, c)
|
a = FILE_TYPES[type_].format(quote(name), c, c)
|
||||||
# ALT 처리
|
# ALT 처리
|
||||||
alt_path = full_path + ".alt"
|
src = os.path.splitext(full_path)
|
||||||
|
alt_path = src[0] + ".alt"
|
||||||
if os.path.isfile(alt_path):
|
if os.path.isfile(alt_path):
|
||||||
f = open(alt_path, 'r', encoding='utf-8')
|
f = open(alt_path, 'r', encoding='utf-8')
|
||||||
alt = ''
|
alt = ''
|
||||||
|
|
@ -353,6 +360,7 @@ def distribusify(args, directory, freg): # noqa
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
if not line: break
|
if not line: break
|
||||||
alt = alt + line + ' '
|
alt = alt + line + ' '
|
||||||
|
print("alt: " + alt )
|
||||||
|
|
||||||
a = FILE_TYPES[type_].format(quote(name), alt, c)
|
a = FILE_TYPES[type_].format(quote(name), alt, c)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ participants.html
|
||||||
style.css
|
style.css
|
||||||
404.html
|
404.html
|
||||||
main.js
|
main.js
|
||||||
.+.alt
|
.+\.alt$
|
||||||
events
|
events
|
||||||
여기에_대해_about_here
|
여기에_대해_about_here
|
||||||
어떤_파일을_넣을까
|
어떤_파일을_넣을까
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue