Skip to content

Commit

Permalink
chore(scripts): update
Browse files Browse the repository at this point in the history
  • Loading branch information
dergigi committed Jul 23, 2023
1 parent 5fd8f45 commit 869f0eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion scripts/spreadsheet_to_resource_mds/update_articles.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
article_archive = row[10].lstrip().rstrip()
article_series = row[11].lstrip().rstrip()
article_seriesnr = row[12].lstrip().rstrip()
article_quote = row[13].lstrip().rstrip()

md_file_path = title_to_file_path(article_title, 'articles')
if md_file_path == "":
Expand All @@ -43,7 +44,7 @@
f"---\n"
f"layout: page-article\n"
f"author: {article_author}\n"
f"title: {article_title}\n"
f"title: \"{article_title}\"\n"
f"link: {article_link}\n"
f"category: {article_category}\n"
f"date: {article_date}\n"
Expand All @@ -55,6 +56,7 @@
f"archive: {article_archive}\n"
f"series: {article_series}\n"
f"seriesnr: {article_seriesnr}\n"
f"quote: \"{article_quote}\"\n"
f"---\n")

with open(md_file_path, 'w') as f:
Expand Down
14 changes: 8 additions & 6 deletions scripts/spreadsheet_to_resource_mds/update_books.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
NO_AUTHOR_LINKS = ""

for row in books.get_all_values():
if row[0] == 'Categories':
if row[0] == 'Category':
continue

resource_categories = row[0].split(',')
resource_type = row[1].lower()
resource_category = row[0].lower()
resource_atf = row[1].lower()
resource_essential = row[2].lower()
resource_title = row[3].title().replace(":", "&#58")
resource_subtitle = row[4].replace(":", "&#58")
Expand All @@ -45,23 +45,25 @@
resource_description = row[18]
resource_goodreads = row[19]

md_file_path = title_to_file_path(resource_title, resource_type)
md_file_path = title_to_file_path(resource_title, "books")
if md_file_path == "":
continue

md_file = (
f"---\n"
f"layout: page-{resource_type}\n"
f"layout: page-books\n"
f"title: {resource_title}\n"
f"subtitle: {resource_subtitle}\n"
f"atf: {resource_atf}\n"
f"essential: {resource_essential}\n"
f"categories: {resource_categories}\n"
f"category: {resource_category}\n"
f"authors: {resource_authors}\n"
f"authors_twitter: {resource_authors_twitter}\n"
f"resource_url: {resource_url}\n"
f"amazon_url: {resource_amazon_url}\n"
f"wikipedia_url: {resource_wikipedia_url}\n"
f"free_url: {resource_free_url}\n"
f"summary_url: {resource_summary}\n"
f"{permalink_line}"
f"rating_order: {resource_rating_order}\n"
f"lesson: {resource_lesson}\n"
Expand Down

0 comments on commit 869f0eb

Please sign in to comment.