test.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: https://codemirror.net/LICENSE
  3. ;(function () {
  4. var mode = CodeMirror.getMode({ tabSize: 4 }, 'stex')
  5. function MT(name) {
  6. test.mode(name, mode, Array.prototype.slice.call(arguments, 1))
  7. }
  8. MT('word', 'foo')
  9. MT('twoWords', 'foo bar')
  10. MT('beginEndDocument', '[tag \\begin][bracket {][atom document][bracket }]', '[tag \\end][bracket {][atom document][bracket }]')
  11. MT('beginEndEquation', '[tag \\begin][bracket {][atom equation][bracket }]', ' E=mc^2', '[tag \\end][bracket {][atom equation][bracket }]')
  12. MT('beginModule', '[tag \\begin][bracket {][atom module][bracket }[[]]]')
  13. MT('beginModuleId', '[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]')
  14. MT('importModule', '[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]')
  15. MT('importModulePath', '[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]')
  16. MT('psForPDF', '[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]')
  17. MT('comment', '[comment % foo]')
  18. MT('tagComment', '[tag \\item][comment % bar]')
  19. MT('commentTag', ' [comment % \\item]')
  20. MT('commentLineBreak', '[comment %]', 'foo')
  21. MT('tagErrorCurly', '[tag \\begin][error }][bracket {]')
  22. MT('tagErrorSquare', '[tag \\item][error ]]][bracket {]')
  23. MT('commentCurly', '[comment % }]')
  24. MT('tagHash', 'the [tag \\#] key')
  25. MT('tagNumber', 'a [tag \\$][atom 5] stetson')
  26. MT('tagPercent', '[atom 100][tag \\%] beef')
  27. MT('tagAmpersand', 'L [tag \\&] N')
  28. MT('tagUnderscore', 'foo[tag \\_]bar')
  29. MT('tagBracketOpen', '[tag \\emph][bracket {][tag \\{][bracket }]')
  30. MT('tagBracketClose', '[tag \\emph][bracket {][tag \\}][bracket }]')
  31. MT('tagLetterNumber', 'section [tag \\S][atom 1]')
  32. MT('textTagNumber', 'para [tag \\P][atom 2]')
  33. MT('thinspace', 'x[tag \\,]y')
  34. MT('thickspace', 'x[tag \\;]y')
  35. MT('negativeThinspace', 'x[tag \\!]y')
  36. MT('periodNotSentence', 'J.\\ L.\\ is')
  37. MT('periodSentence', 'X[tag \\@]. The')
  38. MT('italicCorrection', '[bracket {][tag \\em] If[tag \\/][bracket }] I')
  39. MT('tagBracket', '[tag \\newcommand][bracket {][tag \\pop][bracket }]')
  40. MT('inlineMathTagFollowedByNumber', '[keyword $][tag \\pi][number 2][keyword $]')
  41. MT('inlineMath', '[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text')
  42. MT('inlineMathLatexStyle', '[keyword \\(][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword \\)] other text')
  43. MT('displayMath', 'More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text')
  44. MT('displayMath environment', '[tag \\begin][bracket {][atom equation][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text')
  45. MT(
  46. 'displayMath environment with label',
  47. '[tag \\begin][bracket {][atom equation][bracket }][tag \\label][bracket {][atom eq1][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text~[tag \\ref][bracket {][atom eq1][bracket }]'
  48. )
  49. MT('mathWithComment', '[keyword $][variable-2 x] [comment % $]', '[variable-2 y][keyword $] other text')
  50. MT('lineBreakArgument', '[tag \\\\][bracket [[][atom 1cm][bracket ]]]')
  51. })()