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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. 'use strict'
  2. var markdownLineEnding = require('../character/markdown-line-ending.js')
  3. var markdownSpace = require('../character/markdown-space.js')
  4. var factorySpace = require('./factory-space.js')
  5. var thematicBreak = {
  6. name: 'thematicBreak',
  7. tokenize: tokenizeThematicBreak
  8. }
  9. function tokenizeThematicBreak(effects, ok, nok) {
  10. var size = 0
  11. var marker
  12. return start
  13. function start(code) {
  14. effects.enter('thematicBreak')
  15. marker = code
  16. return atBreak(code)
  17. }
  18. function atBreak(code) {
  19. if (code === marker) {
  20. effects.enter('thematicBreakSequence')
  21. return sequence(code)
  22. }
  23. if (markdownSpace(code)) {
  24. return factorySpace(effects, atBreak, 'whitespace')(code)
  25. }
  26. if (size < 3 || (code !== null && !markdownLineEnding(code))) {
  27. return nok(code)
  28. }
  29. effects.exit('thematicBreak')
  30. return ok(code)
  31. }
  32. function sequence(code) {
  33. if (code === marker) {
  34. effects.consume(code)
  35. size++
  36. return sequence
  37. }
  38. effects.exit('thematicBreakSequence')
  39. return atBreak(code)
  40. }
  41. }
  42. module.exports = thematicBreak