From 0a2b3f653709e443889c2a829eb11a8de957d48b Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Tue, 19 Jul 2016 17:23:49 +0100 Subject: [PATCH] Use Drafter NPM Package for API Blueprint Parsing --- package.json | 2 +- src/main.coffee | 6 +++--- test/basic.coffee | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0c156ea5..174c930c 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "chokidar": "^1.4.1", "cli-color": "^1.1.0", "pretty-error": "^1.2.0", - "protagonist": "^1.3.2", + "drafter": "^1.0.0", "serve-static": "^1.10.0", "socket.io": "^1.3.7", "yargs": "^3.31.0" diff --git a/src/main.coffee b/src/main.coffee index da860cca..adada1e1 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -1,6 +1,6 @@ fs = require 'fs' path = require 'path' -protagonist = require 'protagonist' +drafter = require 'drafter' INCLUDE = /( *)/gmi ROOT = path.dirname __dirname @@ -82,7 +82,7 @@ exports.render = (input, options, done) -> # Handle custom directive(s) input = includeDirective options.includePath, input - # Protagonist does not support \r ot \t in the input, so + # Drafter does not support \r ot \t in the input, so # try to intelligently massage the input so that it works. # This is required to process files created on Windows. filteredInput = if not options.filterInput then input else @@ -91,7 +91,7 @@ exports.render = (input, options, done) -> .replace(/\t/g, ' ') benchmark.start 'parse' - protagonist.parse filteredInput, type: 'ast', (err, res) -> + drafter.parse filteredInput, type: 'ast', (err, res) -> benchmark.end 'parse' if err err.input = input diff --git a/test/basic.coffee b/test/basic.coffee index 5a1a407b..ec5406f9 100644 --- a/test/basic.coffee +++ b/test/basic.coffee @@ -4,7 +4,7 @@ bin = require '../lib/bin' fs = require 'fs' http = require 'http' path = require 'path' -protagonist = require 'protagonist' +drafter = require 'drafter' sinon = require 'sinon' root = path.dirname(__dirname) @@ -164,13 +164,13 @@ describe 'API Blueprint Renderer', -> done() it 'Should error on drafter failure', (done) -> - sinon.stub protagonist, 'parse', (content, options, callback) -> + sinon.stub drafter, 'parse', (content, options, callback) -> callback 'error' aglio.render blueprint, 'default', (err, html) -> assert err - protagonist.parse.restore() + drafter.parse.restore() done()