article-json-html-render
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -41,3 +41,4 @@ 'use strict'; | ||
var children = _ref3.children; | ||
return (0, _magicVirtualElement2.default)(Blockquote, { items: children }); | ||
var pullQuote = _ref3.pullQuote; | ||
return (0, _magicVirtualElement2.default)(Blockquote, { items: children, pullQuote: pullQuote }); | ||
}, | ||
@@ -44,0 +45,0 @@ embed: function embed(item) { |
@@ -17,6 +17,8 @@ 'use strict'; | ||
render: function render(_ref2) { | ||
var items = _ref2.props.items; | ||
var _ref2$props = _ref2.props; | ||
var items = _ref2$props.items; | ||
var pullQuote = _ref2$props.pullQuote; | ||
return (0, _magicVirtualElement2.default)( | ||
'blockquote', | ||
null, | ||
{ 'class': pullQuote && 'q' }, | ||
blockList(items) | ||
@@ -23,0 +25,0 @@ ); |
@@ -13,3 +13,3 @@ import element from 'magic-virtual-element'; | ||
const types = { | ||
blockquote: ({children}) => <Blockquote items={children} />, | ||
blockquote: ({children, pullQuote}) => <Blockquote items={children} pullQuote={pullQuote} />, | ||
embed: item => Embed.test(item) ? <Embed {...item} /> : '', | ||
@@ -16,0 +16,0 @@ header1: ({children}) => <Header level={1} items={children} />, |
import element from 'magic-virtual-element'; | ||
const setup = ({blockList}) => ({ | ||
render: ({props: {items}}) => <blockquote>{blockList(items)}</blockquote> | ||
render: ({props: {items, pullQuote}}) => <blockquote class={pullQuote && 'q'}>{blockList(items)}</blockquote> | ||
}); | ||
export default setup; |
{ | ||
"name": "article-json-html-render", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Base for html-based article-json renderer, such as [article-json-to-amp](https://www.npmjs.com/package/article-json-to-amp)", | ||
@@ -33,3 +33,3 @@ "main": "dist/index.js", | ||
"semistandard-deku": "micnews/semistandard#deku", | ||
"snazzy": "^4.0.0", | ||
"snazzy": "^5.0.0", | ||
"tape": "^4.4.0" | ||
@@ -36,0 +36,0 @@ }, |
35
test.js
@@ -199,2 +199,3 @@ import test from 'tape'; | ||
type: 'blockquote', | ||
pullQuote: false, | ||
children: [{ | ||
@@ -229,2 +230,36 @@ type: 'paragraph', | ||
test('blockquote pullQuote=true', t => { | ||
const Article = setupArticle({embeds: {}}); | ||
const items = [{ | ||
type: 'blockquote', | ||
pullQuote: true, | ||
children: [{ | ||
type: 'paragraph', | ||
children: [{ | ||
type: 'text', | ||
content: 'abc' | ||
}] | ||
}, { | ||
type: 'paragraph', | ||
children: [{ | ||
type: 'text', | ||
content: 'def', | ||
bold: true | ||
}] | ||
}] | ||
}]; | ||
const actual = renderString(tree(<Article items={items} />)); | ||
const expected = renderString(tree( | ||
<article> | ||
<blockquote class='q'> | ||
<p>abc</p> | ||
<p><b>def</b></p> | ||
</blockquote> | ||
</article> | ||
)); | ||
t.equal(actual, expected); | ||
t.end(); | ||
}); | ||
test('unkown type', t => { | ||
@@ -231,0 +266,0 @@ const Article = setupArticle({embeds: {}}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38529
1124