amazeui-doc-util
Advanced tools
Comparing version 0.2.0 to 0.3.0
'use strict'; | ||
var format = require('util').format; | ||
var gulp = require('gulp'); | ||
@@ -7,2 +8,3 @@ var $ = require('gulp-load-plugins')(); | ||
var docUtil = require('./index'); | ||
var pkg = require('./package.json'); | ||
@@ -26,3 +28,3 @@ var AUTOPREFIXER_BROWSERS = [ | ||
var headerTpl = '/*! Build on <%= date %> */\n'; | ||
var headerTpl = format('/*! %s v%s | built on <%= date %> */\n', pkg.name, pkg.version); | ||
@@ -52,8 +54,6 @@ gulp.task('less', function() { | ||
gulp.task('test', function(){ | ||
return gulp.src('./test/test.md') | ||
return gulp.src('./test/*.md') | ||
.pipe(markJSON(docUtil.markedOptions)) | ||
.pipe(docUtil.applyTemplate()) | ||
.pipe($.rename(function(file) { | ||
file.extname = '.html'; | ||
})) | ||
.pipe($.rename({extname: '.html'})) | ||
.pipe(gulp.dest('./dist')); | ||
@@ -60,0 +60,0 @@ }); |
@@ -10,3 +10,4 @@ 'use strict'; | ||
var Handlebars = require('handlebars'); | ||
var _ = require('lodash'); | ||
var assign = require('object.assign'); | ||
var safeString = require('./safeString'); | ||
@@ -114,3 +115,3 @@ var escape = function(html, encode) { | ||
renderer.heading = function(text, level) { | ||
var escapedText = encodeURIComponent(text); | ||
var escapedText = safeString(text); | ||
@@ -125,2 +126,6 @@ return '<h' + level + '><a name="' + | ||
renderer.table = function(header, body) { | ||
return format('<table class="am-table am-table-bordered am-table-striped"><thead>%s</thead><tbody>%s</tbody></table>', header, body); | ||
}; | ||
var applyTemplate = function(tpl, data) { | ||
@@ -132,3 +137,3 @@ tpl = tpl || fs.readFileSync(path.join(__dirname, '../template/default.hbs'), | ||
return through.obj(function (file, enc, callback) { | ||
var mdData = _.extend({}, JSON.parse(file.contents.toString()), data || {}); | ||
var mdData = assign({}, JSON.parse(file.contents.toString()), data || {}); | ||
file.contents = new Buffer(compiler(mdData), 'utf8'); | ||
@@ -167,1 +172,3 @@ this.push(file); | ||
]; | ||
exports.safeString = safeString; |
{ | ||
"name": "amazeui-doc-util", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Amaze UI Markdown docs parsing util.", | ||
@@ -25,7 +25,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"handlebars": "^2.0.0", | ||
"handlebars": "^3.0.3", | ||
"highlight.js": "^8.4.0", | ||
"lodash": "^2.4.1", | ||
"marked": "^0.3.2", | ||
"through2": "^0.6.3" | ||
"object.assign": "^3.0.0", | ||
"through2": "^0.6.3", | ||
"unidecode": "^0.1.7" | ||
}, | ||
@@ -32,0 +33,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28961
14
286
6
+ Addedobject.assign@^3.0.0
+ Addedunidecode@^0.1.7
+ Addedalign-text@0.1.4(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhandlebars@3.0.8(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedminimist@0.0.10(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@3.0.1(transitive)
+ Addedoptimist@0.6.1(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addeduglify-js@2.8.29(transitive)
+ Addeduglify-to-browserify@1.0.2(transitive)
+ Addedunidecode@0.1.8(transitive)
+ Addedwindow-size@0.1.0(transitive)
+ Addedwordwrap@0.0.2(transitive)
+ Addedyargs@3.10.0(transitive)
- Removedlodash@^2.4.1
- Removedasync@0.2.10(transitive)
- Removedhandlebars@2.0.0(transitive)
- Removedlodash@2.4.2(transitive)
- Removedoptimist@0.3.7(transitive)
- Removeduglify-js@2.3.6(transitive)
Updatedhandlebars@^3.0.3