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

Attempt to fix broken image links in Discovery book #142

Merged
merged 6 commits into from
Oct 31, 2018
Merged

Attempt to fix broken image links in Discovery book #142

merged 6 commits into from
Oct 31, 2018

Conversation

adamgreen
Copy link
Contributor

This PR pools together PRs #130 and #131 from @ChouzArt and adds 2 more commits that I created to correct other failing links missed by the first 2 and to modify the Travis verification steps to skip the checking of print.html - @ChouzArt has previously pointed out that rust-lang/mdBook#789 causes mdbook to generate an incorrect print.html file when relative links are used in the book content. Skipping verification of print.html during Travis runs means that we will still have a bad image links in print.html but the main Discovery book pages will have working images again and they will show up here on GitHub as well. I realize that this isn't a perfect solution but I thought that people might find it better than the current situation.

The main reason I am creating this PR is to:

  • See if it will pass Travis.
  • Get people's feedback on this half solution.

If we decide to take this PR then there are a few other things that need to be done:

  • Create a new issue to track the fact that we should revert this ignoring of print.html during link checking once the mdbook issue is resolved.
  • Make a similar change to the Bookself version of the Travis script.

I should also point out that running a sed script on print.html can fix most of the link issues that it contains so that the images will at least show up in a printout. Something like:

cp book/print.html print.html
sed 's: src="\.\./assets/: src="assets/:g' <print.html >book/print.html
rm print.html

ChouzArt and others added 6 commits October 7, 2018 02:06
After switching to relative URLs, linkchecker still encountered
some broken links. This commit fixes those broken links and now
the only broken links detected are in print.html itself. I will
work on fixing those in a later commit.

I also renamed some URLs from .html extensions to .md extensions
since they get renamed to .html by mdbook and it allows GitHub
renderings of these pages to end up going to the correct place
when you click on the links. They work in VSCode preview as well.
rust-lang/mdBook#789 causes
mdbook to generate print.html content with relative URLS that
are still relative to the individual HTML files and doesn't
correct for the fact that print.html isn't in the same folder.

This commit will verify that the relative URLs are correct in all
of the HTML output except for print.html  I am assuming that
people would like to see the images again in the Discovery book
website as they click through the various chapters, even if the
printable version is still broken.

If the PR with this commit is merged, an issue should be created
to track the fact that this change should be reverted once mdbook
handles relative links correctly in its generaton of print.html
@adamgreen adamgreen requested a review from a team as a code owner October 31, 2018 04:58
@adamgreen
Copy link
Contributor Author

I guess Travis doesn't really check much. Is it bors that runs the actual checking part of ci/script.sh? If so, who is allowed to ask it to just try a test pass and not push up to master?

Thanks!

@therealprof
Copy link
Contributor

@adamgreen Yes, you can do bors try. I believe anyone can do that.

bors try

bors bot added a commit that referenced this pull request Oct 31, 2018
@bors
Copy link
Contributor

bors bot commented Oct 31, 2018

try

Build succeeded

@adamgreen
Copy link
Contributor Author

@therealprof Thanks! Seems like it worked around the print.html failures. That makes me happy!

Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

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

Looks like a good and comprehensive approach to me. Let's try this. Thanks a lot @adamgreen.

@therealprof
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Oct 31, 2018
142: Attempt to fix broken image links in Discovery book r=therealprof a=adamgreen

This PR pools together PRs #130 and #131 from @ChouzArt and adds 2 more commits that I created to correct other failing links missed by the first 2 and to modify the Travis verification steps to skip the checking of print.html - @ChouzArt has previously pointed out that rust-lang/mdBook#789 causes mdbook to generate an incorrect print.html file when relative links are used in the book content. Skipping verification of print.html during Travis runs means that we will still have a bad image links in print.html but the main Discovery book pages will have working images again and they will show up here on GitHub as well. I realize that this isn't a perfect solution but I thought that people might find it better than the current situation.

The main reason I am creating this PR is to:
* See if it will pass Travis.
* Get people's feedback on this **half** solution.

If we decide to take this PR then there are a few other things that need to be done:
* Create a new issue to track the fact that we should revert this ignoring of print.html during link checking once the mdbook issue is resolved.
* Make a similar change to the [Bookself version of the Travis script](https://github.com/rust-embedded/bookshelf/blob/master/ci/script.sh).

I should also point out that running a `sed` script on print.html can fix most of the link issues that it contains so that the images will at least show up in a printout. Something like:
```console
cp book/print.html print.html
sed 's: src="\.\./assets/: src="assets/:g' <print.html >book/print.html
rm print.html
```

Co-authored-by: Carlos <gsolracchz@gmail.com>
Co-authored-by: Adam Green <adamgreen@users.noreply.github.com>
@bors
Copy link
Contributor

bors bot commented Oct 31, 2018

Build succeeded

@bors bors bot merged commit 9a1a7a9 into rust-embedded:master Oct 31, 2018
@adamgreen adamgreen deleted the relativeUrlWorkaround branch October 31, 2018 10:12
bors bot added a commit to rust-embedded/book that referenced this pull request Nov 4, 2018
68: canonicalize URLs r=therealprof a=japaric

as per #55

closes #55

this PR also ignores print.html when `linkcheck`-ing as done in
rust-embedded/discovery#142

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
njmartin10 pushed a commit to njmartin10/book that referenced this pull request Nov 10, 2018
68: canonicalize URLs r=therealprof a=japaric

as per rust-embedded#55

closes rust-embedded#55

this PR also ignores print.html when `linkcheck`-ing as done in
rust-embedded/discovery#142

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
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.

3 participants