return_html_comment_text_lines_and_labels: Get labels, comments, and line numbers from HTML comments

View source: R/return_html_comment_text_lines_and_labels.R

return_html_comment_text_lines_and_labelsR Documentation

Get labels, comments, and line numbers from HTML comments

Description

Get labels, comments, and line numbers from HTML comments

Usage

return_html_comment_text_lines_and_labels(lines, label = "")

Arguments

lines

Lines of text that may have comments.

label

Optional regex expression that can be used to limit the comments found by adding each element of the character vector in turn immediately after "<!–" in the regex expression. The resulting logical vectors are OR'd together to combine their results.

Value

List with 'comment_lines', which is an integer vector of line numbers indicating which lines are comments and 'comment_labels', which is a character vector with each comment label.

Examples

return_html_comment_text_lines_and_labels(c("<!-- label1 comments -->", 
                                            "<!-- -->"))
return_html_comment_text_lines_and_labels(c("<!-- label1 comments -->", 
                                            "<!-- label2 comments-->"))
return_html_comment_text_lines_and_labels(c("<!-- label1 comments -->", 
                                            "<!-- label2 comments-->",
                                            "<!-- label3 comments -->"),
                                          label = "label1")
return_html_comment_text_lines_and_labels(c("<!-- label1 first comment -->", 
                                            "<!-- label2 second comment-->",
                                            "<!-- label3 third comment -->"),
                                          label = c("label1", "label3"))


rmsharp/rmsutilityr documentation built on Feb. 13, 2024, 6:01 p.m.