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.

container-phrasing.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. module.exports = phrasing
  2. function phrasing(parent, context, safeOptions) {
  3. var children = parent.children || []
  4. var results = []
  5. var index = -1
  6. var before = safeOptions.before
  7. var after
  8. var handle
  9. var child
  10. while (++index < children.length) {
  11. child = children[index]
  12. if (index + 1 < children.length) {
  13. handle = context.handle.handlers[children[index + 1].type]
  14. if (handle && handle.peek) handle = handle.peek
  15. after = handle
  16. ? handle(children[index + 1], parent, context, {
  17. before: '',
  18. after: ''
  19. }).charAt(0)
  20. : ''
  21. } else {
  22. after = safeOptions.after
  23. }
  24. // In some cases, html (text) can be found in phrasing right after an eol.
  25. // When we’d serialize that, in most cases that would be seen as html
  26. // (flow).
  27. // As we can’t escape or so to prevent it from happening, we take a somewhat
  28. // reasonable approach: replace that eol with a space.
  29. // See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>
  30. if (
  31. results.length > 0 &&
  32. (before === '\r' || before === '\n') &&
  33. child.type === 'html'
  34. ) {
  35. results[results.length - 1] = results[results.length - 1].replace(
  36. /(\r?\n|\r)$/,
  37. ' '
  38. )
  39. before = ' '
  40. }
  41. results.push(
  42. context.handle(child, parent, context, {
  43. before: before,
  44. after: after
  45. })
  46. )
  47. before = results[results.length - 1].slice(-1)
  48. }
  49. return results.join('')
  50. }