Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

block-parser.cjs 985B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. const reTag = /^@\S+/;
  6. /**
  7. * Creates configured `Parser`
  8. * @param {Partial<Options>} options
  9. */
  10. function getParser({
  11. fence = '```'
  12. } = {}) {
  13. const fencer = getFencer(fence);
  14. const toggleFence = (source, isFenced) => fencer(source) ? !isFenced : isFenced;
  15. return function parseBlock(source) {
  16. // start with description section
  17. const sections = [[]];
  18. let isFenced = false;
  19. for (const line of source) {
  20. if (reTag.test(line.tokens.description) && !isFenced) {
  21. sections.push([line]);
  22. } else {
  23. sections[sections.length - 1].push(line);
  24. }
  25. isFenced = toggleFence(line.tokens.description, isFenced);
  26. }
  27. return sections;
  28. };
  29. }
  30. exports.default = getParser;
  31. function getFencer(fence) {
  32. if (typeof fence === 'string') return source => source.split(fence).length % 2 === 0;
  33. return fence;
  34. }
  35. //# sourceMappingURL=block-parser.cjs.map