root / HServer / 00.Server / 00.Program / node_modules / kareem / docs.js
이력 | 보기 | 이력해설 | 다운로드 (1.57 KB)
1 | 39 | HKM | var acquit = require('acquit'); |
---|---|---|---|
2 | |||
3 | var content = require('fs').readFileSync('./test/examples.test.js').toString(); |
||
4 | var blocks = acquit.parse(content);
|
||
5 | |||
6 | var mdOutput =
|
||
7 | '# kareem\n\n' +
|
||
8 | ' [](https://travis-ci.org/vkarpov15/kareem)\n' +
|
||
9 | ' [](https://coveralls.io/r/vkarpov15/kareem)\n\n' +
|
||
10 | 'Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, ' +
|
||
11 | 'meant to offer additional flexibility in allowing you to execute hooks ' +
|
||
12 | 'whenever necessary, as opposed to simply wrapping a single function.\n\n' +
|
||
13 | 'Named for the NBA\'s all-time leading scorer Kareem Abdul-Jabbar, known ' +
|
||
14 | 'for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook)\n\n' +
|
||
15 | '<img src="http://upload.wikimedia.org/wikipedia/commons/0/00/Kareem-Abdul-Jabbar_Lipofsky.jpg" width="220">\n\n' +
|
||
16 | '# API\n\n';
|
||
17 | |||
18 | for (var i = 0; i < blocks.length; ++i) { |
||
19 | var describe = blocks[i];
|
||
20 | mdOutput += '## ' + describe.contents + '\n\n'; |
||
21 | mdOutput += describe.comments[0] ?
|
||
22 | acquit.trimEachLine(describe.comments[0]) + '\n\n' : |
||
23 | '';
|
||
24 | |||
25 | for (var j = 0; j < describe.blocks.length; ++j) { |
||
26 | var it = describe.blocks[j];
|
||
27 | mdOutput += '#### It ' + it.contents + '\n\n'; |
||
28 | mdOutput += it.comments[0] ?
|
||
29 | acquit.trimEachLine(it.comments[0]) + '\n\n' : |
||
30 | '';
|
||
31 | mdOutput += '```javascript\n';
|
||
32 | mdOutput += ' ' + it.code + '\n'; |
||
33 | mdOutput += '```\n\n';
|
||
34 | } |
||
35 | } |
||
36 | |||
37 | require('fs').writeFileSync('README.md', mdOutput); |