/samples/scalate-presentation/src/highlight/languages/tex.js

http://github.com/scalate/scalate · JavaScript · 58 lines · 52 code · 1 blank · 5 comment · 0 complexity · 40840620c977a0f148fc6a05b05eb0b5 MD5 · raw file

  1. /*
  2. Language: TeX
  3. Author: Vladimir Moskva <vladmos@gmail.com>
  4. Website: http://fulc.ru/
  5. */
  6. hljs.LANGUAGES.tex = {
  7. defaultMode: {
  8. contains: ['parameter', 'command', 'special', 'formula', 'comment']
  9. },
  10. modes: [
  11. {
  12. className: 'parameter',
  13. begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', end: '^',
  14. returnBegin: true,
  15. contains: ['command', 'number'],
  16. noMarkup: true,
  17. relevance: 10
  18. },
  19. {
  20. className: 'command',
  21. begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?', end: '^',
  22. relevance: 10
  23. },
  24. {
  25. className: 'command',
  26. begin: '\\\\[^a-zA-Zа-яА-я0-9]', end: '^',
  27. relevance: 0
  28. },
  29. {
  30. className: 'comment',
  31. begin: '%', end: '$',
  32. relevance: 0
  33. },
  34. {
  35. className: 'special',
  36. begin: '[{}\\[\\]\\&#~]', end: '^',
  37. relevance: 0
  38. },
  39. {
  40. className: 'formula',
  41. begin: '\\$\\$', end: '\\$\\$',
  42. contains: ['command', 'special'],
  43. relevance: 0
  44. },
  45. {
  46. className: 'formula',
  47. begin: '\\$', end: '\\$',
  48. contains: ['command', 'special'],
  49. relevance: 0
  50. },
  51. {
  52. className: 'number',
  53. begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
  54. excludeBegin: true
  55. }
  56. ]
  57. };