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.

content.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. 'use strict'
  2. Object.defineProperty(exports, '__esModule', {value: true})
  3. var markdownLineEnding = require('../character/markdown-line-ending.js')
  4. var factorySpace = require('../tokenize/factory-space.js')
  5. var tokenize = initializeContent
  6. function initializeContent(effects) {
  7. var contentStart = effects.attempt(
  8. this.parser.constructs.contentInitial,
  9. afterContentStartConstruct,
  10. paragraphInitial
  11. )
  12. var previous
  13. return contentStart
  14. function afterContentStartConstruct(code) {
  15. if (code === null) {
  16. effects.consume(code)
  17. return
  18. }
  19. effects.enter('lineEnding')
  20. effects.consume(code)
  21. effects.exit('lineEnding')
  22. return factorySpace(effects, contentStart, 'linePrefix')
  23. }
  24. function paragraphInitial(code) {
  25. effects.enter('paragraph')
  26. return lineStart(code)
  27. }
  28. function lineStart(code) {
  29. var token = effects.enter('chunkText', {
  30. contentType: 'text',
  31. previous: previous
  32. })
  33. if (previous) {
  34. previous.next = token
  35. }
  36. previous = token
  37. return data(code)
  38. }
  39. function data(code) {
  40. if (code === null) {
  41. effects.exit('chunkText')
  42. effects.exit('paragraph')
  43. effects.consume(code)
  44. return
  45. }
  46. if (markdownLineEnding(code)) {
  47. effects.consume(code)
  48. effects.exit('chunkText')
  49. return lineStart
  50. } // Data.
  51. effects.consume(code)
  52. return data
  53. }
  54. }
  55. exports.tokenize = tokenize