markdown-docs.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  4. * @author Panagiotis Tourlas <panagiot_tourlov@hotmail.com>
  5. *
  6. * @author Koya Sakuma
  7. * This module is based on jmol transpiler from MolQL and modified in similar manner as pymol and vmd tranpilers. */
  8. import { properties } from './properties';
  9. import { operators } from './operators';
  10. import { keywords } from './keywords';
  11. const _docs: string[] = [
  12. 'Jmol',
  13. '============',
  14. '--------------------------------',
  15. ''
  16. ];
  17. _docs.push(`## Properties\n\n`);
  18. _docs.push('--------------------------------\n');
  19. for (const name in properties) {
  20. if (properties[name].isUnsupported) continue;
  21. const names = [name];
  22. if (properties[name].abbr) names.push(...properties[name].abbr!);
  23. _docs.push(`\`\`\`\n${names.join(', ')}\n\`\`\`\n`);
  24. if (properties[name]['@desc']) {
  25. _docs.push(`*${properties[name]['@desc']}*\n`);
  26. }
  27. }
  28. _docs.push(`## Operators\n\n`);
  29. _docs.push('--------------------------------\n');
  30. operators.forEach(o => {
  31. if (o.isUnsupported) return;
  32. const names = [o.name];
  33. if (o.abbr) names.push(...o.abbr!);
  34. _docs.push(`\`\`\`\n${names.join(', ')}\n\`\`\`\n`);
  35. if (o['@desc']) {
  36. _docs.push(`*${o['@desc']}*\n`);
  37. }
  38. });
  39. _docs.push(`## Keywords\n\n`);
  40. _docs.push('--------------------------------\n');
  41. for (const name in keywords) {
  42. if (!keywords[name].map) continue;
  43. const names = [name];
  44. if (keywords[name].abbr) names.push(...keywords[name].abbr!);
  45. _docs.push(`\`\`\`\n${names.join(', ')}\n\`\`\`\n`);
  46. if (keywords[name]['@desc']) {
  47. _docs.push(`*${keywords[name]['@desc']}*\n`);
  48. }
  49. }
  50. export const docs = _docs.join('\n');