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.

132 lines
3.6 KiB

2 months ago
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: https://codemirror.net/5/LICENSE
  3. (function() {
  4. var mode = CodeMirror.getMode({tabSize: 4}, "stex");
  5. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  6. MT("word",
  7. "foo");
  8. MT("twoWords",
  9. "foo bar");
  10. MT("beginEndDocument",
  11. "[tag \\begin][bracket {][atom document][bracket }]",
  12. "[tag \\end][bracket {][atom document][bracket }]");
  13. MT("beginEndEquation",
  14. "[tag \\begin][bracket {][atom equation][bracket }]",
  15. " E=mc^2",
  16. "[tag \\end][bracket {][atom equation][bracket }]");
  17. MT("beginModule",
  18. "[tag \\begin][bracket {][atom module][bracket }[[]]]");
  19. MT("beginModuleId",
  20. "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]");
  21. MT("importModule",
  22. "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]");
  23. MT("importModulePath",
  24. "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]");
  25. MT("psForPDF",
  26. "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]");
  27. MT("comment",
  28. "[comment % foo]");
  29. MT("tagComment",
  30. "[tag \\item][comment % bar]");
  31. MT("commentTag",
  32. " [comment % \\item]");
  33. MT("commentLineBreak",
  34. "[comment %]",
  35. "foo");
  36. MT("tagErrorCurly",
  37. "[tag \\begin][error }][bracket {]");
  38. MT("tagErrorSquare",
  39. "[tag \\item][error ]]][bracket {]");
  40. MT("commentCurly",
  41. "[comment % }]");
  42. MT("tagHash",
  43. "the [tag \\#] key");
  44. MT("tagNumber",
  45. "a [tag \\$][atom 5] stetson");
  46. MT("tagPercent",
  47. "[atom 100][tag \\%] beef");
  48. MT("tagAmpersand",
  49. "L [tag \\&] N");
  50. MT("tagUnderscore",
  51. "foo[tag \\_]bar");
  52. MT("tagBracketOpen",
  53. "[tag \\emph][bracket {][tag \\{][bracket }]");
  54. MT("tagBracketClose",
  55. "[tag \\emph][bracket {][tag \\}][bracket }]");
  56. MT("tagLetterNumber",
  57. "section [tag \\S][atom 1]");
  58. MT("textTagNumber",
  59. "para [tag \\P][atom 2]");
  60. MT("thinspace",
  61. "x[tag \\,]y");
  62. MT("thickspace",
  63. "x[tag \\;]y");
  64. MT("negativeThinspace",
  65. "x[tag \\!]y");
  66. MT("periodNotSentence",
  67. "J.\\ L.\\ is");
  68. MT("periodSentence",
  69. "X[tag \\@]. The");
  70. MT("italicCorrection",
  71. "[bracket {][tag \\em] If[tag \\/][bracket }] I");
  72. MT("tagBracket",
  73. "[tag \\newcommand][bracket {][tag \\pop][bracket }]");
  74. MT("inlineMathTagFollowedByNumber",
  75. "[keyword $][tag \\pi][number 2][keyword $]");
  76. MT("inlineMath",
  77. "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text");
  78. MT("inlineMathLatexStyle",
  79. "[keyword \\(][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword \\)] other text");
  80. MT("displayMath",
  81. "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
  82. MT("displayMath environment",
  83. "[tag \\begin][bracket {][atom equation][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text");
  84. MT("displayMath environment with label",
  85. "[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 }]");
  86. MT("mathWithComment",
  87. "[keyword $][variable-2 x] [comment % $]",
  88. "[variable-2 y][keyword $] other text");
  89. MT("lineBreakArgument",
  90. "[tag \\\\][bracket [[][atom 1cm][bracket ]]]");
  91. })();