openpharma / roxytypes

typed parameter definitions for `roxygen2`
https://openpharma.github.io/roxytypes/
Other
4 stars 1 forks source link

Allow use of default field formatters, even with custom formatting string #13

Closed dgkf closed 1 year ago

dgkf commented 1 year ago

This PR changes some of the internal behaviors to hopefully make it easier to customize.

There is still a default format, but it is functionally much simpler. Instead, each of the fields get their own formatters, which are implemented as methods on as.character. This means that glue::glue() will automatically leverage these formatters when building the documentation.

This mean a format such as ({type})\cr {description} will automatically wrap naked types in backticks and respect quotes the same way the default formatter does.

If one prefers to work with the raw values, they can always use ({unclass(type)}) unclass(description) or provide the formatter as a function.

codecov[bot] commented 1 year ago

Codecov Report

Merging #13 (c349be0) into main (713d79d) will increase coverage by 2.94%. The diff coverage is 78.94%.

:exclamation: Current head c349be0 differs from pull request most recent head 47bb24f. Consider uploading reports for the commit 47bb24f to get more accurate results

@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
+ Coverage   83.00%   85.95%   +2.94%     
==========================================
  Files          11       11              
  Lines         353      363      +10     
==========================================
+ Hits          293      312      +19     
+ Misses         60       51       -9     
Impacted Files Coverage Δ
R/tag_typedreturn.R 0.00% <0.00%> (ø)
R/tag_typed.R 71.42% <75.00%> (+12.60%) :arrow_up:
R/utils.R 91.66% <100.00%> (+21.29%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more