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.

join.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. module.exports = [joinDefaults]
  2. var formatCodeAsIndented = require('./util/format-code-as-indented')
  3. var formatHeadingAsSetext = require('./util/format-heading-as-setext')
  4. function joinDefaults(left, right, parent, context) {
  5. if (
  6. // Two lists with the same marker.
  7. (right.type === 'list' &&
  8. right.type === left.type &&
  9. Boolean(left.ordered) === Boolean(right.ordered)) ||
  10. // Indented code after list or another indented code.
  11. (right.type === 'code' &&
  12. formatCodeAsIndented(right, context) &&
  13. (left.type === 'list' ||
  14. (left.type === right.type && formatCodeAsIndented(left, context))))
  15. ) {
  16. return false
  17. }
  18. // Join children of a list or an item.
  19. // In which case, `parent` has a `spread` field.
  20. if (typeof parent.spread === 'boolean') {
  21. if (
  22. left.type === 'paragraph' &&
  23. // Two paragraphs.
  24. (left.type === right.type ||
  25. right.type === 'definition' ||
  26. // Paragraph followed by a setext heading.
  27. (right.type === 'heading' && formatHeadingAsSetext(right, context)))
  28. ) {
  29. return
  30. }
  31. return parent.spread ? 1 : 0
  32. }
  33. }