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

Inconsistent asset folder link for scripts compared to images #150

Closed
Invarianz opened this issue May 12, 2019 · 1 comment
Closed

Inconsistent asset folder link for scripts compared to images #150

Invarianz opened this issue May 12, 2019 · 1 comment

Comments

@Invarianz
Copy link

Invarianz commented May 12, 2019

I encountered the following problem with scripts and images where the relative link that is used for both differs:
If I include an image on a subpage such as Menu 1 in the example provided by the JuDoc.jl documentation, i.e.:

<div class="row">
  <div class="container">
    <img class="left" src="assets/infra/rndimg.jpg">
    <p>
    Evolution is cool.
    </p>
    <div style="clear: both"></div>      
  </div>
</div>

The image link on the webpage is set to pub/assets/infra/rndimg.jpg. To make the image load on the webpage I need to copy the assets folder or at least the relevant images to src/pages/.
This behaviour differs from doing this on the index.md page, where the link will point to assets/infra/rndimg.jpg and the image will be correctly displayed.

Now comes my gripe with this behaviour:
The behaviour of scripts is the same also on "subpages" below index.md, as they will be included from the assets/scripts/ folder (e.g. \input{code:julia}{script2.jl}). However, when using \input{plot}{script2.jl} the image link points to pub/assets/scripts/output, when used on "subpages". Consequently, the image will not load and it has to be manually copied from where it is generated assets/scripts/output/ to where it is supposed to be, pub/assets/scripts/output/.
I think there are two solutions to make this behaviour consistent:
Either scripts used as input on "subpages" need to be imported from pub/assets/scripts/ or using \input{plot}{script2.jl} needs to set the link correctly to assets/scripts/output.

@Invarianz Invarianz changed the title Wrong asset folder link for images Inconsistent asset folder link for scripts compared to images May 12, 2019
@Invarianz Invarianz reopened this May 12, 2019
tlienart added a commit that referenced this issue May 20, 2019
@tlienart
Copy link
Owner

Hello again! and thanks a lot for reporting issues,

For the firs thing, you're right that if you copy the example from index.md into menu1.md the image does not load, the simple fix here is to just use src=/assets/... instead of src=assets/... so that we properly refer to the root.

Putting the images in src/pages/... will also work but I think the approach above makes more sense.

With respect to input, I made the same mistake of using assets/... instead of /assets/.... This is now fixed. Both this fix and the one for #151 will be in 0.1.3.

So if you now write

\input{plot}{script2.jl}

in menu1.md in the example without copying anything, you will get the expected plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants