2
2
import logging
3
3
import ssl
4
4
5
- from snakemd import Document , InlineText , MDList , Paragraph
5
+ from snakemd import Document , Inline , MDList , Paragraph
6
6
from subete import LanguageCollection , Repo , Project
7
7
8
8
@@ -23,7 +23,7 @@ def main():
23
23
repo = Repo (sample_programs_repo_dir = args [0 ])
24
24
readme_catalog = ReadMeCatalog (repo )
25
25
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 } " )
27
27
28
28
29
29
def _get_args () -> tuple :
@@ -49,8 +49,8 @@ def _get_args() -> tuple:
49
49
50
50
def _get_intro_text (language : LanguageCollection ) -> Paragraph :
51
51
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 :
54
54
paragraph .add (f"To find documentation related to the { language } code in this repo, look " )
55
55
paragraph .add (text )
56
56
return paragraph
@@ -127,15 +127,15 @@ def _build_readme(self, language: LanguageCollection) -> None:
127
127
:param language: a programming language collection (e.g., Python)
128
128
:return: None
129
129
"""
130
- page = Document ("README" )
130
+ page = Document ()
131
131
132
132
# 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 ))
135
135
136
136
# Sample Programs Section
137
137
program_list = _generate_program_list (language )
138
- page .add_header (_generate_program_list_header (
138
+ page .add_heading (_generate_program_list_header (
139
139
language .total_programs (),
140
140
self .repo .total_approved_projects ()),
141
141
level = 2
@@ -149,7 +149,7 @@ def _build_readme(self, language: LanguageCollection) -> None:
149
149
)
150
150
151
151
# Completed Programs List
152
- page .add_header ("Completed Programs" , level = 3 )
152
+ page .add_heading ("Completed Programs" , level = 3 )
153
153
page .add_paragraph (
154
154
f"""
155
155
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:
159
159
check out the official Sample Programs projects list.
160
160
""" .strip ()
161
161
).insert_link ("Sample Programs project list" , "https://sampleprograms.io/projects/" )
162
- page .add_element (MDList (program_list ))
162
+ page .add_block (MDList (program_list ))
163
163
164
164
# 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 ))
175
176
176
177
# Testing
177
- page .add_header ("Testing" , level = 2 )
178
+ page .add_heading ("Testing" , level = 2 )
178
179
test_data = language .testinfo ()
179
180
if not test_data :
180
181
page .add_paragraph (
@@ -195,7 +196,7 @@ def _build_readme(self, language: LanguageCollection) -> None:
195
196
glotter = page .add_paragraph ("See the Glotter2 project for more information on how to create a testinfo file." )
196
197
glotter .insert_link ("Glotter2 project" , "https://github.com/rzuckerm/glotter2" )
197
198
page .add_horizontal_rule ()
198
- page .add_element (_generate_credit ())
199
+ page .add_block (_generate_credit ())
199
200
200
201
self .pages [language .pathlike_name ()] = page
201
202
0 commit comments