get_displaytext: Retrieve Displayed Text From Nodes

Description Usage Arguments Value See Also Examples

View source: R/display.R

Description

Some wikimarkup elements (wikilinks or text, say) have chunks visible when parsed into HTML by MediaWiki. get_displaytext retrieves the visible element for each node in a list of nodes.

Usage

1
get_displaytext(nodes, as_text = FALSE)

Arguments

nodes

a list of nodes, retrieved with get_nodes.

as_text

whether to return the visible element of each node as text rather than a Wikimarkup object. FALSE by default.

Value

a list of either wikimarkup objects or strings, depending on the value of as_text. For nodes without a certain display element (for example, templates), NA will be returned.

See Also

get_dest to retrieve the link destination in the case of internal or external links.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
library(magrittr)
library(mwparser)
raw_wikitext <- "==this is a header=="

text <- read_wikitext(raw_wikitext) %>%
   get_nodes(types = "headings") %>%
   get_displaytext

text

## End(Not run)

Ironholds/mwparser documentation built on May 3, 2019, 11:48 p.m.