get_divs: Get paired div blocks

View source: R/div.R

get_divsR Documentation

Get paired div blocks

Description

Get paired div blocks

Usage

get_divs(body, type = NULL, include = FALSE)

Arguments

body

an xml document

type

the type of div to return

Details

The strategy behind this is to :

  1. find all dtag elements, which will necessarily be <html_block> elements containing div tags

  2. grab the first tag of each pair

  3. filter on div tag class (type)

  4. grab all elements between the tags

Value

a list of nodesets

See Also

Other div: clean_div_tags(), find_between_tags(), find_div_pairs(), label_div_tags(), label_pairs(), make_div(), make_div_pairs(), replace_with_div()

Examples

loop <- Episode$new(file.path(lesson_fragment(), "_episodes", "14-looping-data-sets.md"))
loop$body # a full document with block quotes and code blocks, etc
loop$unblock() # removing blockquotes and replacing with div tags
pegboard:::get_divs(loop$body, 'challenge') # all challenge blocks
pegboard:::get_divs(loop$body, 'solution') # all solution blocks

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