Skip to contents

Classes

R6 Classes that parse and manipulate Lesson content based on the {tinkr} yarn class. All of the public-facing operations take place through the methods in these classes.

Lesson
Class to contain a single Lesson by the Carpentries
Episode
Class representing XML source of a Carpentries episode

Validation Reference

Reference documentation for validation procedures

Helper functions

Miscellaneous functions that make working in Pegboard a little easier.

get_lesson()
Get a carpentries lesson in XML format
lesson_fragment()
Example Lesson Fragments
make_heading_table()
Create a table for headings
make_link_table()
Create a table of parsed URLs from a single Episode object.
make_div_table()
Create a table of divs in an episode

[Internal] functions for Episode methods

Functions in this category serve as internal functions that the corresponding methods in the Episode class.

get_challenges()
Gather challenges from the XML body of a carpentries lesson
get_solutions()
Gather solutions from the XML body of a carpentries lesson
isolate_elements()
Isolate elements in an XML document by source position

[Internal] Div Utilities

These functions help parse, clean, and label divs (both pandoc fenced divs and HTML divs) in the document for parsing.

get_divs()
Get paired div blocks
find_between_tags()
Find nodes between two nodes with a given dtag
label_div_tags() find_div_tags() clear_div_labels()
Add labels to div tags in the form of a "dtag" node with a paired "label" attribute.
make_div_pairs()
Create a data frame describing the divs associated with nodes.
find_div_pairs()
Make paired labels for opening and closing div tags
clean_div_tags()
Clean the div tags from an xml document
clean_fenced_divs()
Clean pandoc fenced divs and place them in their own paragraph elements
trim_fence()
Trim div fences from output

[Internal] Kramdown Parsers, Accessors, and Translators

Styles-era Carpentries lessons used kramdown syntax, which has a very different set of features (such as postfix tags and liquid templating) that require extra post-processing. These functions processed this syntax and offerd ways of translating it to the more common pandoc syntax. (Note, this is a non-exhaustive list).

fix_links() find_broken_links() fix_broken_links() make_link_patterns() get_link_fragment_nodes() fix_broken_link() links_within_text_regex() text_to_links() make_link() find_between_nodes()
Find and fix unresolved template links within an Episode XML body
fix_sandpaper_links()
Fix relative and jekyll links to be compatible with sandpaper
fix_liquid_relative_link()
Remove spaces in relative links with liquid variables
make_pandoc_alt()
Add alt text to images when transforming from jekyll to sandpaper
set_alt_attr()
Set the alt text for a nodeset of images
get_blocks()
Gather blocks from the XML body of a carpentries lesson
get_code()
Get code blocks from xml document
liquid_to_commonmark()
Convert liquid code blocks to commonmark code blocks
elevate_children()
elevate all children of a node
kramdown_tags()
Find all kramdown tags within the document
set_ktag_block()
add the kramdown tags as attributes of special blocks
are_blocks()
test if the children of a given nodeset are kramdown blocks