Skip to content

Migrate documentation to roxygen2#61

Merged
MichaelChirico merged 98 commits intomasterfrom
roxygen
Oct 14, 2024
Merged

Migrate documentation to roxygen2#61
MichaelChirico merged 98 commits intomasterfrom
roxygen

Conversation

@MichaelChirico
Copy link
Copy Markdown
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
@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