live-guide
Advanced tools
Comparing version 0.3.10 to 0.4.0
@@ -11,2 +11,4 @@ #!/usr/bin/env node | ||
.describe('resource', 'additional resources to be loaded into the code example iframes') | ||
.alias('name', 'n') | ||
.describe('name', 'name for the style guide or product') | ||
//.alias('c', 'config') | ||
@@ -24,5 +26,6 @@ //.alias('t', 'template') | ||
output: cliOptions.output || undefined, | ||
resources: cliOptions.resource || [] | ||
resources: cliOptions.resource || [], | ||
name: cliOptions.name || 'Styleguide' | ||
} | ||
require('../index.js')(options); |
@@ -1,5 +0,5 @@ | ||
var version = parseInt(process.version.replace(/^v/,''), 10); | ||
var version = parseInt(process.version.replace(/^v/, ''), 10); | ||
if (version < 4) { | ||
require('babel-core/register')(); | ||
require('babel-core/register')(); | ||
} | ||
@@ -6,0 +6,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
if (matches === null) { return "" } | ||
if (matches === null) { return ''; } | ||
@@ -15,9 +15,9 @@ matches = matches.map((m) => { | ||
match = match.trim(); | ||
if (match === "") { return match; } // return if there are no matches; | ||
if (match === '') { return match; } // return if there are no matches; | ||
return match | ||
.replace(/\/\*|\*\//, '').trim() | ||
.replace(/\*/, '').trim() | ||
.replace(/([\W\w]+)\*\//, '$1').trim() | ||
.replace(/\/\//, '').trim(); | ||
return match | ||
.replace(/^\/\*|\*\//, '').trim() | ||
.replace(/^\*/, '').trim() | ||
.replace(/^([\W\w]+)\*\//, '$1').trim() | ||
.replace(/^\/\//, '').trim(); | ||
}); | ||
@@ -24,0 +24,0 @@ |
@@ -21,11 +21,20 @@ 'use strict'; | ||
module.exports = { | ||
author: { | ||
description: 'Contribute the code to someone', | ||
pattern: /@author[^\S\n]+?(.+)/g, | ||
filter: '<p class="author">**Authored by:** *$1*</p>', | ||
}, | ||
description: { | ||
pattern: /@description[^\S\n]+?(.+)/g, | ||
filter: '*$1*' | ||
}, | ||
example: { | ||
pattern: /^@example(.*)?((?:.|\n)+?)\s$/gm, | ||
pattern: /^@example(.*?)?$\s((?:^.+$\s?)+)/gm, | ||
task: function(obj) { | ||
obj.filteredComments = obj.filteredComments.replace(this.pattern, function(match, language, snippet) { | ||
if (!snippet) { return match } | ||
if (!snippet) { return match; } | ||
language = language || ''; | ||
return `\`\`\`${language.trim()}${snippet}\n\`\`\`\n`; | ||
return `\`\`\`${language.trim()}\n${snippet}\n\`\`\`\n`; | ||
}); | ||
@@ -52,4 +61,21 @@ } | ||
filter: `**TODO:** *$1*` | ||
}, | ||
url: { | ||
pattern:/@url[^\S\n]+?(.+)/g, | ||
filter: '<a href="$1" target="_blank">$1</a>' | ||
}, | ||
wrietName: { | ||
pattern: /@writeName(.+)/g, | ||
task: function(obj) { | ||
obj.filteredComments = obj.filteredComments.replace(this.pattern, (match, name) => { | ||
if (!name) { return ''; } | ||
obj.writeName = name.trim(); | ||
return ''; | ||
}) | ||
} | ||
} | ||
}; | ||
'use strict'; | ||
const reduceObjects = (cssData) => cssData.filter((obj) => { | ||
if (!obj.title) { return false; } | ||
if (obj.filteredComments.length === 0) { return false } | ||
const reduceObjects = (cssData) => cssData.filter((obj) => (!obj.title || obj.filteredComments.length === 0) ? false : true); | ||
return true; | ||
}) | ||
module.exports = reduceObjects; | ||
@@ -63,5 +63,6 @@ 'use strict'; | ||
let result = template(obj); | ||
let result = template(obj), | ||
fileName = (obj.writeName || obj.title).replace(/ /g, '_').toLowerCase(); | ||
fs.writeFileSync(`${options.output}/${obj.title.replace(/ /g, '_').toLowerCase()}.html`, result); | ||
fs.writeFileSync(`${options.output}/${fileName}.html`, result); | ||
}); | ||
@@ -68,0 +69,0 @@ |
{ | ||
"name": "live-guide", | ||
"version": "0.3.10", | ||
"version": "0.4.0", | ||
"description": "Generate style guides based on commented style sheets.", | ||
@@ -49,2 +49,3 @@ "author": { | ||
"devDependencies": { | ||
"eslint": "^1.5.1", | ||
"myth": "^1.5.0", | ||
@@ -51,0 +52,0 @@ "watch": "^0.16.0" |
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
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
26064
676
3