From 78059c5ccf362a3fefbf1cec29a43c99912f9048 Mon Sep 17 00:00:00 2001 From: Yixin Huang Date: Fri, 25 Oct 2024 11:49:58 +0200 Subject: [PATCH 1/8] Update: add page organized by date This PR relate to #117 --- docs/_toc.yml | 3 +++ scripts/generate_link_lists.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/docs/_toc.yml b/docs/_toc.yml index 98c09a37..594f8f8c 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -24,6 +24,9 @@ parts: # when adding new chapters here, don't forget to also add them to the scipts/generate_link_lists.py file + - caption: What's New + chapters: +{date_toc} - caption: Appendix chapters: diff --git a/scripts/generate_link_lists.py b/scripts/generate_link_lists.py index e39f5051..d44225cc 100644 --- a/scripts/generate_link_lists.py +++ b/scripts/generate_link_lists.py @@ -1,3 +1,27 @@ +def generate_by_publish_date(content, output_file): + """Generates a markdown file organized by publish date for blog-like content organization.""" + sorted_content = sorted( + content['resources'], + key=lambda x: str(x.get('publication_date', '0000-00-00')), + reverse=True + ) + + with open(output_file, 'w', encoding='utf-8') as file: + file.write("# What's New\n") + for entry in sorted_content: + name = entry.get('name', 'Untitled') + pub_date = entry.get('publication_date', 'No Date') + authors = entry.get('authors', 'Unknown') + description = entry.get('description', 'No description available.') + url = entry.get('url', '') + + file.write(f"## {name} - {pub_date}\n") + file.write(f"*Authors:* {authors}\n") + file.write(f"*Published on:* {pub_date}\n\n") + file.write(f"{description}\n") + file.write(f"\n[Link to content]({url})\n") + file.write("\n---\n") + def main(): """ When called from the terminal, this script goes through our yml files and generates .md files. @@ -63,6 +87,11 @@ def main(): author_toc += " - file: " + filename + "\n" replace_in_file(toc_file, "{author_toc}", author_toc) + # Generate the 'What's New' page with content sorted by publish date + date_toc = " - file: whats_new" + generate_by_publish_date(content, "docs/whats_new.md") + replace_in_file(toc_file, "{date_toc}", date_toc) + # go through all urls and detect duplicates all_urls = collect_all(content, "url") duplicate_found = False From d1e700e69a884c2354221e2e66dd395438805236 Mon Sep 17 00:00:00 2001 From: Yixin Huang Date: Fri, 25 Oct 2024 14:37:06 +0200 Subject: [PATCH 2/8] Based on the bug report to update --- docs/_toc.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/_toc.yml b/docs/_toc.yml index 594f8f8c..beae3c86 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -6,9 +6,9 @@ root: readme parts: - caption: Contributing chapters: - - file: contributing/index - - file: contributing/submit_app - - file: contributing/format + - file: contributing/index + - file: contributing/submit_app + - file: contributing/format - caption: By tag chapters: @@ -22,14 +22,12 @@ parts: chapters: {license_toc} - # when adding new chapters here, don't forget to also add them to the scipts/generate_link_lists.py file - - caption: What's New - chapters: + chapters: {date_toc} - + - caption: Appendix chapters: - - file: statistics/readme - - file: export/readme - - file: imprint + - file: statistics/readme + - file: export/readme + - file: imprint From 2135ec37c37b675f1da23847b96e039b636e9bee Mon Sep 17 00:00:00 2001 From: Yixin Huang Date: Fri, 25 Oct 2024 15:41:03 +0200 Subject: [PATCH 3/8] Update for the comment that was deleted --- docs/_toc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_toc.yml b/docs/_toc.yml index beae3c86..25f7bb76 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -22,6 +22,8 @@ parts: chapters: {license_toc} + # when adding new chapters here, don't forget to also add them to the scipts/generate_link_lists.py file + - caption: What's New chapters: {date_toc} From 3d6c52d1eaddad145e4218fd1d2e8d2769e7338a Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Wed, 30 Oct 2024 12:05:58 +0100 Subject: [PATCH 4/8] wording --- scripts/generate_link_lists.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_link_lists.py b/scripts/generate_link_lists.py index d44225cc..c7f1948c 100644 --- a/scripts/generate_link_lists.py +++ b/scripts/generate_link_lists.py @@ -87,7 +87,7 @@ def main(): author_toc += " - file: " + filename + "\n" replace_in_file(toc_file, "{author_toc}", author_toc) - # Generate the 'What's New' page with content sorted by publish date + # Generate the 'What's New' page with content sorted by publication date date_toc = " - file: whats_new" generate_by_publish_date(content, "docs/whats_new.md") replace_in_file(toc_file, "{date_toc}", date_toc) From d52a869c25a8f80ca31bc3bc31f13146d6950794 Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Wed, 30 Oct 2024 12:06:25 +0100 Subject: [PATCH 5/8] wording --- scripts/generate_link_lists.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_link_lists.py b/scripts/generate_link_lists.py index c7f1948c..889aaac8 100644 --- a/scripts/generate_link_lists.py +++ b/scripts/generate_link_lists.py @@ -89,7 +89,7 @@ def main(): # Generate the 'What's New' page with content sorted by publication date date_toc = " - file: whats_new" - generate_by_publish_date(content, "docs/whats_new.md") + generate_by_publication_date(content, "docs/whats_new.md") replace_in_file(toc_file, "{date_toc}", date_toc) # go through all urls and detect duplicates From f4839704167ce90da4c3da0b4cadd80ccde4816f Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Wed, 30 Oct 2024 12:06:47 +0100 Subject: [PATCH 6/8] wording --- scripts/generate_link_lists.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_link_lists.py b/scripts/generate_link_lists.py index 889aaac8..6f8d4daa 100644 --- a/scripts/generate_link_lists.py +++ b/scripts/generate_link_lists.py @@ -1,4 +1,4 @@ -def generate_by_publish_date(content, output_file): +def generate_by_publication_date(content, output_file): """Generates a markdown file organized by publish date for blog-like content organization.""" sorted_content = sorted( content['resources'], From 32ea6a68c152d9451fe43072b6b3cac8fec4afc4 Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Thu, 7 Nov 2024 15:51:30 +0100 Subject: [PATCH 7/8] simplified code, use same format as in other pages --- docs/_toc.yml | 5 +---- scripts/generate_link_lists.py | 34 +++++++--------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/docs/_toc.yml b/docs/_toc.yml index 25f7bb76..0c6d9ec0 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -4,6 +4,7 @@ format: jb-book root: readme parts: + - file: whats_new.md - caption: Contributing chapters: - file: contributing/index @@ -23,10 +24,6 @@ parts: {license_toc} # when adding new chapters here, don't forget to also add them to the scipts/generate_link_lists.py file - - - caption: What's New - chapters: -{date_toc} - caption: Appendix chapters: diff --git a/scripts/generate_link_lists.py b/scripts/generate_link_lists.py index 6f8d4daa..bdfd73e9 100644 --- a/scripts/generate_link_lists.py +++ b/scripts/generate_link_lists.py @@ -1,27 +1,3 @@ -def generate_by_publication_date(content, output_file): - """Generates a markdown file organized by publish date for blog-like content organization.""" - sorted_content = sorted( - content['resources'], - key=lambda x: str(x.get('publication_date', '0000-00-00')), - reverse=True - ) - - with open(output_file, 'w', encoding='utf-8') as file: - file.write("# What's New\n") - for entry in sorted_content: - name = entry.get('name', 'Untitled') - pub_date = entry.get('publication_date', 'No Date') - authors = entry.get('authors', 'Unknown') - description = entry.get('description', 'No description available.') - url = entry.get('url', '') - - file.write(f"## {name} - {pub_date}\n") - file.write(f"*Authors:* {authors}\n") - file.write(f"*Published on:* {pub_date}\n\n") - file.write(f"{description}\n") - file.write(f"\n[Link to content]({url})\n") - file.write("\n---\n") - def main(): """ When called from the terminal, this script goes through our yml files and generates .md files. @@ -88,9 +64,13 @@ def main(): replace_in_file(toc_file, "{author_toc}", author_toc) # Generate the 'What's New' page with content sorted by publication date - date_toc = " - file: whats_new" - generate_by_publication_date(content, "docs/whats_new.md") - replace_in_file(toc_file, "{date_toc}", date_toc) + sorted_content = sorted( + content['resources'], + key=lambda x: str(x.get('publication_date', '0000-00-00')), + reverse=True + )[:10] + + write_md({f["name"]:f for f in sorted_content}, "Recently added", "docs/whats_new.md") # go through all urls and detect duplicates all_urls = collect_all(content, "url") From ebb04f5b40f1a92dc58645ea887149ee4151ebd7 Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Thu, 7 Nov 2024 15:53:36 +0100 Subject: [PATCH 8/8] fixed toc --- docs/_toc.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/_toc.yml b/docs/_toc.yml index 0c6d9ec0..3baf2521 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -4,12 +4,14 @@ format: jb-book root: readme parts: - - file: whats_new.md + - caption: What's new + chapters: + - file: whats_new.md - caption: Contributing chapters: - - file: contributing/index - - file: contributing/submit_app - - file: contributing/format + - file: contributing/index + - file: contributing/submit_app + - file: contributing/format - caption: By tag chapters: @@ -27,6 +29,6 @@ parts: - caption: Appendix chapters: - - file: statistics/readme - - file: export/readme - - file: imprint + - file: statistics/readme + - file: export/readme + - file: imprint