Skip to content

Inconsistent @title and @description line numbers in parsed blocks #1235

@davidrubinger

Description

@davidrubinger

When using the parse functions, the line numbers associated with the @title and @description tags in the parsed blocks don't seem to be relative to the entire text, but relative to the individual block, unlike for other tags (e.g., @param):

text <- "
# Example
# 
#' Title 1
#' 
#' Description 1
#' 
#' @param x description
f1 <- function(x) {x}

#' Title 2
#' 
#' Description 2
#' 
#' @param x description
f2<- function(x) {x}"

roxygen2::parse_text(text)
#> [[1]]
#> <roxy_block> [<text>:9]
#>   $tag
#>     [line:  1] @title 'Title 1' {parsed}
#>     [line:  3] @description 'Description 1' {parsed}
#>     [line:  8] @param 'x description' {parsed}
#>     [????:???] @usage '<generated>' {parsed}
#>     [????:???] @.formals '<generated>' {parsed}
#>     [????:???] @backref '<text>' {parsed}
#>   $call   f1 <- function(x) { ...
#>   $object <function> 
#>     $topic f1
#>     $alias f1
#> 
#> [[2]]
#> <roxy_block> [<text>:16]
#>   $tag
#>     [line:  1] @title 'Title 2' {parsed}
#>     [line:  3] @description 'Description 2' {parsed}
#>     [line: 15] @param 'x description' {parsed}
#>     [????:???] @usage '<generated>' {parsed}
#>     [????:???] @.formals '<generated>' {parsed}
#>     [????:???] @backref '<text>' {parsed}
#>   $call   f2 <- function(x) { ...
#>   $object <function> 
#>     $topic f2
#>     $alias f2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorrd ✍️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions