1 | |||
2 | 1 | var fs = require('fs'); |
|
3 | 1 | var glob = require('glob'); |
|
4 | 1 | var globAll = require('glob-all'); |
|
5 | 1 | var path = require('path'); |
|
6 | 1 | var extend = require('util')._extend; |
|
7 | 1 | var format = require('string-template'); |
|
8 | 1 | var frontMatter = require('front-matter'); |
|
9 | 1 | var escapeHTML = require('escape-html'); |
|
10 | 1 | var multiline = require('multiline'); |
|
11 | 1 | var highlightCode = require('../util/highlight-code'); |
|
12 | |||
13 | 1 | var HTML_EXAMPLE_TEMPLATE = multiline(function() {/* |
|
14 | <div class="docs-code" data-patternlibrary-copycode> |
||
15 | <pre><code class="language-{0}">{1}</code></pre> |
||
16 | </div> |
||
17 | */}).replace(/(^(\s)*)/gm, ''); |
||
18 | |||
19 | 1 | module.exports = function(value, config, cb, pl) { |
|
20 | 1 | var data = getSourceCode (value, config, pl); |
|
21 | 1 | cb(null, processTree(data)); |
|
22 | } |
||
23 | |||
24 | 1 | module.exports.config = { |
|
25 | verbose: false |
||
26 | } |
||
27 | |||
28 | 1 | module.exports.search = function(items, link) { |
|
0 ignored issues
–
show
|
|||
29 | 1 | var results = []; |
|
30 | // this => collider |
||
31 | /* results.push({ |
||
32 | name: name, |
||
33 | type: 'sass ' + type, |
||
34 | description: description, |
||
35 | link: link + hash |
||
36 | }); */ |
||
37 | |||
38 | 1 | return results; |
|
39 | } |
||
40 | |||
41 | |||
42 | function getSourceCode(value, config, pl) { |
||
0 ignored issues
–
show
|
|||
43 | |||
44 | 1 | var sourceFile = frontMatter(fs.readFileSync(value).toString()); |
|
45 | 1 | var renderedCode = highlightCode('html', sourceFile.body); |
|
46 | 1 | var output = format(HTML_EXAMPLE_TEMPLATE, ['html', renderedCode]); |
|
47 | |||
48 | 1 | return { |
|
49 | highlight : output, |
||
50 | escaped : escapeHTML(sourceFile.body), |
||
51 | raw : sourceFile.body |
||
52 | }; |
||
53 | } |
||
54 | |||
55 | |||
56 | function processTree(tree) { |
||
57 | |||
58 | // do tree assignment stuff... |
||
59 | |||
60 | 1 | return tree; //my_stuff; |
|
61 | } |
||
62 | |||
63 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.