isolate_nodes {tinkr}R Documentation

Isolate nodes in a document

Description

Isolate nodes in a document

Usage

isolate_nodes(nodelist, type = "context")

Arguments

nodelist

an object of class xml_nodeset OR xml_node OR a list of either.

type

a string of either "context" (default), "censor", or "list"

Details

isolate_nodes()is the workhorse for the show family of functions. These functions will create a copy of the document with the nodes present in nodelist isolated. It has the following switches for "type":

Value

a list of two elements:

See Also

Other nodeset isolation functions: provision_isolation()

Examples


path <- system.file("extdata", "show-example.md", package = "tinkr")
y <- tinkr::yarn$new(path, sourcepos = TRUE)
y$protect_math()$protect_curly()
items <- xml2::xml_find_all(y$body, ".//md:item", tinkr::md_ns())
tnk <- asNamespace("tinkr")
tnk$isolate_nodes(items, type = "context")
tnk$isolate_nodes(items, type = "censor")
tnk$isolate_nodes(items, type = "list")


[Package tinkr version 0.3.0 Index]