chore: fix error with doc-shredder not recognizing missing json fragment files.

closes #672
This commit is contained in:
Jay Traband 2016-01-08 20:43:17 -08:00 committed by Ward Bell
parent 21ad7eff11
commit 661f5fd89f
2 changed files with 13 additions and 6 deletions

View File

@ -271,7 +271,7 @@ include ../../../_includes/_util-fns
#### Example: #### Example:
code-example(format="" language="js"). code-example(format="" language="js").
+makeJson('styleguide/package.json', null, "Entire package.json file") +makeJson('styleguide/package.1.json', null, "Entire package.json file")
+makeJson('styleguide/package.1.json', null, "Entire package.json file") +makeJson('styleguide/package.1.json', null, "Entire package.json file")
@ -279,7 +279,7 @@ include ../../../_includes/_util-fns
A subset of the '.json' file can also be selected. A subset of the '.json' file can also be selected.
code-example(format="" language="js"). code-example(format="" language="js").
+makeJson('styleguide/package.json', { paths: 'version, scripts.tsc, scripts.start '}, "Selected parts of the package.json file" ) +makeJson('styleguide/package.1.json', { paths: 'version, scripts.tsc, scripts.start '}, "Selected parts of the package.json file" )
+makeJson('styleguide/package.1.json', { paths: 'version, scripts.tsc, scripts.start '}, "Selected parts of the package.json file" ) +makeJson('styleguide/package.1.json', { paths: 'version, scripts.tsc, scripts.start '}, "Selected parts of the package.json file" )
@ -287,7 +287,7 @@ include ../../../_includes/_util-fns
Styling selected portions of the json is also supported. Styling selected portions of the json is also supported.
code-example(format="" language="js"). code-example(format="" language="js").
+makeJson('styleguide/package.json', {paths: 'dependencies'}, "package.json dependencies", { pnk: [/(\S*traceur.*)/, /(\Sangular2.*)/, /(\Ssystem.*)/ ]}) +makeJson('styleguide/package.1.json', {paths: 'dependencies'}, "package.json dependencies", { pnk: [/(\S*traceur.*)/, /(\Sangular2.*)/, /(\Ssystem.*)/ ]})
+makeJson('styleguide/package.1.json', {paths: 'dependencies'}, "package.json dependencies", { pnk: [/(\S*traceur.*)/, /(\Sangular2.*)/, /(\Ssystem.*)/ ]}) +makeJson('styleguide/package.1.json', {paths: 'dependencies'}, "package.json dependencies", { pnk: [/(\S*traceur.*)/, /(\Sangular2.*)/, /(\Ssystem.*)/ ]})
@ -296,7 +296,7 @@ include ../../../_includes/_util-fns
code-example(format="" language="js"). code-example(format="" language="js").
- var styles = { pnk: /(^.*dependencies[\s\S]* \})/gm }; - var styles = { pnk: /(^.*dependencies[\s\S]* \})/gm };
+makeJson('styleguide/package.json', {paths: 'name, version, dependencies '}, "Foo", styles ) +makeJson('styleguide/package.1.json', {paths: 'name, version, dependencies '}, "Foo", styles )
- var styles = { pnk: /(^.*dependencies[\s\S]* \})/gm }; - var styles = { pnk: /(^.*dependencies[\s\S]* \})/gm };
+makeJson('styleguide/package.1.json', {paths: 'name, version, dependencies '}, "Foo", styles ) +makeJson('styleguide/package.1.json', {paths: 'name, version, dependencies '}, "Foo", styles )

View File

@ -6,8 +6,9 @@
var path = require('canonical-path'); var path = require('canonical-path');
module.exports = function extractPathsReader(log) { module.exports = function extractPathsReader(log) {
// regex for makeTabs line // regexs for makeTabs. makeExample and makeJson lines
var rx = /\s*\+make(?:=Tabs|Example|Json)\(\s*["'](.*?)["']\s*,\s*["'](.*?)["'].*?\)/g var rx = /\s*\+make(?:=Tabs|Example)\(\s*["'](.*?)["']\s*,\s*["'](.*?)["'].*?\)/g
var rxJson = /\s*\+makeJson\(\s*["'](.*?)["']\s*,.*?\)/g
return { return {
name: 'extractPathsReader', name: 'extractPathsReader',
@ -24,6 +25,12 @@ module.exports = function extractPathsReader(log) {
fragItems.push( { mixinPath: filePath, region: region } ); fragItems.push( { mixinPath: filePath, region: region } );
}); });
} }
while ((r = rxJson.exec(content)) !== null) {
var filePaths = r[1].split(',');
filePaths.forEach(function(filePath) {
fragItems.push( { mixinPath: filePath, region: null } );
});
}
if (fragItems.length) { if (fragItems.length) {
return [{ return [{
fragItems: fragItems fragItems: fragItems