ember-cli-yuidoc
Advanced tools
Comparing version
@@ -6,3 +6,32 @@ 'use strict'; | ||
var CachingWriter = require('broccoli-caching-writer'); | ||
var Y = require('yuidocjs'); | ||
var originalHandleComment = Y.DocParser.prototype.handlecomment; | ||
var AT_PLACEHOLDER = '---AT-PLACEHOLDER---'; | ||
var AT_PLACEHOLDER_REGEX = new RegExp(AT_PLACEHOLDER, 'g'); | ||
Y.DocParser.prototype.handlecomment = function(comment, file, line) { | ||
var lines = comment.split(/\r\n|\n/); | ||
var inMarkdownBlock = false; | ||
var newLines = lines.map((line) => { | ||
if (line.match(/^(\s*\*)?\s*```/)) { | ||
inMarkdownBlock = !inMarkdownBlock; | ||
} | ||
return inMarkdownBlock ? line.replace(/@/g, AT_PLACEHOLDER) : line; | ||
}); | ||
var ret = originalHandleComment.call(this, newLines.join('\n'), file, line); | ||
var description = ret.find(t => t.tag === 'description'); | ||
if (description) { | ||
description.value = description.value.replace(AT_PLACEHOLDER_REGEX, '@'); | ||
} | ||
return ret; | ||
} | ||
BroccoliYuidoc.prototype = Object.create(CachingWriter.prototype); | ||
@@ -19,3 +48,2 @@ BroccoliYuidoc.prototype.constructor = BroccoliYuidoc; | ||
BroccoliYuidoc.prototype.build = function() { | ||
var Y = require('yuidocjs'); | ||
var options = this.options; | ||
@@ -22,0 +50,0 @@ options.outdir = path.resolve(this.outputPath, options.outdir); |
{ | ||
"name": "ember-cli-yuidoc", | ||
"version": "0.8.8", | ||
"version": "0.9.0", | ||
"description": "Generate documentation of your app/addon from your yuidoc comments", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -12,3 +12,3 @@ # Ember-cli-yuidoc | ||
Then, you need to add a `yuidoc.json` manifest on the root of your project. Run `ember g ember-cli-yuidoc` to generate | ||
once with some sensitive defaults. | ||
once with some sensible defaults. | ||
@@ -15,0 +15,0 @@ ## Usage |
11940
6.64%188
9.94%13
-7.14%