content-kit-compiler
Advanced tools
Comparing version 0.2.3 to 0.3.0
{ | ||
"name": "content-kit-compiler", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "Parses and renders content to and from the JSON model that backs ContentKit's WYSIWYG Editor", | ||
"repository": "https://github.com/bustlelabs/content-kit-compiler", | ||
"main": "dist/content-kit-compiler.js", | ||
"main": "dist/content-kit-compiler/index.js", | ||
"scripts": { | ||
"test": "gulp test" | ||
"test": "testem ci", | ||
"build": "rm -rf dist && broccoli build dist", | ||
"prepublish": "./scripts/build-if-necessary.sh", | ||
"serve": "brocolli serve" | ||
}, | ||
@@ -23,3 +26,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"content-kit-utils": "0.1.2", | ||
"broccoli": "^0.16.3", | ||
"broccoli-babel-transpiler": "^5.2.3", | ||
"broccoli-concat": "0.0.13", | ||
"broccoli-funnel": "^0.2.3", | ||
"broccoli-merge-trees": "^0.2.1", | ||
"broccoli-multi-builder": "^0.1.0", | ||
"content-kit-utils": "^0.2.0", | ||
"esperanto": "^0.6.31", | ||
@@ -30,5 +39,5 @@ "gulp": "^3.8.11", | ||
"gulp-qunit": "^1.2.1", | ||
"qunit": "^0.7.6", | ||
"qunitjs": "^1.18.0" | ||
"qunitjs": "^1.18.0", | ||
"testem": "^0.8.4" | ||
} | ||
} |
@@ -14,3 +14,3 @@ # ContentKit Compiler [![Build Status](https://travis-ci.org/bustlelabs/content-kit-compiler.svg?branch=master)](https://travis-ci.org/bustlelabs/content-kit-compiler) | ||
<ul> | ||
<li>Item A</li> | ||
<li>Item A</li> | ||
<li>Item B</li> | ||
@@ -96,5 +96,6 @@ </ul> | ||
## Building / Testing | ||
``` | ||
npm install | ||
gulp | ||
``` | ||
* `bower install` | ||
* `npm install` | ||
* `npm run serve && open http://localhost:4200/tests` or | ||
* `npm test` (uses testem to run tests in phantom and chrome) |
import HTMLParser from './parsers/html-parser'; | ||
import HTMLRenderer from './renderers/html-renderer'; | ||
import { DefaultBlockTypeSet, DefaultMarkupTypeSet } from './types/default-types'; | ||
import { mergeWithOptions } from 'content-kit-utils/src/object-utils'; | ||
import { mergeWithOptions } from 'content-kit-utils'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,7 +0,35 @@ | ||
import ContentKit from './main'; | ||
import Type from './types/type'; | ||
import BlockModel from './models/block'; | ||
import EmbedModel from './models/embed'; | ||
import Compiler from './compiler'; | ||
import HTMLParser from './parsers/html-parser'; | ||
import HTMLRenderer from './renderers/html-renderer'; | ||
import NewHTMLParser from './parsers/new-html-parser'; | ||
import doc from './parsers/document'; | ||
if (typeof exports === 'object') { | ||
module.exports = ContentKit; | ||
} else { | ||
window.ContentKit = ContentKit; | ||
} | ||
/** | ||
* @namespace ContentKit | ||
* Register public ContentKit compiler modules | ||
*/ | ||
const ContentKitCompiler = { | ||
Type, | ||
BlockModel, | ||
EmbedModel, | ||
Compiler, | ||
HTMLParser, | ||
HTMLRenderer, | ||
NewHTMLParser | ||
}; | ||
export { | ||
Type, | ||
BlockModel, | ||
EmbedModel, | ||
Compiler, | ||
HTMLParser, | ||
HTMLRenderer, | ||
NewHTMLParser, | ||
doc | ||
}; | ||
export default ContentKitCompiler; |
import Model from './model'; | ||
import { inherit } from 'content-kit-utils/src/object-utils'; | ||
import { inherit } from 'content-kit-utils'; | ||
/** | ||
* Ensures block markups at the same index are always in a specific order. | ||
* For example, so all bold links are consistently marked up | ||
* For example, so all bold links are consistently marked up | ||
* as <a><b>text</b></a> instead of <b><a>text</a></b> | ||
@@ -8,0 +8,0 @@ */ |
import Model from './model'; | ||
import { inherit } from 'content-kit-utils/src/object-utils'; | ||
import { inherit } from 'content-kit-utils'; | ||
@@ -4,0 +4,0 @@ /** |
@@ -33,2 +33,2 @@ /** | ||
export default Model; | ||
export default Model; |
@@ -7,3 +7,3 @@ /** | ||
if (typeof exports === 'object') { | ||
if (typeof module !== 'undefined' && module.exports) { | ||
var jsdom = require('jsdom').jsdom; | ||
@@ -10,0 +10,0 @@ doc = jsdom(); |
@@ -6,6 +6,6 @@ import parserDocument from './document'; | ||
import { DefaultBlockTypeSet, DefaultMarkupTypeSet } from '../types/default-types'; | ||
import { mergeWithOptions } from 'content-kit-utils/src/object-utils'; | ||
import { toArray } from 'content-kit-utils/src/array-utils'; | ||
import { trim, trimLeft, sanitizeWhitespace } from 'content-kit-utils/src/string-utils'; | ||
import { textOfNode, unwrapNode, attributesForNode } from 'content-kit-utils/src/node-utils'; | ||
import { mergeWithOptions } from 'content-kit-utils'; | ||
import { toArray } from 'content-kit-utils'; | ||
import { trim, trimLeft, sanitizeWhitespace } from 'content-kit-utils'; | ||
import { textOfNode, unwrapNode, attributesForNode } from 'content-kit-utils'; | ||
@@ -151,3 +151,3 @@ var ELEMENT_NODE = 1; | ||
* @param node element node to parse | ||
* @param startIndex | ||
* @param startIndex | ||
* @return {MarkupModel} markup model | ||
@@ -154,0 +154,0 @@ * Serializes markup of a single html element node (no child elements) |
@@ -1,3 +0,3 @@ | ||
import { injectIntoString } from 'content-kit-utils/src/string-utils'; | ||
import { sumSparseArray } from 'content-kit-utils/src/array-utils'; | ||
import { injectIntoString } from 'content-kit-utils'; | ||
import { sumSparseArray } from 'content-kit-utils'; | ||
@@ -4,0 +4,0 @@ /** |
import Type from '../types/type'; | ||
import HTMLElementRenderer from './html-element-renderer'; | ||
import HTMLEmbedRenderer from './html-embed-renderer'; | ||
import CardRenderer from './card-renderer'; | ||
import { DefaultBlockTypeSet, DefaultMarkupTypeSet } from '../types/default-types'; | ||
import { mergeWithOptions } from 'content-kit-utils/src/object-utils'; | ||
import { mergeWithOptions } from 'content-kit-utils'; | ||
@@ -15,3 +16,4 @@ /** | ||
markupTypes : DefaultMarkupTypeSet, | ||
typeRenderers : {} | ||
typeRenderers : {}, | ||
cards : {} | ||
}; | ||
@@ -32,2 +34,5 @@ mergeWithOptions(this, defaults, options); | ||
} | ||
if (type === Type.CARD) { | ||
return new CardRenderer(this.cards); | ||
} | ||
return new HTMLElementRenderer({ type: type, markupTypes: this.markupTypes }); | ||
@@ -47,4 +52,5 @@ }; | ||
for (i = 0; i < len; i++) { | ||
// this is renderModel, not only blocks!! | ||
blockHtml = this.renderBlock(model[i]); | ||
if (blockHtml) { | ||
if (blockHtml) { | ||
html += blockHtml; | ||
@@ -51,0 +57,0 @@ } |
@@ -15,3 +15,4 @@ import TypeSet from './type-set'; | ||
new Type({ tag: 'ol', name: 'ordered list' }), | ||
new Type({ name: 'embed', isTextType: false }) | ||
new Type({ name: 'embed', isTextType: false }), | ||
new Type({ name: 'card' }) | ||
]); | ||
@@ -18,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { underscore } from 'content-kit-utils/src/string-utils'; | ||
import { underscore } from 'content-kit-utils'; | ||
@@ -3,0 +3,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
270210
55
7748
100
14
5
2