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.

thematic-break.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. 'use strict'
  2. var assert = require('assert')
  3. var codes = require('../character/codes.js')
  4. var markdownLineEnding = require('../character/markdown-line-ending.js')
  5. var markdownSpace = require('../character/markdown-space.js')
  6. var constants = require('../constant/constants.js')
  7. var types = require('../constant/types.js')
  8. var factorySpace = require('./factory-space.js')
  9. function _interopDefaultLegacy(e) {
  10. return e && typeof e === 'object' && 'default' in e ? e : {default: e}
  11. }
  12. var assert__default = /*#__PURE__*/ _interopDefaultLegacy(assert)
  13. var thematicBreak = {
  14. name: 'thematicBreak',
  15. tokenize: tokenizeThematicBreak
  16. }
  17. function tokenizeThematicBreak(effects, ok, nok) {
  18. var size = 0
  19. var marker
  20. return start
  21. function start(code) {
  22. assert__default['default'](
  23. code === codes.asterisk ||
  24. code === codes.dash ||
  25. code === codes.underscore,
  26. 'expected `*`, `-`, or `_`'
  27. )
  28. effects.enter(types.thematicBreak)
  29. marker = code
  30. return atBreak(code)
  31. }
  32. function atBreak(code) {
  33. if (code === marker) {
  34. effects.enter(types.thematicBreakSequence)
  35. return sequence(code)
  36. }
  37. if (markdownSpace(code)) {
  38. return factorySpace(effects, atBreak, types.whitespace)(code)
  39. }
  40. if (
  41. size < constants.thematicBreakMarkerCountMin ||
  42. (code !== codes.eof && !markdownLineEnding(code))
  43. ) {
  44. return nok(code)
  45. }
  46. effects.exit(types.thematicBreak)
  47. return ok(code)
  48. }
  49. function sequence(code) {
  50. if (code === marker) {
  51. effects.consume(code)
  52. size++
  53. return sequence
  54. }
  55. effects.exit(types.thematicBreakSequence)
  56. return atBreak(code)
  57. }
  58. }
  59. module.exports = thematicBreak