22import logging
33import ssl
44
5- from snakemd import Document , InlineText , MDList , Paragraph
5+ from snakemd import Document , Inline , MDList , Paragraph
66from subete import LanguageCollection , Repo , Project
77
88
@@ -23,7 +23,7 @@ def main():
2323 repo = Repo (sample_programs_repo_dir = args [0 ])
2424 readme_catalog = ReadMeCatalog (repo )
2525 for language , page in readme_catalog .pages .items ():
26- page .output_page ( f"{ args [0 ]} /archive/{ language [0 ]} /{ language } " )
26+ page .dump ( "README" , dir = f"{ args [0 ]} /archive/{ language [0 ]} /{ language } " )
2727
2828
2929def _get_args () -> tuple :
@@ -49,8 +49,8 @@ def _get_args() -> tuple:
4949
5050def _get_intro_text (language : LanguageCollection ) -> Paragraph :
5151 paragraph = Paragraph ([f"Welcome to Sample Programs in { language } ! " ])
52- text = InlineText ("here." , url = language .lang_docs_url ())
53- if text . verify_url () :
52+ text = Inline ("here." , link = language .lang_docs_url ())
53+ if language . has_docs :
5454 paragraph .add (f"To find documentation related to the { language } code in this repo, look " )
5555 paragraph .add (text )
5656 return paragraph
@@ -127,15 +127,15 @@ def _build_readme(self, language: LanguageCollection) -> None:
127127 :param language: a programming language collection (e.g., Python)
128128 :return: None
129129 """
130- page = Document ("README" )
130+ page = Document ()
131131
132132 # Introduction
133- page .add_header (f"Sample Programs in { language } " )
134- page .add_element (_get_intro_text (language ))
133+ page .add_heading (f"Sample Programs in { language } " )
134+ page .add_block (_get_intro_text (language ))
135135
136136 # Sample Programs Section
137137 program_list = _generate_program_list (language )
138- page .add_header (_generate_program_list_header (
138+ page .add_heading (_generate_program_list_header (
139139 language .total_programs (),
140140 self .repo .total_approved_projects ()),
141141 level = 2
@@ -149,7 +149,7 @@ def _build_readme(self, language: LanguageCollection) -> None:
149149 )
150150
151151 # Completed Programs List
152- page .add_header ("Completed Programs" , level = 3 )
152+ page .add_heading ("Completed Programs" , level = 3 )
153153 page .add_paragraph (
154154 f"""
155155 Below, you'll find a list of completed code snippets in { language } . Code snippets preceded by :warning:
@@ -159,22 +159,23 @@ def _build_readme(self, language: LanguageCollection) -> None:
159159 check out the official Sample Programs projects list.
160160 """ .strip ()
161161 ).insert_link ("Sample Programs project list" , "https://sampleprograms.io/projects/" )
162- page .add_element (MDList (program_list ))
162+ page .add_block (MDList (program_list ))
163163
164164 # Missing Programs List
165- missing_programs_list = _generate_missing_program_list (language , language .missing_programs ())
166- page .add_header ("Missing Programs" , level = 3 )
167- page .add_paragraph (
168- f"""
169- The following list contains all of the approved programs that are not currently implemented in { language } .
170- Click on the name of the project to easily open an issue in GitHub. Alternatively, click requirements
171- to check out the description of the project.
172- """ .strip ()
173- )
174- page .add_element (MDList (missing_programs_list ))
165+ if language .missing_programs_count () > 0 :
166+ missing_programs_list = _generate_missing_program_list (language , language .missing_programs ())
167+ page .add_heading ("Missing Programs" , level = 3 )
168+ page .add_paragraph (
169+ f"""
170+ The following list contains all of the approved programs that are not currently implemented in { language } .
171+ Click on the name of the project to easily open an issue in GitHub. Alternatively, click requirements
172+ to check out the description of the project.
173+ """ .strip ()
174+ )
175+ page .add_block (MDList (missing_programs_list ))
175176
176177 # Testing
177- page .add_header ("Testing" , level = 2 )
178+ page .add_heading ("Testing" , level = 2 )
178179 test_data = language .testinfo ()
179180 if not test_data :
180181 page .add_paragraph (
@@ -195,7 +196,7 @@ def _build_readme(self, language: LanguageCollection) -> None:
195196 glotter = page .add_paragraph ("See the Glotter2 project for more information on how to create a testinfo file." )
196197 glotter .insert_link ("Glotter2 project" , "https://github.com/rzuckerm/glotter2" )
197198 page .add_horizontal_rule ()
198- page .add_element (_generate_credit ())
199+ page .add_block (_generate_credit ())
199200
200201 self .pages [language .pathlike_name ()] = page
201202
0 commit comments