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.

definition.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. module.exports = definition
  2. var association = require('../util/association')
  3. var checkQuote = require('../util/check-quote')
  4. var safe = require('../util/safe')
  5. function definition(node, _, context) {
  6. var marker = checkQuote(context)
  7. var suffix = marker === '"' ? 'Quote' : 'Apostrophe'
  8. var exit = context.enter('definition')
  9. var subexit = context.enter('label')
  10. var value =
  11. '[' + safe(context, association(node), {before: '[', after: ']'}) + ']: '
  12. subexit()
  13. if (
  14. // If there’s no url, or…
  15. !node.url ||
  16. // If there’s whitespace, enclosed is prettier.
  17. /[ \t\r\n]/.test(node.url)
  18. ) {
  19. subexit = context.enter('destinationLiteral')
  20. value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'
  21. } else {
  22. // No whitespace, raw is prettier.
  23. subexit = context.enter('destinationRaw')
  24. value += safe(context, node.url, {before: ' ', after: ' '})
  25. }
  26. subexit()
  27. if (node.title) {
  28. subexit = context.enter('title' + suffix)
  29. value +=
  30. ' ' +
  31. marker +
  32. safe(context, node.title, {before: marker, after: marker}) +
  33. marker
  34. subexit()
  35. }
  36. exit()
  37. return value
  38. }