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

Recognize HTML5 Block-Level Elements #331

Merged
merged 9 commits into from
Aug 20, 2014
Merged

Conversation

silverhammermba
Copy link
Contributor

I regenerated html_blocks.h using gperf. Also, I added the source file for gperf so that it's easier to regenerate in the future if the block-level elements are change.

@doktorbro
Copy link
Contributor

Please add a test for that feature. I suggest you add this known issue with 4-spaces-indented image:

<section>
    <img src="http://example.org/image.jpg" alt="">
</section>

@mhulse
Copy link

mhulse commented Dec 24, 2013

Because I know how much fun it can be to write tests ... 😆

Possibly another test:

<figure>

    <img src="http://example.org/image.jpg" alt="">

    <figcaption>
        <p>Hello world!</p>
    </figcaption>

</figure>

... as it's probably just as common, in HTML5, to wrap images in <figure> (probably more appropriate than <section>).

IMHO, a real-world <section> use case would be:

<section>

    <header>

        <hgroup>

            <h1>Section heading</h1>
            <h2>Subhead</h2>

        </hgroup>

    </header>

    <figure>

        <img src="http://example.org/image.jpg" alt="">

        <figcaption>
            <p>Hello world!</p>
        </figucaption>

    </figure>

    <p>The quick brown fox <a href="http://en.wikipedia.org/wiki/The_quick_brown_fox_jumps_over_the_lazy_dog">jumps over the lazy dog.</a></p>

</section>

Another test:

<article>

    <h1>Hello world!</h1>

    <figure>

        <img src="http://example.org/image.jpg" alt="">

        <figcaption>
            <p>Hello world!</p>
        </figucaption>

    </figure>

    <p>Could be summary text that goes here.</p>

</article>

Another thing to note, just in terms of docs perhaps, is that HTML5 changed the "distinction" of the term "block":

The distinction of block-level vs. inline elements is used in HTML specifications up to 4.01. In HTML5, this binary distinction is replaced with a more complex set of content categories. The "block-level" category roughly corresponds to the category of flow content in HTML5, while "inline" corresponds to phrasing content, but there are additional categories.

MDN

Not sure if that's of any interest to anyone.


Edit:

I've found these pages helpful for when it comes to eyeballing all of the latest/greatest HTML5 tags:

Not sure if that would be of help here ... Having quickly glanced at the html_block.h file, it looks like all the bases are covered.


Let me know if you need some more help thinking of tests.

@robin850
Copy link
Collaborator

I will try to have a look soon guys ; sorry for the delay and thanks for the patch! Merry Christmas too! 🎄

@robin850
Copy link
Collaborator

Ok, so this looks good to me. Just a couple of things:

  • Actually I'm not sure whether we should ship the html_block_names.txt file. I would be in favor of adding a comment in the generated C file pointing to a Gist or something like this. @mattr- Any thoughts on this please ?
  • Could you add a changelog entry please ?
  • A big 👍 for the tests

Thank you guys!

@robin850
Copy link
Collaborator

robin850 commented Jul 7, 2014

@silverhammermba : Any chance to address the feedback please ? :-)

@silverhammermba
Copy link
Contributor Author

@robin850 I'm trying to throw in some tests, but now I can't get it to recognize HTML5 blocks using my patch. Granted I haven't touched redcarpet in a while, but I guess I must be building it wrong.

@robin850
Copy link
Collaborator

@silverhammermba : Based on current master, if I run:

$ git checkout -b silverhammermba-html5 master
$ git pull git@github.com:silverhammermba/redcarpet.git html5
$ rake

It works perfectly. If you have problem running tests, be sure to prefix rake calls with bundle exec. On certain setups, the installed version of Redcarpet will be picked instead of the local copy.

@silverhammermba
Copy link
Contributor Author

Yeah, forgot to use bundle. I added a test which definitely works, but for some reason bundle exec rake test still complains about the HTML5 blocks even though testing manually with bundle exec bin/redcarpet works just fine. Whatever. It should be all good now.

@robin850 robin850 added this to the 3.2.0 milestone Jul 30, 2014
@robin850
Copy link
Collaborator

@silverhammermba : Thank you very much ! Could you please remove the html_block_names.txt file ?

Also, in general we should not alter the conformance suite as this is the original Markdown specs. Could you move these tests at the Ruby level please ? I guess you don't have to keep the whole files but if you really want, you can put them under the test/fixtures folder. :-)

@silverhammermba
Copy link
Contributor Author

I have made the requested changes.

robin850 added a commit that referenced this pull request Aug 20, 2014
Recognize HTML5 Block-Level Elements
@robin850 robin850 merged commit 546ec77 into vmg:master Aug 20, 2014
@robin850
Copy link
Collaborator

Thanks for your patch and your patience @silverhammermba ! ❤️ 💙 💛 💜 💚

@robin850 robin850 mentioned this pull request Dec 6, 2014
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.

4 participants