diff --git a/public/docs/_includes/styleguide/_code-examples.jade b/public/docs/_includes/styleguide/_code-examples.jade index ab2f5d250d..47b68a2c57 100644 --- a/public/docs/_includes/styleguide/_code-examples.jade +++ b/public/docs/_includes/styleguide/_code-examples.jade @@ -271,7 +271,7 @@ include ../../../_includes/_util-fns #### Example: 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") @@ -279,7 +279,7 @@ include ../../../_includes/_util-fns A subset of the '.json' file can also be selected. 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" ) @@ -287,7 +287,7 @@ include ../../../_includes/_util-fns Styling selected portions of the json is also supported. 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.*)/ ]}) @@ -296,7 +296,7 @@ include ../../../_includes/_util-fns code-example(format="" language="js"). - 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 }; +makeJson('styleguide/package.1.json', {paths: 'name, version, dependencies '}, "Foo", styles ) diff --git a/tools/doc-shredder/fileReaders/extractPathsReader.js b/tools/doc-shredder/fileReaders/extractPathsReader.js index 6560ca502d..ad34f22bf9 100644 --- a/tools/doc-shredder/fileReaders/extractPathsReader.js +++ b/tools/doc-shredder/fileReaders/extractPathsReader.js @@ -6,8 +6,9 @@ var path = require('canonical-path'); module.exports = function extractPathsReader(log) { - // regex for makeTabs line - var rx = /\s*\+make(?:=Tabs|Example|Json)\(\s*["'](.*?)["']\s*,\s*["'](.*?)["'].*?\)/g + // regexs for makeTabs. makeExample and makeJson lines + var rx = /\s*\+make(?:=Tabs|Example)\(\s*["'](.*?)["']\s*,\s*["'](.*?)["'].*?\)/g + var rxJson = /\s*\+makeJson\(\s*["'](.*?)["']\s*,.*?\)/g return { name: 'extractPathsReader', @@ -24,6 +25,12 @@ module.exports = function extractPathsReader(log) { 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) { return [{ fragItems: fragItems