fix untag for captions & alt

This commit is contained in:
Dooho Yi 2021-09-26 02:08:03 +09:00
parent 890c9be3ab
commit 17572f77a7
2 changed files with 13 additions and 13 deletions

View file

@ -200,13 +200,13 @@ def render_dir(args, directory):
# example: MIME plain/text becomes 'type' plain 'subtype' text # example: MIME plain/text becomes 'type' plain 'subtype' text
type_, subtype = mime.split('/') type_, subtype = mime.split('/')
c = name cap = untag(name)
if args.verbose: if args.verbose:
print('Found file in dir ', name, 'as', mime) print('Found file in dir ', name, 'as', mime)
if type_ in FILE_TYPES: if type_ in FILE_TYPES:
a = FILE_TYPES[type_].format(quote(relative_path), c, c) a = FILE_TYPES[type_].format(quote(relative_path), cap, cap)
# expansion for different kind of text files # expansion for different kind of text files
if type_ == 'text': if type_ == 'text':
@ -227,14 +227,14 @@ def render_dir(args, directory):
# a = FILE_TYPES[type_] # a = FILE_TYPES[type_]
if type_ == 'image': if type_ == 'image':
a = FILE_TYPES[type_].format(quote(relative_path), c, c) a = FILE_TYPES[type_].format(quote(relative_path), cap, cap)
if args.thumbnail: if args.thumbnail:
a = thumbnail(full_path, relative_path, args) a = thumbnail(full_path, relative_path, args)
if args.no_filenames: if args.no_filenames:
c = "" cap = ""
if args.captions: if args.captions:
c = caption(relative_path) cap = untag(caption(relative_path))
a = FILE_TYPES[type_].format(quote(relative_path), c, c) a = FILE_TYPES[type_].format(quote(relative_path), cap, cap)
# ALT 처리 # ALT 처리
src = os.path.splitext(full_path) src = os.path.splitext(full_path)
alt_path = src[0] + ".alt" alt_path = src[0] + ".alt"
@ -246,7 +246,7 @@ def render_dir(args, directory):
if not line: break if not line: break
alt = alt + line + ' ' alt = alt + line + ' '
a = FILE_TYPES[type_].format(quote(relative_path), alt, c) a = FILE_TYPES[type_].format(quote(relative_path), alt, cap)
if subtype in SUB_TYPES: if subtype in SUB_TYPES:
a = SUB_TYPES[subtype] a = SUB_TYPES[subtype]
@ -315,14 +315,14 @@ def distribusify(args, directory, freg): # noqa
# example: MIME plain/text becomes 'type' plain 'subtype' text # example: MIME plain/text becomes 'type' plain 'subtype' text
type_, subtype = mime.split('/') type_, subtype = mime.split('/')
c = name cap = untag(name)
if args.verbose: if args.verbose:
print('Found', name, 'as', mime) print('Found', name, 'as', mime)
if type_ in FILE_TYPES: if type_ in FILE_TYPES:
a = FILE_TYPES[type_].format(quote(name), c, c) a = FILE_TYPES[type_].format(quote(name), cap, cap)
# expansion for different kind of text files # expansion for different kind of text files
if type_ == 'text': if type_ == 'text':
@ -346,10 +346,10 @@ def distribusify(args, directory, freg): # noqa
if args.thumbnail: if args.thumbnail:
a = thumbnail(full_path, name, args) a = thumbnail(full_path, name, args)
if args.no_filenames: if args.no_filenames:
c = "" cap = ""
if args.captions: if args.captions:
c = caption(full_path) cap = untag(caption(full_path))
a = FILE_TYPES[type_].format(quote(name), c, c) a = FILE_TYPES[type_].format(quote(name), cap, cap)
# ALT 처리 # ALT 처리
src = os.path.splitext(full_path) src = os.path.splitext(full_path)
alt_path = src[0] + ".alt" alt_path = src[0] + ".alt"
@ -362,7 +362,7 @@ def distribusify(args, directory, freg): # noqa
alt = alt + line + ' ' alt = alt + line + ' '
print("alt: " + alt ) print("alt: " + alt )
a = FILE_TYPES[type_].format(quote(name), alt, c) a = FILE_TYPES[type_].format(quote(name), alt, cap)
if subtype in SUB_TYPES: if subtype in SUB_TYPES:
a = SUB_TYPES[subtype] a = SUB_TYPES[subtype]

0
new
View file