Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

docs.js 1.6KB

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