- 
                Notifications
    
You must be signed in to change notification settings  - Fork 72
 
Support for @examplesIf roxygen tag #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
          Codecov Report
 @@            Coverage Diff             @@
##           master     #743      +/-   ##
==========================================
+ Coverage   90.53%   90.56%   +0.02%     
==========================================
  Files          47       47              
  Lines        2389     2395       +6     
==========================================
+ Hits         2163     2169       +6     
  Misses        226      226              
 Continue to review full report at Codecov. 
  | 
    
0735db1    to
    18f23e0      
    Compare
  
    | 
           @krlmlr you can try this if you want, should work now. Maybe have a look at the test cases too and tell me if we miss anything...  | 
    
c44667b    to
    0437f21      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the effort! I didn't review all the examples, will file new issues if anything breaks in practice.
        
          
                R/roxygen-examples-add-remove.R
              
                Outdated
          
        
      | text <- gsub("^\\s*@examples\\s*", "", text, perl = TRUE) | ||
| starts_with_blank <- text[1] == "\n" | ||
| c(text[1][!starts_with_blank], text[-1]) | ||
| if (grepl("^If ", text[1])) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches @examples If . Just sayin...
Can you use the regex from https://github.com/r-lib/styler/pull/743/files#diff-73645d1e1e747d5eeb45cbd47ddb2ef64c658ed5c585763efd004a1b08ba61f9R10, perhaps with rematch2 and a grouped match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I didn't ever figure out how to use {rematch2} (and did not bother spending time), maybe I should... For now, I think using the regex you linked should be sufficient.
…needed. Match \t anyways as although it can't be in file input, it can be in text input (and unit tests)
for #742. Ideally we'd add full support for
@examplesIf, this gets us halfway. Not sure the final//s*is necessary.Needs tests.
Here is how the current PR would change benchmark results when merged into master:
Here is how the current PR would change benchmark results when merged into master: