-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add 404 page for bs4_book and Gitbook #1035
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
bfb5f46
add 404 page for bs4_book
maelle 26929ae
fix
maelle 0db8cbd
Merged upstream/master into maelle-404
cderv 9350609
Add 404 page in splitting chapter process
cderv 4694d91
use explicit name
cderv ae1372f
bs4_book can use bookdown feature now
cderv f4e70f3
Adapt text based on @apreshill feedback
cderv 6947d89
Allow customization using _404.md or providing a 404.html directly
cderv 567953c
Use _404.Rmd or _404.md
cderv 6013211
separate in its own function
cderv 2cba367
build function needs more arguments
cderv 53cdb07
if 404 is set by md or Rmd, add the edit buttons
cderv 93894e7
tweak 404 to remove sidebar
cderv 92c5a72
Do nothing if 404.html exists already
cderv 15e9cb9
Add tests for bs4_book
cderv c79badc
Start using testthat for new functions
cderv d95269e
Add a NEWS bullet
cderv 025ffa8
Merge commit '28b11a489b843959d5b883208971243a6100b332'
cderv 87de9fd
resolve NEWS conflict
cderv 2b0a2e0
Merge branch 'upstream/master'
cderv 183ed78
Merged upstream/master into maelle-404
cderv 74b7c40
trivial cosmetic changes
yihui b252098
I don't think the variables `found` and `p404` can be found in the ne…
yihui a1c208f
use existing_files()
yihui 33602ad
mostly cosmetic changes so that we don't need to pass several variabl…
yihui 2630883
tweak tests for build_404()
yihui 8ac3b62
further tweaking tests
yihui a527d39
don't move the existing 404.html
yihui a8d98d9
Don't remove empty lines in 404.html created using html_fragment()
cderv fd73253
Bump version
cderv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| Package: bookdown | ||
| Type: Package | ||
| Title: Authoring Books and Technical Documents with R Markdown | ||
| Version: 0.22.12 | ||
| Version: 0.22.13 | ||
| Authors@R: c( | ||
| person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")), | ||
| person("JJ", "Allaire", role = "ctb"), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| test_that("build_404 creates correct 404 page", { | ||
| tmp_dir <- withr::local_tempdir() | ||
| withr::local_dir(tmp_dir) | ||
|
|
||
| # default page | ||
| expect_false(file.exists("404.html")) | ||
| expect_null(build_404()$rmd_cur) | ||
| expect_false(file.exists("404.html")) | ||
|
|
||
| # custom pages | ||
| xfun::write_utf8(c("# Page not found", "", "I am created with _404.Rmd"), "_404.Rmd") | ||
| build_404() | ||
| expect_true(file.exists("404.html")) | ||
| expect_match(xfun::file_string("404.html"), "I am created with _404.Rmd", fixed = TRUE) | ||
|
|
||
| # do nothing if one exist | ||
| expect_null(build_404()$html) | ||
|
|
||
| unlink(c("404.html", "_404.Rmd")) | ||
|
|
||
| xfun::write_utf8(c("# Page not found", "", "I am created with _404.md"), "_404.md") | ||
| build_404() | ||
| expect_true(file.exists("404.html")) | ||
| expect_match(xfun::file_string("404.html"), "I am created with _404.md", fixed = TRUE) | ||
| }) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.