Skip to contents

Make paired labels for opening and closing div tags

Usage

find_div_pairs(divs, close = div_close_regex())

Arguments

close

the regex for a valid closing tag

nodes

a character vector of div open and close tags

Value

an integer vector with pairs of labels for each opening and closing tag. Note that the labels are produced by doing a cumulative sum of the node depths.

Examples

nodes <- c(
"<div class='1'>", 
  "<div class='2'>" , 
  "</div>", 
  "<div class='2'>", 
    "<div class='3'>", 
    "</div>", 
  "</div>", 
"</div>")
pegboard:::find_div_pairs(nodes)
#> [1] 1 2 2 3 4 4 3 1