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

zmarkdown: fix image & one smiley #241

Closed
wants to merge 2 commits into from

Conversation

artragis
Copy link
Member

@artragis artragis commented Jul 16, 2018

Since v27 deployment we got some feedback, this PR fixes two of them :

@@ -140,6 +140,7 @@ const remarkConfig = {
'^^': '/static/smileys/hihi.png',
':o': '/static/smileys/huh.png',
':p': '/static/smileys/langue.png',
':P': '/static/smileys/langue.png',
Copy link

Choose a reason for hiding this comment

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

Should'nt we just convert emoticon to lower case in /packages/remark-emoticons/src/index.js:36` instead ?

Copy link
Member Author

Choose a reason for hiding this comment

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

perhaps. What do you think @vhf

Copy link
Contributor

Choose a reason for hiding this comment

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

I usually don't consider smileys to be case sensitive.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, so I will modify remark-emoticons.

@artragis artragis force-pushed the fix_feedback_fromv27 branch 2 times, most recently from 653bb7a to 9e37b2f Compare July 17, 2018 07:44
@artragis
Copy link
Member Author

I think this is mergeable @vhf? @davbaumgartner

Copy link
Contributor

@vhf vhf left a comment

Choose a reason for hiding this comment

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

Sorry, this is as broken as the previous PRs. I'll let you find out why this time. Pointing out specific issues or explaining what's wrong didn't help in your past PRs.

@artragis
Copy link
Member Author

@vhf: WHat I see here:

  • PR title is OK
  • tests are complete : block image, inline image, transposition in html & latex
  • tests are what we expect : block image gives caption when alt title is given
  • snapshots are consistent.

I don't see any point.

@artragis
Copy link
Member Author

so @vhf what can we do? Those bugs are annoying for zds members et I don't understand what you require me to do.

@vhf
Copy link
Contributor

vhf commented Jul 19, 2018

What would be really annoying is adding more bugs. Please add tests dedicated to the case insensitive smileys.

@artragis
Copy link
Member Author

@vhf
Copy link
Contributor

vhf commented Jul 19, 2018

Yes, a bit like this one except:

  • Without bugs (as I said on many of your previous PRs, you need to read the git diff before committing, this way you can check that what you commit is what you actually want to commit and you don't end up pushing broken things),
  • In its own test case (as we do whenever we discover a bug: we add a test case to make sure there will be no regression, and we name this test case with whatever it is actually testing).

@artragis
Copy link
Member Author

Without bugs (as I said on many of your previous PRs, you need to read the git diff before committing, this way you can check that what you commit is what you actually want to commit and you don't end up pushing broken things),

As I said in the previous PRs, I DO read the diff.

But as I said in previous PRs snapshot are really hard to read. When you see a bug it's far more easier to tell me you've seen it.

AS this pr is little, I managed to get your point after reading it 5 times with focus on the snapshot. If you found out the error at the first glance, I really don't get the point of not telling it.

I will spli the test to extract the :p versus :P

@vhf
Copy link
Contributor

vhf commented Jul 19, 2018

That was not the only bug. Looking for the smiley you got, then again with both lowercase and uppercase versions cannot work. What if the configuration contains a smiley with mixed case?

I fixed this bug and fixed the tests (snapshots are not well suited here) in here: #246

Regarding your other commit, wrapping an image in a figure, I'd like to understand how it should behave before reviewing the code. The two test cases are not enough to get the intent or to check whether this will behave as expected.

Should all images become figures? Only the ones with an alt text and without a caption? Only images that are either inline or the only element of a block? Understanding your goal will also help deciding where this code should be, where it's now or as part of remark-captions.

@artragis
Copy link
Member Author

Regarding your other commit, wrapping an image in a figure, I'd like to understand how it should behave before reviewing the code. The two test cases are not enough to get the intent or to check whether this will behave as expected.

if you have an image which is not inline and not included inside a figure you must transform it as a figure.

For example:

Hello world

![legend](image)

becomes

<p>Hello world</p>
<figure>
<img src="image" alt=""/>
<figcaption>legend</figcaption>
</figure>

Nota : the blank "alt" is not mandatory, it is an old behaviour which was not the best (alt text should always be here)

If you have a legend, you get :

Hello

![alt](url)
FIgure: Legend
<p>Hello world</p>
<figure>
<img src="image" alt="alt"/>
<figcaption>Legend</figcaption>
</figure>

This case is the one treated by remark-captions

THen for inline images (emoticons and all images that has type inlineImage, nothing must change.

@vhf
Copy link
Contributor

vhf commented Jul 19, 2018

Ok, I think I get it. Last question:

Should:

![foo](http://bar)

![](http://bar)
Figure: foo

give A:

<p><figure><img src="http://bar" alt="foo"><figcaption>foo</figcaption></figure></p>

<p><figure><img src="http://bar"><figcaption>foo</figcaption></figure></p>

or B:

<figure><img src="http://bar" alt="foo"><figcaption>foo</figcaption></figure>

<p><figure><img src="http://bar"><figcaption>foo</figcaption></figure></p>

@artragis
Copy link
Member Author

I would say "C" :

<figure><img src="http://bar" alt="foo"><figcaption>foo</figcaption></figure>

<figure><img src="http://bar"><figcaption>foo</figcaption></figure>

I mean : remark-captions doesn't wrap figures between <p> and </p>

@vhf
Copy link
Contributor

vhf commented Jul 20, 2018

I mean : remark-captions doesn't wrap figures between <p> and </p>

It does. I don't think HTML allows figures to be in ps though. [edit] Yep, that's not allowed.

@vhf vhf closed this Jul 20, 2018
@artragis
Copy link
Member Author

When I use figures in zds website I have no wrapping p

no_wrapping

@vhf
Copy link
Contributor

vhf commented Jul 20, 2018

You are looking at what your browser parsed. Your browser respects the HTML spec. You should look at the HTML sent by the webserver to your browser.

@vhf vhf mentioned this pull request Jul 20, 2018
@artragis
Copy link
Member Author

True engough, thanks for the tip.

@vhf
Copy link
Contributor

vhf commented Jul 20, 2018

See the <p></p> right above <figure> on your screenshot? That's your browser immediately closing the <p> opened here: <p><figure> because figure is not allowed in p. Seeing this made me think figure might not be allowed in p, that's why I checked and reported this above.

@artragis artragis deleted the fix_feedback_fromv27 branch December 19, 2020 11:20
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

3 participants