Skip to content

Commit

Permalink
Upgrade to SnakeMD 2.0.0b (#20)
Browse files Browse the repository at this point in the history
* Fixed up requirements file

* Working on migration

* Fixed existing bugs

* Removed the missing programs section

* Incremented version
  • Loading branch information
jrg94 authored Apr 7, 2023
1 parent 1073061 commit 281e65d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SnakeMD==0.12.1
subete~=0.14.0
pytest==6.2.4
pytest-cov==2.12.1
setuptools~=57.0.0
snakemd~=2.0.0b1
subete~=0.14
pytest~=6.2
pytest-cov~=2.12
setuptools~=57.0
45 changes: 23 additions & 22 deletions ronbun/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import ssl

from snakemd import Document, InlineText, MDList, Paragraph
from snakemd import Document, Inline, MDList, Paragraph
from subete import LanguageCollection, Repo, Project


Expand All @@ -23,7 +23,7 @@ def main():
repo = Repo(sample_programs_repo_dir=args[0])
readme_catalog = ReadMeCatalog(repo)
for language, page in readme_catalog.pages.items():
page.output_page(f"{args[0]}/archive/{language[0]}/{language}")
page.dump("README", dir=f"{args[0]}/archive/{language[0]}/{language}")


def _get_args() -> tuple:
Expand All @@ -49,8 +49,8 @@ def _get_args() -> tuple:

def _get_intro_text(language: LanguageCollection) -> Paragraph:
paragraph = Paragraph([f"Welcome to Sample Programs in {language}! "])
text = InlineText("here.", url=language.lang_docs_url())
if text.verify_url():
text = Inline("here.", link=language.lang_docs_url())
if language.has_docs:
paragraph.add(f"To find documentation related to the {language} code in this repo, look ")
paragraph.add(text)
return paragraph
Expand Down Expand Up @@ -127,15 +127,15 @@ def _build_readme(self, language: LanguageCollection) -> None:
:param language: a programming language collection (e.g., Python)
:return: None
"""
page = Document("README")
page = Document()

# Introduction
page.add_header(f"Sample Programs in {language}")
page.add_element(_get_intro_text(language))
page.add_heading(f"Sample Programs in {language}")
page.add_block(_get_intro_text(language))

# Sample Programs Section
program_list = _generate_program_list(language)
page.add_header(_generate_program_list_header(
page.add_heading(_generate_program_list_header(
language.total_programs(),
self.repo.total_approved_projects()),
level=2
Expand All @@ -149,7 +149,7 @@ def _build_readme(self, language: LanguageCollection) -> None:
)

# Completed Programs List
page.add_header("Completed Programs", level=3)
page.add_heading("Completed Programs", level=3)
page.add_paragraph(
f"""
Below, you'll find a list of completed code snippets in {language}. Code snippets preceded by :warning:
Expand All @@ -159,22 +159,23 @@ def _build_readme(self, language: LanguageCollection) -> None:
check out the official Sample Programs projects list.
""".strip()
).insert_link("Sample Programs project list", "https://sampleprograms.io/projects/")
page.add_element(MDList(program_list))
page.add_block(MDList(program_list))

# Missing Programs List
missing_programs_list = _generate_missing_program_list(language, language.missing_programs())
page.add_header("Missing Programs", level=3)
page.add_paragraph(
f"""
The following list contains all of the approved programs that are not currently implemented in {language}.
Click on the name of the project to easily open an issue in GitHub. Alternatively, click requirements
to check out the description of the project.
""".strip()
)
page.add_element(MDList(missing_programs_list))
if language.missing_programs_count() > 0:
missing_programs_list = _generate_missing_program_list(language, language.missing_programs())
page.add_heading("Missing Programs", level=3)
page.add_paragraph(
f"""
The following list contains all of the approved programs that are not currently implemented in {language}.
Click on the name of the project to easily open an issue in GitHub. Alternatively, click requirements
to check out the description of the project.
""".strip()
)
page.add_block(MDList(missing_programs_list))

# Testing
page.add_header("Testing", level=2)
page.add_heading("Testing", level=2)
test_data = language.testinfo()
if not test_data:
page.add_paragraph(
Expand All @@ -195,7 +196,7 @@ def _build_readme(self, language: LanguageCollection) -> None:
glotter = page.add_paragraph("See the Glotter2 project for more information on how to create a testinfo file.")
glotter.insert_link("Glotter2 project", "https://github.com/rzuckerm/glotter2")
page.add_horizontal_rule()
page.add_element(_generate_credit())
page.add_block(_generate_credit())

self.pages[language.pathlike_name()] = page

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="ronbun",
version="0.6.1",
version="0.7.0",
author="The Renegade Coder",
author_email="jeremy.grifski@therenegadecoder.com",
description="The Sample Programs README Automation Tool",
Expand All @@ -14,7 +14,7 @@
url="https://github.com/TheRenegadeCoder/sample-programs-readmes",
packages=setuptools.find_packages(),
install_requires=[
"SnakeMD>=0",
"SnakeMD>=0.15",
"subete>=0.11"
],
entry_points={
Expand Down

0 comments on commit 281e65d

Please sign in to comment.