Skip to content

Commit

Permalink
Fixup regex
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Aug 7, 2024
1 parent 0e72fb5 commit 86cfda0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/outline-criteria.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ define_outline_criteria <- function(.data, print_todo) {
# Make sure everything is second level in revdep/.
n_leading_hash = n_leading_hash + grepl("revdep/", file, fixed = TRUE),
is_second_level_heading_or_more = (is_section_title_source | is_section_title) & n_leading_hash > 1,
is_cross_ref = stringr::str_detect(content, "docs_links?\\(.") & !stringr::str_detect(content, "@param|\\{\\."),
is_cross_ref = stringr::str_detect(content, "docs_(links|add.+)?\\(.") & !stringr::str_detect(content, "@param|\\{\\."),
is_function_def = grepl("<- function(", content, fixed = TRUE) & !stringr::str_starts(content, "\\s*#"),
is_tab_or_plot_title = o_is_tab_plot_title(content) & !is_section_title & !is_function_def,
)
Expand Down
4 changes: 2 additions & 2 deletions R/outline.R
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,14 @@ display_outline_element <- function(.data) {
y <- dplyr::mutate(
x,
has_title_el =
((line == 1 & !is_todo_fixme & !is_test_name & !is_snap_file) |
((line == 1 & !is_todo_fixme & !is_test_name & !is_snap_file & !is_cross_ref) |
(is_doc_title & !is_subtitle & !is_snap_file & !is_second_level_heading_or_more)) & !is_news,
.by = "file"
)
y <- withCallingHandlers(
dplyr::mutate(y,
title_el_line = ifelse(has_title_el, line[
(line == 1 & !is_todo_fixme & !is_test_name & !is_snap_file) |
(line == 1 & !is_todo_fixme & !is_test_name & !is_snap_file & !is_cross_ref) |
(is_doc_title & !is_subtitle & !is_snap_file & !is_second_level_heading_or_more)
][1], # take the first element to avoid problems (may be the reason why problems occur)
NA_integer_
Expand Down

0 comments on commit 86cfda0

Please sign in to comment.