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

WIP <figure> semantics #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ module.exports = class Flatten
return '' if tag.data.trim() is ''
return '' if tag.data is '&nbsp;'
return tag.data
allowSubBlock = tag.name in ['video', 'article', 'figure', 'blockquote']
allowSubBlock = tag.name in ['video', 'article', 'figure', 'figcaption', 'blockquote']

if tag.name in @blockLevel and not tag.children
return ''
Expand Down
6 changes: 6 additions & 0 deletions spec/Flatten.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe 'Flatten', ->
<figure><iframe frameborder="0" src="http://www.youtube.com/embed/YzC7MfCtkzo"></iframe></figure>
<figure><img alt=\"An illustration of NoFlo used to create a flow-based version of the Jekyll tool for converting text into content suitable for Web publishing.\" src=\"http://cnet3.cbsistatic.com/hub/i/r/2013/09/10/92df7aec-6ddf-11e3-913e-14feb5ca9861/resize/620x/929f354f66ca3b99ab045f6f15a6693a/noflo-jekyll.png\">An illustration of NoFlo used to create a flow-based version of the Jekyll tool for converting text into content suitable for Web publishing.</figure>
<figure><div><img src=\"http://timenewsfeed.files.wordpress.com/2012/02/slanglol.jpg?w=480&amp;h=320&amp;crop=1\"></div>\n<figcaption><small>Tom Turley / <a href=\"http://www.gettyimages.com/\">Getty Images</a></small></figcaption></figure>
<figure><img src=\"http://a.com/b.jpg\"><figcaption><h1>Title</h1><p>Desc</p></figcaption></figure>
"""
]

Expand All @@ -93,6 +94,11 @@ describe 'Flatten', ->
src: 'http://timenewsfeed.files.wordpress.com/2012/02/slanglol.jpg?w=480&amp;h=320&amp;crop=1'
caption: 'Tom Turley / <a href="http://www.gettyimages.com/">Getty Images</a>'
html: "<figure><img src=\"http://timenewsfeed.files.wordpress.com/2012/02/slanglol.jpg?w=480&amp;h=320&amp;crop=1\"><figcaption>Tom Turley / <a href=\"http://www.gettyimages.com/\">Getty Images</a></figcaption></figure>"
,
type: 'image'
src: 'http://a.com/b.jpg'
caption: '<h1>Title</h1><p>Desc</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.

Why is this block.caption rather than block.metadata.caption?

Should it be html?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bergie RFC

html: "<figure><img src=\"http://a.com/b.jpg\"><figcaption><h1>Title</h1><p>Desc</p></figcaption></figure>"
]
]

Expand Down