get_nodes: Extract Nodes from Wikitext

Description Usage Arguments Examples

Description

get_nodes retrieves nodes of various (user-specified) types from a blob of read-in wikitext. These are returned as a list of node objects, which can be passed on to other functions to retrieve components thereof.

Usage

1
2
get_nodes(wikitext, types = c("comments", "external_links", "headings",
  "html", "tags", "templates", "text", "wikilinks"), recursive = TRUE)

Arguments

wikitext

a chunk of wikitext read in with read_wikitext.

types

which type(s) of node to read in. You can pass in whichever number of supported types you want.

Examples

1
2
3
4
5
6
7
8
## Not run: 
text <- "this [[is|some]] {{wikitext}}"

parsed_text <- read_wikitext(text)

some_nodes <- get_nodes(parsed_text, types = c("wikilinks", "templates"))

## End(Not run)

ropenscilabs/mwparser documentation built on May 29, 2019, 1:20 p.m.