find_between_tags | R Documentation |
Find nodes between two nodes with a given dtag
find_between_tags(
tag,
body,
ns = "pb",
find = "dtag[@label='{tag}']",
include = FALSE
)
tag |
an integer representing a unique dtag attribute |
body |
an xml document |
ns |
the namespace from the body |
find |
an xpath element to search for (without namespace tag) |
include |
if |
a nodeset between tags that have the dtag attribute matching tag
Other div:
clean_div_tags()
,
find_div_pairs()
,
get_divs()
,
label_div_tags()
,
label_pairs()
,
make_div()
,
make_div_pairs()
,
replace_with_div()
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
# find all the div tags
ns <- pegboard:::get_ns(loop$body)
tags <- xml2::xml_find_all(loop$body, ".//pb:dtag", ns)
tags <- xml2::xml_attr(tags, "label")
tags
# grab the contents of the first div tag
pegboard:::find_between_tags(tags[[1]], loop$body)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.