get_challenges: Gather challenges from the XML body of a carpentries lesson

View source: R/get_challenges.R

get_challengesR Documentation

Gather challenges from the XML body of a carpentries lesson

Description

This will search an XML document for a challenge marker and extract all of the block quotes that are ancestral to that marker so that we can extract the challenge blockquotes from the carpentries lessons.

Usage

get_challenges(body, type = c("block", "div", "chunk"))

Arguments

body

the XML body of a carpentries lesson (an xml2 object)

type

the type of element containing the challenges "block" is the default and will search for all of the blockquotes with liquid/kramdown markup, "div" will search for all div tags with class of challenge, and "chunk" will search for all of code chunks with the engine of challenge.

Value

an xml object.

Examples

loop <- Episode$new(file.path(lesson_fragment(), "_episodes", "14-looping-data-sets.md"))
get_challenges(loop$body, "block")
get_challenges(loop$unblock()$body, "div")
loop$reset()
get_challenges(loop$use_dovetail()$unblock()$body, "chunk")

carpentries/pegboard documentation built on Nov. 13, 2024, 8:53 a.m.