add unknown char, better output

This commit is contained in:
Guilhem Fauré 2023-05-23 17:50:02 +02:00
parent 0ce795dc08
commit 4d269357de
2 changed files with 10 additions and 6 deletions

View File

@ -265,8 +265,9 @@ iso_to_utf = (
# WARNING unknown broken encoding # WARNING unknown broken encoding
unknown_iso = ( unknown_iso = (
r"
", # unknown 
 r"
",
r"∆", # unknown â^† r"∆",
r"û",
) )

View File

@ -73,9 +73,8 @@ def write_section(index: int, total: int, section: Section) -> str:
# Print the name of the exported section & number of remaining sections # Print the name of the exported section & number of remaining sections
style(f"{index + 1}. ", BO) style(f"{index + 1}. ", BO)
highlight(section.title, *unknown_chars(section.title)) highlight(section.title, *unknown_chars(section.title))
style(f" {total-index-1}", BO, G) style(f" {total-index-1}", BO, G)
style(f" section{s(total-index)}") style(f" section{s(total-index)} left")
print(" left to export")
# Define the sections path (directory) & create directory(ies) if needed # Define the sections path (directory) & create directory(ies) if needed
sectiondir: str = config.output_dir + "/" + section.get_slug() sectiondir: str = config.output_dir + "/" + section.get_slug()
makedirs(sectiondir, exist_ok=True) makedirs(sectiondir, exist_ok=True)
@ -83,6 +82,9 @@ def write_section(index: int, total: int, section: Section) -> str:
sectionpath: str = sectiondir + "/" + section.get_filename() sectionpath: str = sectiondir + "/" + section.get_filename()
with open(sectionpath, "w") as f: with open(sectionpath, "w") as f:
f.write(section.get_content()) f.write(section.get_content())
# Print export location when finished exporting
style(" -> ", BO, G)
print(sectionpath)
# Return the first "limit" articles of section # Return the first "limit" articles of section
return sectiondir return sectiondir
@ -112,7 +114,7 @@ def write_article(index: int, total: int, article: Article, sectiondir: str) ->
with open(articlepath, "w") as f: with open(articlepath, "w") as f:
f.write(article.get_content()) f.write(article.get_content())
# Print export location when finished exporting # Print export location when finished exporting
style(" -> ", BO, G) style(" -> ", BO, B)
print(articlepath) print(articlepath)
return articledir return articledir
@ -222,6 +224,7 @@ if __name__ == "__main__":
# Break line when finished exporting the section # Break line when finished exporting the section
print() print()
print() # Break line
# Loop through each article that contains an unknown character # Loop through each article that contains an unknown character
for article in unknown_chars_articles: for article in unknown_chars_articles:
warn_unknown_chars(article) warn_unknown_chars(article)