Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Suggests:
rsconnect (>= 0.4.3),
servr (>= 0.13),
shiny,
svglite,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why svglite is added ?

Missing suggest ? I don't see where it is used in the PR.

Copy link
Author

@ElenaMetori ElenaMetori Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to pass the check, since it's used in inst/examples/index.Rmd, otherwise it doesn't let me make a PR... the "build and deploy book" one

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So missing suggest - thanks !

As this is for rendering this book only (bookdown demo works ok), I looked into it closer. I believe this is due to change in knitr where svglite is called (yihui/knitr@4300e49)

And we are indeed asking for svglite in our gitbook format for this book

bookdown::gitbook:
dev: svglite

So this is really a dependency only for the book. We do plan its installation

lapply(c('DT', 'formatR', 'svglite', 'rticles'), function(pkg) {
if (system.file(package = pkg) == '') install.packages(pkg)
})

but too late compare to knitr option resolution.

So we do need to add it only for our documentation book and not the whole package in there

Config/Needs/book: remotes, webshot

This is what is used for additional deps when building the book

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: local::.
needs: book

So can you move it ?

Thanks

tibble,
testit (>= 0.9),
tufte,
Expand Down
27 changes: 23 additions & 4 deletions R/bs4_book.R
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,35 @@ tweak_navbar <- function(html, toc, active = "", rmd_index = NULL, repo = NULL)
repo$subdir <- paste0(repo$subdir, "/")
}

repo_edit <- paste0(repo$base, "/edit/", repo$branch, "/", repo$subdir, rmd_index[[active]])
repo_view <- paste0(repo$base, "/blob/", repo$branch, "/", repo$subdir, rmd_index[[active]])
if(grepl("dev.azure", repo$base)) {
repo_edit <- paste0(repo$base, "?path=/", rmd_index[[active]])
repo_view <- repo_edit
} else if(grepl("bitbucket", repo$base)){
repo_edit <- paste0(repo$base, "/browse/", rmd_index[[active]])
repo_view <- repo_edit
} else {
repo_edit <- paste0(repo$base, "/edit/", repo$branch, "/", repo$subdir, rmd_index[[active]])
repo_view <- paste0(repo$base, "/blob/", repo$branch, "/", repo$subdir, rmd_index[[active]])
}

} else {
repo_edit <- NULL
repo_view <- NULL
}

if (!is.null(repo$base)) {
icon <- repo$icon %n%
ifelse(grepl("github\\.com", repo$base), "fab fa-github", "fab fa-gitlab")
icon <- repo$icon %n% {
if(grepl("github\\.com", repo$base)) {
"fab fa-github"
} else if (grepl("dev.azure", repo$base)) {
"fab fa-microsoft"
} else if (grepl("dev.azure", repo$base)) {
"fab fa-bitbucket"
} else {
"fab fa-gitlab"
}
}

template_link_icon(html, ".//a[@id='book-repo']", icon)
template_link_icon(html, ".//a[@id='book-source']", icon)
template_link_icon(html, ".//a[@id='book-edit']", icon)
Expand Down
16 changes: 10 additions & 6 deletions man/publish_book.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.