Skip to content
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

Migrate documentation to roxygen2 #61

Merged
merged 98 commits into from
Oct 14, 2024
Merged

Migrate documentation to roxygen2 #61

merged 98 commits into from
Oct 14, 2024

Conversation

MichaelChirico
Copy link
Collaborator

@MichaelChirico MichaelChirico commented Oct 13, 2024

Noting some inconsistencies/gaps for which I couldn't find a workaround, and intentional splits:

\method{is}{integer64}(x)

bit64/NAMESPACE

Lines 371 to 373 in a014e88

#no registration because of signature mismatch
#S3method("is", integer64)
#S3method("as", integer64)

  • {roxygen2} did a great job of catching a case where %in% was not properly escaped and we wound up with unintentionally-commented exposition (note the awkward '):

'match', '%in%', 'duplicated', 'unique', 'table', 'sort', 'order', 'rank',

CRAN-rendered version of the Rd code above, we can tell % was interpreted as the comment character

  • Drop \details{...} section from bit64-package which does not add much and is already way out of date:

\details{
\tabular{ll}{
Package: \tab bit64\cr
Type: \tab Package\cr
Version: \tab 0.5.0\cr
Date: \tab 2011-12-12\cr
License: \tab GPL-2\cr
LazyLoad: \tab yes\cr
Encoding: \tab latin1\cr
}
}

Some code to compare NAMESPACE across branches (normalizing away trivial differences like sort order):

parse_namespace_on_branch = function(branch) {
  system(paste('git checkout', branch))
  wd = getwd()
  parseNamespaceFile(basename(wd), dirname(wd))
}
old = parse_namespace_on_branch("master")
new = parse_namespace_on_branch("roxygen")

normalize_imports = function(imports) {
  df = do.call(rbind, lapply(imports, \(e) data.frame(pkg = e[[1]], calls = e[[2]])))
  df = df[order(df$pkg, df$calls), ]
  row.names(df) = NULL
  df
}

normalize_s3_methods = function(s3) {
  df = data.frame(s3)
  names(df)[1:2] = c("generic", "class")
  df = df[order(df$generic, df$class), ]
  row.names(df) = NULL
  df
}

for (nm in names(new)) {
  normalizer = switch(nm,
    imports = normalize_imports,
    exports = sort,
    S3methods = normalize_s3_methods,
    identity)
  stopifnot(all.equal(normalizer(old[[nm]]), normalizer(new[[nm]])))
}

@MichaelChirico MichaelChirico marked this pull request as ready for review October 14, 2024 06:46
@MichaelChirico MichaelChirico merged commit b6ab4c0 into master Oct 14, 2024
6 checks passed
@MichaelChirico MichaelChirico deleted the roxygen branch October 14, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant