-
Notifications
You must be signed in to change notification settings - Fork 233
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
HTML5 fixes #1290
Comments
|
To do:
|
check_html5 <- function(path) {
html <- withr::local_tempfile()
tools::Rd2HTML(path, html)
processx::run(
"/opt/homebrew/Cellar/tidy-html5/5.8.0/bin/tidy",
c("-eq", html),
echo = TRUE
)
}
purrr::walk(dir("man", full.names = TRUE, pattern = "\\.Rd$"), check_html5) |
Or using htmltidy package: check_html5 <- function(path) {
html <- withr::local_tempfile()
tools::Rd2HTML(path, html)
opts <- list(
TidyDoctype = "html5",
TidyHtmlOut = TRUE
)
out <- capture.output(
htmltidy::tidy_html(file(html), verbose = TRUE, options = opts)
)
out <- out[grepl("^line ", out)]
if (length(out)) {
cli::cli_abort(c("{.path {path}} is not tidy", out))
}
invisible()
} |
I'm pretty confident that this is now correct. I don't particularly want to add tests using either the command line app (because of the challenges installing it on different platforms) or the package (because of the high dependencies, and ugliness of my wrapper). |
We could also have an "extra" test, that we could run manually, and then that could use a command line tool. |
From Kurt Hornik
the (new) warnings about " attribute "align" not allowed for
HTML5" are typically from roxygen2 doing
This can easily be fixed by changing align='right' to
another group of problems is from putting R code in examples into a
div. One test case is
keras/man/timeseries_dataset_from_array.Rd
which has
which does not work "as intended", as
\preformatted
will add a</p>
toclose the preceding paragraph but after the inserted
<div>
.Afaict, we don't have a way to force closing a paragraph other than
adding an empty line, so changing the generated Rd to
will "work" (and also not add an extra line in the LaTeX version):
could you please change roxygen2 accordingly?
Finally, most warnings are from generating methods lists for R6
classes. E.g., for webmockr/man/Adapter.Rd we get inherited methods
entries like
where the span starts outside the p but is closed inside the p.
I don't see a "simple" fix for this, but the code in rd-r6.R is
so perhaps instead of calling
\href
(which will start the p inside thespan) you could simply
\out
the a hyperlink directly?The text was updated successfully, but these errors were encountered: