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

Fix paths to additional CSS and JavaScript files #777

Merged
merged 1 commit into from
Sep 4, 2018
Merged

Fix paths to additional CSS and JavaScript files #777

merged 1 commit into from
Sep 4, 2018

Conversation

wirelyre
Copy link
Contributor

@wirelyre wirelyre commented Sep 1, 2018

Expressions in an #each block need to begin with ../ to reference values in the main context.

Closes #774.

Expressions in an `#each` block need to begin with "../" to reference
values in the main context.
@mattico
Copy link
Contributor

mattico commented Sep 4, 2018

Are the additional-css/additional-js resources not being copied into the book root on build time? If so I think that would be the correct fix. I don't think we generally want to have URLs referencing paths above the book root.

@wirelyre
Copy link
Contributor Author

wirelyre commented Sep 4, 2018

No, they are. This PR just fixes references to the build root.

Previously, this line produced <script type="text/javascript" src="some-file.js"></script> irrespective of the directory depth of the generated file. Now it produces, for example, <script type="text/javascript" src="../../some-file.js"></script> when generating two/subdirs/file.html.

(This is the same directory level as the auto-copied book.js and favicon.png.)

I thought that there was a different underlying problem too, but it turns out that {{#each}} blocks just need dots due to namespace rules.

@mattico
Copy link
Contributor

mattico commented Sep 4, 2018

Ah, okay. I was wondering why the ../ was inside the template. I'll try this out locally.

@mattico mattico merged commit 48c97da into rust-lang:master Sep 4, 2018
@mattico
Copy link
Contributor

mattico commented Sep 4, 2018

Thanks! I think ideally we'd have a test for this, but I won't make you write all that scaffolding.

@wirelyre wirelyre deleted the fix-additional-css-and-js branch September 4, 2018 19:40
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
Fix paths to additional CSS and JavaScript files
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.

2 participants