mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 07:19:53 +00:00
Don't add plaintext files to indexes
This commit is contained in:
parent
e7db61e551
commit
89e5a1061a
@ -113,9 +113,9 @@ def main(args):
|
|||||||
|
|
||||||
print(f"{plaintext_files=}")
|
print(f"{plaintext_files=}")
|
||||||
for filename in plaintext_files:
|
for filename in plaintext_files:
|
||||||
|
title = os.path.basename(re.sub(f"^{args.notes.name}", args.output_dir.name, filename))
|
||||||
output_filename = re.sub(f"^{args.notes.name}", args.output_dir.name, filename) + '.html'
|
output_filename = re.sub(f"^{args.notes.name}", args.output_dir.name, filename) + '.html'
|
||||||
os.makedirs(os.path.dirname(output_filename), exist_ok=True)
|
os.makedirs(os.path.dirname(output_filename), exist_ok=True)
|
||||||
title = os.path.basename(output_filename)
|
|
||||||
html = re.sub(r'\$title\$', title, TEXT_ARTICLE_TEMPLATE_HEAD)
|
html = re.sub(r'\$title\$', title, TEXT_ARTICLE_TEMPLATE_HEAD)
|
||||||
html = re.sub(r'\$raw\$', os.path.basename(filename), html)
|
html = re.sub(r'\$raw\$', os.path.basename(filename), html)
|
||||||
with open(filename) as fp:
|
with open(filename) as fp:
|
||||||
@ -158,8 +158,11 @@ def main(args):
|
|||||||
title = soup.find('title').get_text()
|
title = soup.find('title').get_text()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
title = path
|
title = path
|
||||||
else:
|
elif os.path.isdir(fullpath):
|
||||||
title = path
|
title = path
|
||||||
|
else:
|
||||||
|
# don't add plaintext files to index, since they have a html wrapper
|
||||||
|
continue
|
||||||
|
|
||||||
if title.strip() == '':
|
if title.strip() == '':
|
||||||
title = path
|
title = path
|
||||||
|
Loading…
Reference in New Issue
Block a user