summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-10-03 23:34:27 +0200
committerSamy Pesse <samypesse@gmail.com>2016-10-03 23:34:27 +0200
commit84315a99f13adee0b96b6b12191f40a8012e32d1 (patch)
tree2744eae8600872f40ce7ea74b9eb4598e22e8532 /packages/gitbook-core/src
parent026cc8304d38d7fc9bd02e9978ff52416eabbec0 (diff)
downloadgitbook-84315a99f13adee0b96b6b12191f40a8012e32d1.zip
gitbook-84315a99f13adee0b96b6b12191f40a8012e32d1.tar.gz
gitbook-84315a99f13adee0b96b6b12191f40a8012e32d1.tar.bz2
First handling of templating blocks
Diffstat (limited to 'packages/gitbook-core/src')
-rw-r--r--packages/gitbook-core/src/components/HTMLContent.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/gitbook-core/src/components/HTMLContent.js b/packages/gitbook-core/src/components/HTMLContent.js
index 4ce41f6..338e745 100644
--- a/packages/gitbook-core/src/components/HTMLContent.js
+++ b/packages/gitbook-core/src/components/HTMLContent.js
@@ -1,6 +1,7 @@
const React = require('react');
const ReactSafeHtml = require('react-safe-html');
const htmlTags = require('html-tags');
+const entities = require('entities');
const { InjectedComponent } = require('./InjectedComponent');
@@ -27,11 +28,12 @@ function inject(injectedProps, Component) {
}
const COMPONENTS = {
- // Templating blocks are exported as <template-block block="youtube" props="{}" />
- 'template-block': inject(
- ({block, props}) => {
+ // Templating blocks are exported as <xblock name="youtube" props="{}" />
+ 'xblock': inject(
+ ({name, props}) => {
+ props = entities.decodeHTML(props);
return {
- matching: { role: `block:${block}` },
+ matching: { role: `block:${name}` },
props: JSON.parse(props)
};
},