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

point all the image src URIs to use the fig/ path #7

Merged
merged 1 commit into from
Jan 22, 2015

Conversation

zmughal
Copy link
Contributor

@zmughal zmughal commented Jan 19, 2015

No description provided.

@abostroem
Copy link
Contributor

I'd like a second opinion on this from someone more familiar than I am with how the websites build and the history of this project- why were we pointing to src and is fig the right place to be pointing.
@gvwilson ?

@wking
Copy link
Contributor

wking commented Jan 19, 2015

On Mon, Jan 19, 2015 at 11:22:52AM -0800, Azalee Bostroem wrote:

… is fig the right place to be pointing.

swcarpentry/DEPRECATED-lesson-template#43 may help you here. I'm not sure why
it's currently pointing somewhere else, but I haven't looked into the
history at all.

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 19, 2015

This looks good. +1 to merge.

why were we pointing to src

Because this is how HTML works, check http://www.w3.org/TR/html5/embedded-content-0.html#the-img-element. Sorry if I don't have a better answer.

@zmughal Thanks for this pull request. Do you mind replace the HTML with Markdown? E.g. replacing

<img src="fig/python-sticky-note-variables-01.svg" alt="Variables as Sticky Notes" />

with

![Variables as Sticky Notes](fig/python-sticky-note-variables-01.svg)

If you do that, you can update this pull request using

$ git add -u
$ git commit --amend
$ git push -f origin fix/fig-src

where origin is the name of your local repository.

@zmughal
Copy link
Contributor Author

zmughal commented Jan 19, 2015

@r-gaia-cs Yeah, I can do that right now.

@zmughal zmughal force-pushed the fix/fig-src branch 2 times, most recently from 1e7bac9 to 0875a72 Compare January 19, 2015 20:32
@zmughal
Copy link
Contributor Author

zmughal commented Jan 19, 2015

Done! I added a couple captions where they were missing too. I can remove them if they distract from the flow of the text.

The HTML will need to be rebuilt.

@@ -500,7 +500,7 @@ pyplot.imshow(data)
pyplot.show()
~~~

<img src="../../novice/python/01-numpy_files/novice/python/01-numpy_71_0.png">
![Heatmap of the Data](fig/01-numpy_71_0.png)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added caption here

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 20, 2015

Done! I added a couple captions where they were missing too.

@zmughal Thanks.

I can remove them if they distract from the flow of the text.

What you call "caption" is the alternative text that is render if the web browser doesn't support images or the image can't be retrieved. They don't distract from the flow of the text.

The HTML will need to be rebuilt.

Could you do that?

$ make preview

Sorry to forget it in the first time. After you rebuild the HTML could you add it to this pull request using the same commands from my last comments?

@@ -68,17 +68,23 @@ <h2 id="learning-objectives" class="objectives objectives">Learning Objectives</
<pre class="output"><code>weight in kilograms is now: 57.5</code></pre>
<p>As the example above shows, we can print several things at once by separating them with commas.</p>
<p>If we imagine the variable as a sticky note with a name written on it, assignment is like putting the sticky note on a particular value:</p>
<p><img src="img/python-sticky-note-variables-01.svg" alt="Variables as Sticky Notes" /></p>
<div class="figure">
<img src="fig/python-sticky-note-variables-01.svg" alt="Variables as Sticky Notes" /><p class="caption">Variables as Sticky Notes</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@r-gaia-cs, this is what I mean by the caption. It adds a <p class="caption"> to the HTML in addition to the alt attribute.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry that I didn't understand it correctly.

This is due one of the Pandoc's default extensions to Markdown. If you want we can disable this extension

$ pandoc -t html -f markdown-implicit_figures<<EOF 
![foo](bar.jpg) 
EOF
<p><img src="bar.jpg" alt="foo" /></p>

or do it for each case when need:

$ pandoc -t html <<EOF
![foo](bar.jpg)\  
EOF
<p><img src="bar.jpg" alt="foo" /> </p>

There is one white space right after the \.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to automatically number figures? If so, I'm +1 on
titling them (but only if the number is part of the title, e.g., "Figure
3: Thorium Analysis"). If they can't be numbered, or if the number
cannot be included in the title, I'm -1 on titling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it can't be done with pandoc yet. jgm/pandoc#615

Copy link
Contributor

Choose a reason for hiding this comment

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

On Mon, Jan 19, 2015 at 04:43:05PM -0800, Greg Wilson wrote:

Is there a way to automatically number figures?

Maybe not yet? jgm/pandoc#615

It looks like there's an implementation in jgm/pandoc#1298 that's
blocking on a cleaner solution 1.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to automatically number figures?

We can use CSS.

body {
  counter-reset: figure;
}
div.figure p::before {
  content: "Figure " counter(figure) ": ";
  counter-increment: figure;
}

Another possible solution is using another filter based on

$ pandoc -t json <<EOF
![foo](bar.jpg) 
EOF
[{"unMeta":{}},[{"t":"Para","c":[{"t":"Image","c":[[{"t":"Str","c":"foo"}],["bar.jpg","fig:"]]}]}]]
$ pandoc -t json -f markdown-implicit_figures<<EOF
![foo](bar.jpg)
EOF
[{"unMeta":{}},[{"t":"Para","c":[{"t":"Image","c":[[{"t":"Str","c":"foo"}],["bar.jpg",""]]}]}]]

@zmughal
Copy link
Contributor Author

zmughal commented Jan 20, 2015

Done!

@wking
Copy link
Contributor

wking commented Jan 20, 2015

On Mon, Jan 19, 2015 at 04:09:57PM -0800, Raniere Silva wrote:

The HTML will need to be rebuilt.

Could you do that?

$ make preview

Sorry to forget it in the first time. After you rebuild the HTML
could you add it to this pull request using the same commands from
my last comments?

I'd recommend the compiled HTML land as a separate commit, to avoid
distracting from the human-generated changes. To avoid churn due to
installed tools, it makes sense to me to have the maintainers product
that commit with their local toolset. But I'm not a maintainer here,
so that's just my two cents ;). Handle it however you like.

@zmughal
Copy link
Contributor Author

zmughal commented Jan 20, 2015

I backed out the HTML in the commit for now and used the <backslash><white-space> escaping on some of the figures so that all images will at least have an alt attribute. Let me know if that works out.

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 22, 2015

@zmughal Sorry for the delay.

I (...) used the <backslash><white-space> escaping on some of the figures

You only used it on the figures at 03-loop.md. This is correctly?

@zmughal
Copy link
Contributor Author

zmughal commented Jan 22, 2015

@r-gaia-cs , yes, this is correct. I can do so on the remaining figures if you'd like. In fact, maybe just make those changes and decide how to enumerate the figures later in another issue?

(The reason I only did that on just the ones in 03-loop.md is because the caption didn't add anything that the surrounding text didn't explain already.)

@rgaiacs
Copy link
Contributor

rgaiacs commented Jan 22, 2015

I can do so on the remaining figures if you'd like.

@zmughal Please. When you update this pull request, please send me a note (can be on IRC or email to avoid spam) and I will merge this.

In fact, maybe just make those changes and decide how to enumerate the figures later in another issue?

👍

And change the `<img>` tags to use Markdown's `![caption](/path/to/image)`
syntax.

Uses the <backslash><white-space> escaping from Pandoc to avoid
generating captions (see the `markdown-implicit_figures` extension).
rgaiacs pushed a commit that referenced this pull request Jan 22, 2015
point all the image src URIs to use the fig/ path
@rgaiacs rgaiacs merged commit b1d3cea into swcarpentry:gh-pages Jan 22, 2015
maxim-belkin pushed a commit that referenced this pull request Oct 23, 2020
zkamvar pushed a commit that referenced this pull request Apr 21, 2023
point all the image src URIs to use the fig/ path
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.

None yet

5 participants