dgeni-packages
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -14,17 +14,2 @@ module.exports = function(config) { | ||
config.append('processing.docTypes.code', [ | ||
'constant', | ||
'class', | ||
'constant', | ||
'event', | ||
'external', | ||
'file', | ||
'function', | ||
'member', | ||
'mixin', | ||
'module', | ||
'namespace', | ||
'typedef' | ||
]); | ||
config.append('rendering.filters', [ | ||
@@ -31,0 +16,0 @@ require('./rendering/filters/dash-case'), |
@@ -22,5 +22,7 @@ var path = require('canonical-path'); | ||
sourceFiles = config.source.files; | ||
injectables.value('projectPath', config.source.projectPath); | ||
}, | ||
process: function(docs) { | ||
process: function(docs, projectPath) { | ||
@@ -60,2 +62,3 @@ return Q.all(_.map(sourceFiles, function(fileInfo) { | ||
doc.fileName = path.basename(doc.file, '.'+doc.fileType); | ||
doc.relativePath = path.relative(projectPath, path.resolve(doc.basePath, doc.file)); | ||
}); | ||
@@ -62,0 +65,0 @@ |
@@ -23,15 +23,2 @@ var path = require('canonical-path'); | ||
config.append('processing.docTypes.code', [ | ||
'directive', | ||
'input', | ||
'service', | ||
'provider', | ||
'object', | ||
'type', | ||
'method', | ||
'property', | ||
'interface' | ||
]); | ||
config.set('processing.examples.commonFiles', { | ||
@@ -38,0 +25,0 @@ scripts: [], |
var code = require('dgeni/lib/utils/code'); | ||
module.exports = { | ||
name: 'code', | ||
process: function(str) { | ||
return code(str, true); | ||
process: function(str, lang) { | ||
return code(str, true, lang); | ||
} | ||
}; |
@@ -8,6 +8,8 @@ var trimIndentation = require('dgeni/lib/utils/trim-indentation'); | ||
parse: function(parser, nodes) { | ||
parser.advanceAfterBlockEnd(); | ||
var tok = parser.nextToken(); | ||
var args = parser.parseSignature(null, true); | ||
parser.advanceAfterBlockEnd(tok.value); | ||
var content = parser.parseUntilBlocks("endcode"); | ||
var tag = new nodes.CallExtension(this, 'process', null, [content]); | ||
var tag = new nodes.CallExtension(this, 'process', args, [content]); | ||
parser.advanceAfterBlockEnd(); | ||
@@ -18,7 +20,11 @@ | ||
process: function(context, content) { | ||
process: function(context, lang, content) { | ||
if ( !content ) { | ||
content = lang; | ||
lang = undefined; | ||
} | ||
var trimmedString = trimIndentation(content()); | ||
var codeString = code(trimmedString); | ||
var codeString = code(trimmedString, false, lang); | ||
return codeString; | ||
} | ||
}; |
@@ -5,3 +5,2 @@ var rewire = require('rewire'); | ||
describe("code custom filter", function() { | ||
var markedMock; | ||
@@ -11,2 +10,4 @@ it("should have the name 'code'", function() { | ||
}); | ||
it("should call the code utility", function() { | ||
@@ -18,4 +19,14 @@ var codeSpy = jasmine.createSpy('code'); | ||
expect(codeSpy).toHaveBeenCalledWith('function foo() { }', true); | ||
expect(codeSpy).toHaveBeenCalledWith('function foo() { }', true, undefined); | ||
}); | ||
it("should pass the language to the code utility", function() { | ||
var codeSpy = jasmine.createSpy('code'); | ||
filter.__set__('code', codeSpy); | ||
filter.process('function foo() { }', 'js'); | ||
expect(codeSpy).toHaveBeenCalledWith('function foo() { }', true, 'js'); | ||
}); | ||
}); |
@@ -9,2 +9,6 @@ var filter = require('../../../rendering/filters/link'); | ||
it("should inject an inline link tag", function() { | ||
expect(filter.process('URL', 'TITLE')).toEqual('{@link URL TITLE }'); | ||
}); | ||
}); |
{ | ||
"name": "dgeni-packages", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A collection of dgeni packages for generating documentation from source code", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108203
88
2397