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.

image.js 1.2KB

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