hyhyhy 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (576) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +184 -0
  9. data/Rakefile +2 -0
  10. data/bin/hyhyhy +59 -0
  11. data/hyhyhy.gemspec +29 -0
  12. data/lib/hyhyhy.rb +101 -0
  13. data/lib/hyhyhy/config.rb +29 -0
  14. data/lib/hyhyhy/frames.rb +108 -0
  15. data/lib/hyhyhy/logger.rb +40 -0
  16. data/lib/hyhyhy/parser.rb +9 -0
  17. data/lib/hyhyhy/structure/.bowerrc +5 -0
  18. data/lib/hyhyhy/structure/.hyhyhy +5 -0
  19. data/lib/hyhyhy/structure/README.md +0 -0
  20. data/lib/hyhyhy/structure/_assets/javascripts/main.js +395 -0
  21. data/lib/hyhyhy/structure/_assets/stylesheets/main.css +520 -0
  22. data/lib/hyhyhy/structure/_includes/bootstrap/.bower.json +47 -0
  23. data/lib/hyhyhy/structure/_includes/bootstrap/Gruntfile.js +472 -0
  24. data/lib/hyhyhy/structure/_includes/bootstrap/LICENSE +21 -0
  25. data/lib/hyhyhy/structure/_includes/bootstrap/README.md +129 -0
  26. data/lib/hyhyhy/structure/_includes/bootstrap/bower.json +38 -0
  27. data/lib/hyhyhy/structure/_includes/bootstrap/dist/css/bootstrap-theme.css +470 -0
  28. data/lib/hyhyhy/structure/_includes/bootstrap/dist/css/bootstrap-theme.css.map +1 -0
  29. data/lib/hyhyhy/structure/_includes/bootstrap/dist/css/bootstrap-theme.min.css +5 -0
  30. data/lib/hyhyhy/structure/_includes/bootstrap/dist/css/bootstrap.css +6332 -0
  31. data/lib/hyhyhy/structure/_includes/bootstrap/dist/css/bootstrap.css.map +1 -0
  32. data/lib/hyhyhy/structure/_includes/bootstrap/dist/css/bootstrap.min.css +5 -0
  33. data/lib/hyhyhy/structure/_includes/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  34. data/lib/hyhyhy/structure/_includes/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  35. data/lib/hyhyhy/structure/_includes/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  36. data/lib/hyhyhy/structure/_includes/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  37. data/lib/hyhyhy/structure/_includes/bootstrap/dist/js/bootstrap.js +2320 -0
  38. data/lib/hyhyhy/structure/_includes/bootstrap/dist/js/bootstrap.min.js +7 -0
  39. data/lib/hyhyhy/structure/_includes/bootstrap/dist/js/npm.js +13 -0
  40. data/lib/hyhyhy/structure/_includes/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  41. data/lib/hyhyhy/structure/_includes/bootstrap/fonts/glyphicons-halflings-regular.svg +229 -0
  42. data/lib/hyhyhy/structure/_includes/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  43. data/lib/hyhyhy/structure/_includes/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  44. data/lib/hyhyhy/structure/_includes/bootstrap/grunt/.jshintrc +7 -0
  45. data/lib/hyhyhy/structure/_includes/bootstrap/grunt/bs-commonjs-generator.js +23 -0
  46. data/lib/hyhyhy/structure/_includes/bootstrap/grunt/bs-lessdoc-parser.js +238 -0
  47. data/lib/hyhyhy/structure/_includes/bootstrap/grunt/bs-raw-files-generator.js +46 -0
  48. data/lib/hyhyhy/structure/_includes/bootstrap/grunt/configBridge.json +44 -0
  49. data/lib/hyhyhy/structure/_includes/bootstrap/grunt/sauce_browsers.yml +82 -0
  50. data/lib/hyhyhy/structure/_includes/bootstrap/js/.jscsrc +34 -0
  51. data/lib/hyhyhy/structure/_includes/bootstrap/js/.jshintrc +15 -0
  52. data/lib/hyhyhy/structure/_includes/bootstrap/js/affix.js +162 -0
  53. data/lib/hyhyhy/structure/_includes/bootstrap/js/alert.js +94 -0
  54. data/lib/hyhyhy/structure/_includes/bootstrap/js/button.js +116 -0
  55. data/lib/hyhyhy/structure/_includes/bootstrap/js/carousel.js +240 -0
  56. data/lib/hyhyhy/structure/_includes/bootstrap/js/collapse.js +211 -0
  57. data/lib/hyhyhy/structure/_includes/bootstrap/js/dropdown.js +161 -0
  58. data/lib/hyhyhy/structure/_includes/bootstrap/js/modal.js +324 -0
  59. data/lib/hyhyhy/structure/_includes/bootstrap/js/popover.js +119 -0
  60. data/lib/hyhyhy/structure/_includes/bootstrap/js/scrollspy.js +175 -0
  61. data/lib/hyhyhy/structure/_includes/bootstrap/js/tab.js +153 -0
  62. data/lib/hyhyhy/structure/_includes/bootstrap/js/tooltip.js +478 -0
  63. data/lib/hyhyhy/structure/_includes/bootstrap/js/transition.js +59 -0
  64. data/lib/hyhyhy/structure/_includes/bootstrap/less/.csscomb.json +304 -0
  65. data/lib/hyhyhy/structure/_includes/bootstrap/less/.csslintrc +19 -0
  66. data/lib/hyhyhy/structure/_includes/bootstrap/less/alerts.less +68 -0
  67. data/lib/hyhyhy/structure/_includes/bootstrap/less/badges.less +61 -0
  68. data/lib/hyhyhy/structure/_includes/bootstrap/less/bootstrap.less +50 -0
  69. data/lib/hyhyhy/structure/_includes/bootstrap/less/breadcrumbs.less +26 -0
  70. data/lib/hyhyhy/structure/_includes/bootstrap/less/button-groups.less +243 -0
  71. data/lib/hyhyhy/structure/_includes/bootstrap/less/buttons.less +160 -0
  72. data/lib/hyhyhy/structure/_includes/bootstrap/less/carousel.less +267 -0
  73. data/lib/hyhyhy/structure/_includes/bootstrap/less/close.less +33 -0
  74. data/lib/hyhyhy/structure/_includes/bootstrap/less/code.less +69 -0
  75. data/lib/hyhyhy/structure/_includes/bootstrap/less/component-animations.less +34 -0
  76. data/lib/hyhyhy/structure/_includes/bootstrap/less/dropdowns.less +213 -0
  77. data/lib/hyhyhy/structure/_includes/bootstrap/less/forms.less +546 -0
  78. data/lib/hyhyhy/structure/_includes/bootstrap/less/glyphicons.less +234 -0
  79. data/lib/hyhyhy/structure/_includes/bootstrap/less/grid.less +84 -0
  80. data/lib/hyhyhy/structure/_includes/bootstrap/less/input-groups.less +166 -0
  81. data/lib/hyhyhy/structure/_includes/bootstrap/less/jumbotron.less +49 -0
  82. data/lib/hyhyhy/structure/_includes/bootstrap/less/labels.less +64 -0
  83. data/lib/hyhyhy/structure/_includes/bootstrap/less/list-group.less +124 -0
  84. data/lib/hyhyhy/structure/_includes/bootstrap/less/media.less +47 -0
  85. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins.less +39 -0
  86. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/alerts.less +14 -0
  87. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/background-variant.less +8 -0
  88. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/border-radius.less +18 -0
  89. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/buttons.less +52 -0
  90. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/center-block.less +7 -0
  91. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/clearfix.less +22 -0
  92. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/forms.less +85 -0
  93. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/gradients.less +59 -0
  94. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/grid-framework.less +91 -0
  95. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/grid.less +122 -0
  96. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/hide-text.less +21 -0
  97. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/image.less +33 -0
  98. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/labels.less +12 -0
  99. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/list-group.less +29 -0
  100. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/nav-divider.less +10 -0
  101. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/nav-vertical-align.less +9 -0
  102. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/opacity.less +8 -0
  103. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/pagination.less +23 -0
  104. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/panels.less +24 -0
  105. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/progress-bar.less +10 -0
  106. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/reset-filter.less +8 -0
  107. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/resize.less +6 -0
  108. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/responsive-visibility.less +15 -0
  109. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/size.less +10 -0
  110. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/tab-focus.less +9 -0
  111. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/table-row.less +28 -0
  112. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/text-emphasis.less +8 -0
  113. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/text-overflow.less +8 -0
  114. data/lib/hyhyhy/structure/_includes/bootstrap/less/mixins/vendor-prefixes.less +227 -0
  115. data/lib/hyhyhy/structure/_includes/bootstrap/less/modals.less +148 -0
  116. data/lib/hyhyhy/structure/_includes/bootstrap/less/navbar.less +660 -0
  117. data/lib/hyhyhy/structure/_includes/bootstrap/less/navs.less +244 -0
  118. data/lib/hyhyhy/structure/_includes/bootstrap/less/normalize.less +427 -0
  119. data/lib/hyhyhy/structure/_includes/bootstrap/less/pager.less +54 -0
  120. data/lib/hyhyhy/structure/_includes/bootstrap/less/pagination.less +88 -0
  121. data/lib/hyhyhy/structure/_includes/bootstrap/less/panels.less +261 -0
  122. data/lib/hyhyhy/structure/_includes/bootstrap/less/popovers.less +135 -0
  123. data/lib/hyhyhy/structure/_includes/bootstrap/less/print.less +107 -0
  124. data/lib/hyhyhy/structure/_includes/bootstrap/less/progress-bars.less +87 -0
  125. data/lib/hyhyhy/structure/_includes/bootstrap/less/responsive-embed.less +35 -0
  126. data/lib/hyhyhy/structure/_includes/bootstrap/less/responsive-utilities.less +194 -0
  127. data/lib/hyhyhy/structure/_includes/bootstrap/less/scaffolding.less +150 -0
  128. data/lib/hyhyhy/structure/_includes/bootstrap/less/tables.less +234 -0
  129. data/lib/hyhyhy/structure/_includes/bootstrap/less/theme.less +272 -0
  130. data/lib/hyhyhy/structure/_includes/bootstrap/less/thumbnails.less +36 -0
  131. data/lib/hyhyhy/structure/_includes/bootstrap/less/tooltip.less +103 -0
  132. data/lib/hyhyhy/structure/_includes/bootstrap/less/type.less +302 -0
  133. data/lib/hyhyhy/structure/_includes/bootstrap/less/utilities.less +56 -0
  134. data/lib/hyhyhy/structure/_includes/bootstrap/less/variables.less +856 -0
  135. data/lib/hyhyhy/structure/_includes/bootstrap/less/wells.less +29 -0
  136. data/lib/hyhyhy/structure/_includes/bootstrap/package.json +82 -0
  137. data/lib/hyhyhy/structure/_includes/bower.json +9 -0
  138. data/lib/hyhyhy/structure/_includes/d3/.bower.json +37 -0
  139. data/lib/hyhyhy/structure/_includes/d3/CONTRIBUTING.md +25 -0
  140. data/lib/hyhyhy/structure/_includes/d3/LICENSE +26 -0
  141. data/lib/hyhyhy/structure/_includes/d3/README.md +9 -0
  142. data/lib/hyhyhy/structure/_includes/d3/bower.json +26 -0
  143. data/lib/hyhyhy/structure/_includes/d3/d3.js +9470 -0
  144. data/lib/hyhyhy/structure/_includes/d3/d3.min.js +5 -0
  145. data/lib/hyhyhy/structure/_includes/jquery/.bower.json +38 -0
  146. data/lib/hyhyhy/structure/_includes/jquery/MIT-LICENSE.txt +21 -0
  147. data/lib/hyhyhy/structure/_includes/jquery/bower.json +27 -0
  148. data/lib/hyhyhy/structure/_includes/jquery/dist/jquery.js +9190 -0
  149. data/lib/hyhyhy/structure/_includes/jquery/dist/jquery.min.js +5 -0
  150. data/lib/hyhyhy/structure/_includes/jquery/dist/jquery.min.map +1 -0
  151. data/lib/hyhyhy/structure/_includes/jquery/src/ajax.js +806 -0
  152. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/jsonp.js +89 -0
  153. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/load.js +75 -0
  154. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/parseJSON.js +13 -0
  155. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/parseXML.js +28 -0
  156. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/script.js +64 -0
  157. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/var/nonce.js +5 -0
  158. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/var/rquery.js +3 -0
  159. data/lib/hyhyhy/structure/_includes/jquery/src/ajax/xhr.js +135 -0
  160. data/lib/hyhyhy/structure/_includes/jquery/src/attributes.js +11 -0
  161. data/lib/hyhyhy/structure/_includes/jquery/src/attributes/attr.js +143 -0
  162. data/lib/hyhyhy/structure/_includes/jquery/src/attributes/classes.js +158 -0
  163. data/lib/hyhyhy/structure/_includes/jquery/src/attributes/prop.js +96 -0
  164. data/lib/hyhyhy/structure/_includes/jquery/src/attributes/support.js +35 -0
  165. data/lib/hyhyhy/structure/_includes/jquery/src/attributes/val.js +163 -0
  166. data/lib/hyhyhy/structure/_includes/jquery/src/callbacks.js +205 -0
  167. data/lib/hyhyhy/structure/_includes/jquery/src/core.js +498 -0
  168. data/lib/hyhyhy/structure/_includes/jquery/src/core/access.js +60 -0
  169. data/lib/hyhyhy/structure/_includes/jquery/src/core/init.js +123 -0
  170. data/lib/hyhyhy/structure/_includes/jquery/src/core/parseHTML.js +39 -0
  171. data/lib/hyhyhy/structure/_includes/jquery/src/core/ready.js +97 -0
  172. data/lib/hyhyhy/structure/_includes/jquery/src/core/var/rsingleTag.js +4 -0
  173. data/lib/hyhyhy/structure/_includes/jquery/src/css.js +451 -0
  174. data/lib/hyhyhy/structure/_includes/jquery/src/css/addGetHookIf.js +24 -0
  175. data/lib/hyhyhy/structure/_includes/jquery/src/css/curCSS.js +57 -0
  176. data/lib/hyhyhy/structure/_includes/jquery/src/css/defaultDisplay.js +70 -0
  177. data/lib/hyhyhy/structure/_includes/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  178. data/lib/hyhyhy/structure/_includes/jquery/src/css/support.js +91 -0
  179. data/lib/hyhyhy/structure/_includes/jquery/src/css/swap.js +28 -0
  180. data/lib/hyhyhy/structure/_includes/jquery/src/css/var/cssExpand.js +3 -0
  181. data/lib/hyhyhy/structure/_includes/jquery/src/css/var/getStyles.js +5 -0
  182. data/lib/hyhyhy/structure/_includes/jquery/src/css/var/isHidden.js +13 -0
  183. data/lib/hyhyhy/structure/_includes/jquery/src/css/var/rmargin.js +3 -0
  184. data/lib/hyhyhy/structure/_includes/jquery/src/css/var/rnumnonpx.js +5 -0
  185. data/lib/hyhyhy/structure/_includes/jquery/src/data.js +179 -0
  186. data/lib/hyhyhy/structure/_includes/jquery/src/data/Data.js +181 -0
  187. data/lib/hyhyhy/structure/_includes/jquery/src/data/accepts.js +20 -0
  188. data/lib/hyhyhy/structure/_includes/jquery/src/data/var/data_priv.js +5 -0
  189. data/lib/hyhyhy/structure/_includes/jquery/src/data/var/data_user.js +5 -0
  190. data/lib/hyhyhy/structure/_includes/jquery/src/deferred.js +149 -0
  191. data/lib/hyhyhy/structure/_includes/jquery/src/deprecated.js +13 -0
  192. data/lib/hyhyhy/structure/_includes/jquery/src/dimensions.js +50 -0
  193. data/lib/hyhyhy/structure/_includes/jquery/src/effects.js +649 -0
  194. data/lib/hyhyhy/structure/_includes/jquery/src/effects/Tween.js +114 -0
  195. data/lib/hyhyhy/structure/_includes/jquery/src/effects/animatedSelector.js +13 -0
  196. data/lib/hyhyhy/structure/_includes/jquery/src/event.js +868 -0
  197. data/lib/hyhyhy/structure/_includes/jquery/src/event/alias.js +39 -0
  198. data/lib/hyhyhy/structure/_includes/jquery/src/event/support.js +9 -0
  199. data/lib/hyhyhy/structure/_includes/jquery/src/exports/amd.js +24 -0
  200. data/lib/hyhyhy/structure/_includes/jquery/src/exports/global.js +32 -0
  201. data/lib/hyhyhy/structure/_includes/jquery/src/intro.js +44 -0
  202. data/lib/hyhyhy/structure/_includes/jquery/src/jquery.js +36 -0
  203. data/lib/hyhyhy/structure/_includes/jquery/src/manipulation.js +582 -0
  204. data/lib/hyhyhy/structure/_includes/jquery/src/manipulation/_evalUrl.js +18 -0
  205. data/lib/hyhyhy/structure/_includes/jquery/src/manipulation/support.js +31 -0
  206. data/lib/hyhyhy/structure/_includes/jquery/src/manipulation/var/rcheckableType.js +3 -0
  207. data/lib/hyhyhy/structure/_includes/jquery/src/offset.js +204 -0
  208. data/lib/hyhyhy/structure/_includes/jquery/src/outro.js +1 -0
  209. data/lib/hyhyhy/structure/_includes/jquery/src/queue.js +142 -0
  210. data/lib/hyhyhy/structure/_includes/jquery/src/queue/delay.js +22 -0
  211. data/lib/hyhyhy/structure/_includes/jquery/src/selector-native.js +172 -0
  212. data/lib/hyhyhy/structure/_includes/jquery/src/selector-sizzle.js +14 -0
  213. data/lib/hyhyhy/structure/_includes/jquery/src/selector.js +1 -0
  214. data/lib/hyhyhy/structure/_includes/jquery/src/serialize.js +111 -0
  215. data/lib/hyhyhy/structure/_includes/jquery/src/sizzle/dist/sizzle.js +2044 -0
  216. data/lib/hyhyhy/structure/_includes/jquery/src/sizzle/dist/sizzle.min.js +3 -0
  217. data/lib/hyhyhy/structure/_includes/jquery/src/sizzle/dist/sizzle.min.map +1 -0
  218. data/lib/hyhyhy/structure/_includes/jquery/src/traversing.js +200 -0
  219. data/lib/hyhyhy/structure/_includes/jquery/src/traversing/findFilter.js +100 -0
  220. data/lib/hyhyhy/structure/_includes/jquery/src/traversing/var/rneedsContext.js +6 -0
  221. data/lib/hyhyhy/structure/_includes/jquery/src/var/arr.js +3 -0
  222. data/lib/hyhyhy/structure/_includes/jquery/src/var/class2type.js +4 -0
  223. data/lib/hyhyhy/structure/_includes/jquery/src/var/concat.js +5 -0
  224. data/lib/hyhyhy/structure/_includes/jquery/src/var/hasOwn.js +5 -0
  225. data/lib/hyhyhy/structure/_includes/jquery/src/var/indexOf.js +5 -0
  226. data/lib/hyhyhy/structure/_includes/jquery/src/var/pnum.js +3 -0
  227. data/lib/hyhyhy/structure/_includes/jquery/src/var/push.js +5 -0
  228. data/lib/hyhyhy/structure/_includes/jquery/src/var/rnotwhite.js +3 -0
  229. data/lib/hyhyhy/structure/_includes/jquery/src/var/slice.js +5 -0
  230. data/lib/hyhyhy/structure/_includes/jquery/src/var/strundefined.js +3 -0
  231. data/lib/hyhyhy/structure/_includes/jquery/src/var/support.js +4 -0
  232. data/lib/hyhyhy/structure/_includes/jquery/src/var/toString.js +5 -0
  233. data/lib/hyhyhy/structure/_includes/jquery/src/wrap.js +78 -0
  234. data/lib/hyhyhy/structure/_includes/katex/.arcconfig +4 -0
  235. data/lib/hyhyhy/structure/_includes/katex/.bower.json +14 -0
  236. data/lib/hyhyhy/structure/_includes/katex/.gitignore +5 -0
  237. data/lib/hyhyhy/structure/_includes/katex/.hyhyhy +10 -0
  238. data/lib/hyhyhy/structure/_includes/katex/.jshintrc +67 -0
  239. data/lib/hyhyhy/structure/_includes/katex/.travis.yml +4 -0
  240. data/lib/hyhyhy/structure/_includes/katex/CONTRIBUTING.md +112 -0
  241. data/lib/hyhyhy/structure/_includes/katex/LICENSE.txt +21 -0
  242. data/lib/hyhyhy/structure/_includes/katex/Makefile +61 -0
  243. data/lib/hyhyhy/structure/_includes/katex/README.md +50 -0
  244. data/lib/hyhyhy/structure/_includes/katex/cli.js +15 -0
  245. data/lib/hyhyhy/structure/_includes/katex/dockers/HuxleyTests/Dockerfile +13 -0
  246. data/lib/hyhyhy/structure/_includes/katex/dockers/HuxleyTests/README.md +29 -0
  247. data/lib/hyhyhy/structure/_includes/katex/dockers/MathJaxFonts/Dockerfile +34 -0
  248. data/lib/hyhyhy/structure/_includes/katex/dockers/MathJaxFonts/README.md +55 -0
  249. data/lib/hyhyhy/structure/_includes/katex/dockers/MathJaxFonts/copy_fonts.sh +47 -0
  250. data/lib/hyhyhy/structure/_includes/katex/katex.js +54 -0
  251. data/lib/hyhyhy/structure/_includes/katex/lint_blacklist.txt +8 -0
  252. data/lib/hyhyhy/structure/_includes/katex/metrics/README.md +21 -0
  253. data/lib/hyhyhy/structure/_includes/katex/metrics/extract_tfms.py +94 -0
  254. data/lib/hyhyhy/structure/_includes/katex/metrics/extract_ttfs.py +75 -0
  255. data/lib/hyhyhy/structure/_includes/katex/metrics/mapping.pl +997 -0
  256. data/lib/hyhyhy/structure/_includes/katex/metrics/parse_tfm.py +201 -0
  257. data/lib/hyhyhy/structure/_includes/katex/metrics/replace_line.py +17 -0
  258. data/lib/hyhyhy/structure/_includes/katex/package.json +30 -0
  259. data/lib/hyhyhy/structure/_includes/katex/server.js +77 -0
  260. data/lib/hyhyhy/structure/_includes/katex/src/Lexer.js +190 -0
  261. data/lib/hyhyhy/structure/_includes/katex/src/Options.js +85 -0
  262. data/lib/hyhyhy/structure/_includes/katex/src/ParseError.js +40 -0
  263. data/lib/hyhyhy/structure/_includes/katex/src/Parser.js +639 -0
  264. data/lib/hyhyhy/structure/_includes/katex/src/Style.js +126 -0
  265. data/lib/hyhyhy/structure/_includes/katex/src/buildCommon.js +271 -0
  266. data/lib/hyhyhy/structure/_includes/katex/src/buildTree.js +1167 -0
  267. data/lib/hyhyhy/structure/_includes/katex/src/delimiter.js +541 -0
  268. data/lib/hyhyhy/structure/_includes/katex/src/domTree.js +241 -0
  269. data/lib/hyhyhy/structure/_includes/katex/src/fontMetrics.js +129 -0
  270. data/lib/hyhyhy/structure/_includes/katex/src/functions.js +539 -0
  271. data/lib/hyhyhy/structure/_includes/katex/src/parseTree.js +17 -0
  272. data/lib/hyhyhy/structure/_includes/katex/src/symbols.js +1006 -0
  273. data/lib/hyhyhy/structure/_includes/katex/src/utils.js +97 -0
  274. data/lib/hyhyhy/structure/_includes/katex/static/fonts.less +73 -0
  275. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_AMS-Regular.eot +0 -0
  276. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_AMS-Regular.ttf +0 -0
  277. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_AMS-Regular.woff +0 -0
  278. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  279. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Bold.eot +0 -0
  280. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  281. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  282. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  283. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Regular.eot +0 -0
  284. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  285. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  286. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  287. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Bold.eot +0 -0
  288. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  289. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  290. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  291. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Regular.eot +0 -0
  292. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  293. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  294. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  295. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Greek-Bold.woff2 +0 -0
  296. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Greek-BoldItalic.woff2 +0 -0
  297. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Greek-Italic.woff2 +0 -0
  298. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Greek-Regular.woff2 +0 -0
  299. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Bold.eot +0 -0
  300. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Bold.ttf +0 -0
  301. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Bold.woff +0 -0
  302. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Bold.woff2 +0 -0
  303. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Italic.eot +0 -0
  304. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Italic.ttf +0 -0
  305. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Italic.woff +0 -0
  306. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Italic.woff2 +0 -0
  307. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Regular.eot +0 -0
  308. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Regular.ttf +0 -0
  309. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Regular.woff +0 -0
  310. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Main-Regular.woff2 +0 -0
  311. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-BoldItalic.eot +0 -0
  312. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  313. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  314. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  315. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Italic.eot +0 -0
  316. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Italic.ttf +0 -0
  317. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Italic.woff +0 -0
  318. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Italic.woff2 +0 -0
  319. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Regular.eot +0 -0
  320. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Regular.ttf +0 -0
  321. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Regular.woff +0 -0
  322. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Math-Regular.woff2 +0 -0
  323. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Bold.eot +0 -0
  324. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  325. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  326. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  327. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Italic.eot +0 -0
  328. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  329. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  330. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  331. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Regular.eot +0 -0
  332. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  333. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  334. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  335. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Script-Regular.eot +0 -0
  336. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Script-Regular.ttf +0 -0
  337. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Script-Regular.woff +0 -0
  338. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Script-Regular.woff2 +0 -0
  339. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size1-Regular.eot +0 -0
  340. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size1-Regular.ttf +0 -0
  341. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size1-Regular.woff +0 -0
  342. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  343. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size2-Regular.eot +0 -0
  344. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size2-Regular.ttf +0 -0
  345. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size2-Regular.woff +0 -0
  346. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  347. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size3-Regular.eot +0 -0
  348. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size3-Regular.ttf +0 -0
  349. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size3-Regular.woff +0 -0
  350. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  351. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size4-Regular.eot +0 -0
  352. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size4-Regular.ttf +0 -0
  353. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size4-Regular.woff +0 -0
  354. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  355. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Typewriter-Regular.eot +0 -0
  356. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  357. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  358. data/lib/hyhyhy/structure/_includes/katex/static/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  359. data/lib/hyhyhy/structure/_includes/katex/static/index.html +17 -0
  360. data/lib/hyhyhy/structure/_includes/katex/static/katex.less +430 -0
  361. data/lib/hyhyhy/structure/_includes/katex/static/main.css +12 -0
  362. data/lib/hyhyhy/structure/_includes/katex/static/main.js +42 -0
  363. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfile.json +199 -0
  364. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Accents.hux/firefox-1.png +0 -0
  365. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Accents.record.json +5 -0
  366. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Baseline.hux/firefox-1.png +0 -0
  367. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Baseline.record.json +5 -0
  368. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/BasicTest.hux/firefox-1.png +0 -0
  369. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/BasicTest.record.json +5 -0
  370. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/BinomTest.hux/firefox-1.png +0 -0
  371. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/BinomTest.record.json +5 -0
  372. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Colors.hux/firefox-1.png +0 -0
  373. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Colors.record.json +5 -0
  374. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/DeepFontSizing.hux/firefox-1.png +0 -0
  375. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/DeepFontSizing.record.json +5 -0
  376. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/DelimiterSizing.hux/firefox-1.png +0 -0
  377. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/DelimiterSizing.record.json +5 -0
  378. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/DisplayStyle.hux/firefox-1.png +0 -0
  379. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/DisplayStyle.record.json +5 -0
  380. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Exponents.hux/firefox-1.png +0 -0
  381. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Exponents.record.json +5 -0
  382. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/FractionTest.hux/firefox-1.png +0 -0
  383. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/FractionTest.record.json +5 -0
  384. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Functions.hux/firefox-1.png +0 -0
  385. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Functions.record.json +5 -0
  386. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/GreekLetters.hux/firefox-1.png +0 -0
  387. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/GreekLetters.record.json +5 -0
  388. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/KaTeX.hux/firefox-1.png +0 -0
  389. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/KaTeX.record.json +5 -0
  390. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Lap.hux/firefox-1.png +0 -0
  391. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Lap.record.json +5 -0
  392. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/LeftRight.hux/firefox-1.png +0 -0
  393. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/LeftRight.record.json +5 -0
  394. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/LeftRightListStyling.hux/firefox-1.png +0 -0
  395. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/LeftRightListStyling.record.json +5 -0
  396. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/LeftRightStyleSizing.hux/firefox-1.png +0 -0
  397. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/LeftRightStyleSizing.record.json +5 -0
  398. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/NestedFractions.hux/firefox-1.png +0 -0
  399. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/NestedFractions.record.json +5 -0
  400. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/NullDelimiterInteraction.hux/firefox-1.png +0 -0
  401. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/NullDelimiterInteraction.record.json +5 -0
  402. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/OpLimits.hux/firefox-1.png +0 -0
  403. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/OpLimits.record.json +5 -0
  404. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Overline.hux/firefox-1.png +0 -0
  405. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Overline.record.json +5 -0
  406. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/PrimeSpacing.hux/firefox-1.png +0 -0
  407. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/PrimeSpacing.record.json +5 -0
  408. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/RlapBug.hux/firefox-1.png +0 -0
  409. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/RlapBug.record.json +5 -0
  410. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Rule.hux/firefox-1.png +0 -0
  411. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Rule.record.json +5 -0
  412. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Sizing.hux/firefox-1.png +0 -0
  413. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Sizing.record.json +5 -0
  414. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SizingBaseline.hux/firefox-1.png +0 -0
  415. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SizingBaseline.record.json +5 -0
  416. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Spacing.hux/firefox-1.png +0 -0
  417. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Spacing.record.json +5 -0
  418. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Sqrt.hux/firefox-1.png +0 -0
  419. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Sqrt.record.json +5 -0
  420. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SupSubCharacterBox.hux/firefox-1.png +0 -0
  421. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SupSubCharacterBox.record.json +5 -0
  422. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SupSubHorizSpacing.hux/firefox-1.png +0 -0
  423. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SupSubHorizSpacing.record.json +5 -0
  424. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SupSubOffsets.hux/firefox-1.png +0 -0
  425. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/SupSubOffsets.record.json +5 -0
  426. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Text.hux/firefox-1.png +0 -0
  427. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/Text.record.json +5 -0
  428. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/VerticalSpacing.hux/firefox-1.png +0 -0
  429. data/lib/hyhyhy/structure/_includes/katex/test/huxley/Huxleyfolder/VerticalSpacing.record.json +5 -0
  430. data/lib/hyhyhy/structure/_includes/katex/test/huxley/test.html +30 -0
  431. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/MIT.LICENSE +20 -0
  432. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/boot.js +120 -0
  433. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/console.js +166 -0
  434. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/jasmine-html.js +390 -0
  435. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/jasmine.css +61 -0
  436. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/jasmine.js +2593 -0
  437. data/lib/hyhyhy/structure/_includes/katex/test/jasmine/jasmine_favicon.png +0 -0
  438. data/lib/hyhyhy/structure/_includes/katex/test/katex-spec.js +1179 -0
  439. data/lib/hyhyhy/structure/_includes/katex/test/test.html +12 -0
  440. data/lib/hyhyhy/structure/_includes/metrics-graphics/.bower.json +61 -0
  441. data/lib/hyhyhy/structure/_includes/metrics-graphics/.hyhyhy +17 -0
  442. data/lib/hyhyhy/structure/_includes/metrics-graphics/LICENSE +362 -0
  443. data/lib/hyhyhy/structure/_includes/metrics-graphics/README.md +70 -0
  444. data/lib/hyhyhy/structure/_includes/metrics-graphics/bower.json +50 -0
  445. data/lib/hyhyhy/structure/_includes/metrics-graphics/css/metricsgraphics-demo-dark.css +640 -0
  446. data/lib/hyhyhy/structure/_includes/metrics-graphics/css/metricsgraphics-demo.css +176 -0
  447. data/lib/hyhyhy/structure/_includes/metrics-graphics/css/metricsgraphics.css +344 -0
  448. data/lib/hyhyhy/structure/_includes/metrics-graphics/images/missing-data-dark.png +0 -0
  449. data/lib/hyhyhy/structure/_includes/metrics-graphics/images/missing-data.png +0 -0
  450. data/lib/hyhyhy/structure/_includes/metrics-graphics/js/metricsgraphics.min.js +590 -0
  451. data/lib/hyhyhy/structure/_includes/metrics-graphics/package.json +35 -0
  452. data/lib/hyhyhy/structure/_includes/prism/.bower.json +34 -0
  453. data/lib/hyhyhy/structure/_includes/prism/.hyhyhy +33 -0
  454. data/lib/hyhyhy/structure/_includes/prism/LICENSE +21 -0
  455. data/lib/hyhyhy/structure/_includes/prism/README.md +22 -0
  456. data/lib/hyhyhy/structure/_includes/prism/bower.json +26 -0
  457. data/lib/hyhyhy/structure/_includes/prism/components.js +233 -0
  458. data/lib/hyhyhy/structure/_includes/prism/components/prism-apacheconf.js +46 -0
  459. data/lib/hyhyhy/structure/_includes/prism/components/prism-apacheconf.min.js +1 -0
  460. data/lib/hyhyhy/structure/_includes/prism/components/prism-aspnet.js +49 -0
  461. data/lib/hyhyhy/structure/_includes/prism/components/prism-aspnet.min.js +1 -0
  462. data/lib/hyhyhy/structure/_includes/prism/components/prism-autohotkey.js +27 -0
  463. data/lib/hyhyhy/structure/_includes/prism/components/prism-autohotkey.min.js +1 -0
  464. data/lib/hyhyhy/structure/_includes/prism/components/prism-bash.js +24 -0
  465. data/lib/hyhyhy/structure/_includes/prism/components/prism-bash.min.js +1 -0
  466. data/lib/hyhyhy/structure/_includes/prism/components/prism-c.js +26 -0
  467. data/lib/hyhyhy/structure/_includes/prism/components/prism-c.min.js +1 -0
  468. data/lib/hyhyhy/structure/_includes/prism/components/prism-clike.js +32 -0
  469. data/lib/hyhyhy/structure/_includes/prism/components/prism-clike.min.js +1 -0
  470. data/lib/hyhyhy/structure/_includes/prism/components/prism-coffeescript.js +18 -0
  471. data/lib/hyhyhy/structure/_includes/prism/components/prism-coffeescript.min.js +1 -0
  472. data/lib/hyhyhy/structure/_includes/prism/components/prism-core.js +424 -0
  473. data/lib/hyhyhy/structure/_includes/prism/components/prism-core.min.js +1 -0
  474. data/lib/hyhyhy/structure/_includes/prism/components/prism-cpp.js +12 -0
  475. data/lib/hyhyhy/structure/_includes/prism/components/prism-cpp.min.js +1 -0
  476. data/lib/hyhyhy/structure/_includes/prism/components/prism-csharp.js +6 -0
  477. data/lib/hyhyhy/structure/_includes/prism/components/prism-csharp.min.js +1 -0
  478. data/lib/hyhyhy/structure/_includes/prism/components/prism-css-extras.js +15 -0
  479. data/lib/hyhyhy/structure/_includes/prism/components/prism-css-extras.min.js +1 -0
  480. data/lib/hyhyhy/structure/_includes/prism/components/prism-css.js +50 -0
  481. data/lib/hyhyhy/structure/_includes/prism/components/prism-css.min.js +1 -0
  482. data/lib/hyhyhy/structure/_includes/prism/components/prism-gherkin.js +13 -0
  483. data/lib/hyhyhy/structure/_includes/prism/components/prism-gherkin.min.js +1 -0
  484. data/lib/hyhyhy/structure/_includes/prism/components/prism-git.js +68 -0
  485. data/lib/hyhyhy/structure/_includes/prism/components/prism-git.min.js +1 -0
  486. data/lib/hyhyhy/structure/_includes/prism/components/prism-go.js +9 -0
  487. data/lib/hyhyhy/structure/_includes/prism/components/prism-go.min.js +1 -0
  488. data/lib/hyhyhy/structure/_includes/prism/components/prism-groovy.js +43 -0
  489. data/lib/hyhyhy/structure/_includes/prism/components/prism-groovy.min.js +1 -0
  490. data/lib/hyhyhy/structure/_includes/prism/components/prism-handlebars.js +92 -0
  491. data/lib/hyhyhy/structure/_includes/prism/components/prism-handlebars.min.js +1 -0
  492. data/lib/hyhyhy/structure/_includes/prism/components/prism-haskell.js +32 -0
  493. data/lib/hyhyhy/structure/_includes/prism/components/prism-haskell.min.js +1 -0
  494. data/lib/hyhyhy/structure/_includes/prism/components/prism-http.js +44 -0
  495. data/lib/hyhyhy/structure/_includes/prism/components/prism-http.min.js +1 -0
  496. data/lib/hyhyhy/structure/_includes/prism/components/prism-ini.js +11 -0
  497. data/lib/hyhyhy/structure/_includes/prism/components/prism-ini.min.js +1 -0
  498. data/lib/hyhyhy/structure/_includes/prism/components/prism-java.js +8 -0
  499. data/lib/hyhyhy/structure/_includes/prism/components/prism-java.min.js +1 -0
  500. data/lib/hyhyhy/structure/_includes/prism/components/prism-javascript.js +27 -0
  501. data/lib/hyhyhy/structure/_includes/prism/components/prism-javascript.min.js +1 -0
  502. data/lib/hyhyhy/structure/_includes/prism/components/prism-latex.js +6 -0
  503. data/lib/hyhyhy/structure/_includes/prism/components/prism-latex.min.js +1 -0
  504. data/lib/hyhyhy/structure/_includes/prism/components/prism-markup.js +41 -0
  505. data/lib/hyhyhy/structure/_includes/prism/components/prism-markup.min.js +1 -0
  506. data/lib/hyhyhy/structure/_includes/prism/components/prism-nasm.js +20 -0
  507. data/lib/hyhyhy/structure/_includes/prism/components/prism-nasm.min.js +1 -0
  508. data/lib/hyhyhy/structure/_includes/prism/components/prism-nsis.js +19 -0
  509. data/lib/hyhyhy/structure/_includes/prism/components/prism-nsis.min.js +5 -0
  510. data/lib/hyhyhy/structure/_includes/prism/components/prism-objectivec.js +5 -0
  511. data/lib/hyhyhy/structure/_includes/prism/components/prism-objectivec.min.js +1 -0
  512. data/lib/hyhyhy/structure/_includes/prism/components/prism-perl.js +112 -0
  513. data/lib/hyhyhy/structure/_includes/prism/components/prism-perl.min.js +1 -0
  514. data/lib/hyhyhy/structure/_includes/prism/components/prism-php-extras.js +11 -0
  515. data/lib/hyhyhy/structure/_includes/prism/components/prism-php-extras.min.js +1 -0
  516. data/lib/hyhyhy/structure/_includes/prism/components/prism-php.js +99 -0
  517. data/lib/hyhyhy/structure/_includes/prism/components/prism-php.min.js +1 -0
  518. data/lib/hyhyhy/structure/_includes/prism/components/prism-python.js +14 -0
  519. data/lib/hyhyhy/structure/_includes/prism/components/prism-python.min.js +1 -0
  520. data/lib/hyhyhy/structure/_includes/prism/components/prism-rip.js +29 -0
  521. data/lib/hyhyhy/structure/_includes/prism/components/prism-rip.min.js +1 -0
  522. data/lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js +21 -0
  523. data/lib/hyhyhy/structure/_includes/prism/components/prism-ruby.min.js +1 -0
  524. data/lib/hyhyhy/structure/_includes/prism/components/prism-scala.js +8 -0
  525. data/lib/hyhyhy/structure/_includes/prism/components/prism-scala.min.js +1 -0
  526. data/lib/hyhyhy/structure/_includes/prism/components/prism-scheme-min.js +1 -0
  527. data/lib/hyhyhy/structure/_includes/prism/components/prism-scheme.js +24 -0
  528. data/lib/hyhyhy/structure/_includes/prism/components/prism-scss.js +36 -0
  529. data/lib/hyhyhy/structure/_includes/prism/components/prism-scss.min.js +1 -0
  530. data/lib/hyhyhy/structure/_includes/prism/components/prism-sql.js +17 -0
  531. data/lib/hyhyhy/structure/_includes/prism/components/prism-sql.min.js +1 -0
  532. data/lib/hyhyhy/structure/_includes/prism/components/prism-swift.js +8 -0
  533. data/lib/hyhyhy/structure/_includes/prism/components/prism-swift.min.js +1 -0
  534. data/lib/hyhyhy/structure/_includes/prism/components/prism-twig.js +46 -0
  535. data/lib/hyhyhy/structure/_includes/prism/components/prism-twig.min.js +1 -0
  536. data/lib/hyhyhy/structure/_includes/prism/gulpfile.js +48 -0
  537. data/lib/hyhyhy/structure/_includes/prism/package.json +27 -0
  538. data/lib/hyhyhy/structure/_includes/prism/plugins/autolinker/prism-autolinker.css +3 -0
  539. data/lib/hyhyhy/structure/_includes/prism/plugins/autolinker/prism-autolinker.js +66 -0
  540. data/lib/hyhyhy/structure/_includes/prism/plugins/autolinker/prism-autolinker.min.js +1 -0
  541. data/lib/hyhyhy/structure/_includes/prism/plugins/file-highlight/prism-file-highlight.js +54 -0
  542. data/lib/hyhyhy/structure/_includes/prism/plugins/file-highlight/prism-file-highlight.min.js +1 -0
  543. data/lib/hyhyhy/structure/_includes/prism/plugins/ie8/prism-ie8.css +3 -0
  544. data/lib/hyhyhy/structure/_includes/prism/plugins/ie8/prism-ie8.js +42 -0
  545. data/lib/hyhyhy/structure/_includes/prism/plugins/ie8/prism-ie8.min.js +1 -0
  546. data/lib/hyhyhy/structure/_includes/prism/plugins/line-highlight/prism-line-highlight.css +47 -0
  547. data/lib/hyhyhy/structure/_includes/prism/plugins/line-highlight/prism-line-highlight.js +109 -0
  548. data/lib/hyhyhy/structure/_includes/prism/plugins/line-highlight/prism-line-highlight.min.js +1 -0
  549. data/lib/hyhyhy/structure/_includes/prism/plugins/line-numbers/prism-line-numbers.css +40 -0
  550. data/lib/hyhyhy/structure/_includes/prism/plugins/line-numbers/prism-line-numbers.js +24 -0
  551. data/lib/hyhyhy/structure/_includes/prism/plugins/line-numbers/prism-line-numbers.min.js +1 -0
  552. data/lib/hyhyhy/structure/_includes/prism/plugins/show-invisibles/prism-show-invisibles.css +17 -0
  553. data/lib/hyhyhy/structure/_includes/prism/plugins/show-invisibles/prism-show-invisibles.js +15 -0
  554. data/lib/hyhyhy/structure/_includes/prism/plugins/show-invisibles/prism-show-invisibles.min.js +1 -0
  555. data/lib/hyhyhy/structure/_includes/prism/plugins/show-language/prism-show-language.css +21 -0
  556. data/lib/hyhyhy/structure/_includes/prism/plugins/show-language/prism-show-language.js +16 -0
  557. data/lib/hyhyhy/structure/_includes/prism/plugins/show-language/prism-show-language.min.css +1 -0
  558. data/lib/hyhyhy/structure/_includes/prism/plugins/show-language/prism-show-language.min.js +1 -0
  559. data/lib/hyhyhy/structure/_includes/prism/plugins/wpd/prism-wpd.css +11 -0
  560. data/lib/hyhyhy/structure/_includes/prism/plugins/wpd/prism-wpd.js +163 -0
  561. data/lib/hyhyhy/structure/_includes/prism/plugins/wpd/prism-wpd.min.js +1 -0
  562. data/lib/hyhyhy/structure/_includes/prism/prism.js +662 -0
  563. data/lib/hyhyhy/structure/_includes/prism/themes/prism-coy.css +210 -0
  564. data/lib/hyhyhy/structure/_includes/prism/themes/prism-dark.css +122 -0
  565. data/lib/hyhyhy/structure/_includes/prism/themes/prism-funky.css +111 -0
  566. data/lib/hyhyhy/structure/_includes/prism/themes/prism-okaidia.css +114 -0
  567. data/lib/hyhyhy/structure/_includes/prism/themes/prism-tomorrow.css +115 -0
  568. data/lib/hyhyhy/structure/_includes/prism/themes/prism-twilight.css +195 -0
  569. data/lib/hyhyhy/structure/_includes/prism/themes/prism.css +131 -0
  570. data/lib/hyhyhy/structure/_includes/prism/vendor/promise.js +5 -0
  571. data/lib/hyhyhy/structure/_layouts/default.erb +41 -0
  572. data/lib/hyhyhy/structure/_slides/1.introduction.md +36 -0
  573. data/lib/hyhyhy/structure/_slides/2.packages.md +52 -0
  574. data/lib/hyhyhy/structure/_slides/3.usage.md +146 -0
  575. data/lib/hyhyhy/version.rb +5 -0
  576. metadata +747 -0
@@ -0,0 +1,1179 @@
1
+ var katex = require("../katex");
2
+ var buildTree = require("../src/buildTree");
3
+ var parseTree = require("../src/parseTree");
4
+ var ParseError = require("../src/ParseError");
5
+
6
+ var getBuilt = function(expr) {
7
+ expect(expr).toBuild();
8
+
9
+ var built = buildTree(parseTree(expr));
10
+
11
+ // Remove the outer .katex and .katex-inner layers
12
+ return built.children[0].children[2].children;
13
+ };
14
+
15
+ beforeEach(function() {
16
+ jasmine.addMatchers({
17
+ toParse: function() {
18
+ return {
19
+ compare: function(actual) {
20
+ var result = {
21
+ pass: true,
22
+ message: "'" + actual + "' succeeded parsing"
23
+ };
24
+
25
+ try {
26
+ parseTree(actual);
27
+ } catch (e) {
28
+ result.pass = false;
29
+ if (e instanceof ParseError) {
30
+ result.message = "'" + actual + "' failed " +
31
+ "parsing with error: " + e.message;
32
+ } else {
33
+ result.message = "'" + actual + "' failed " +
34
+ "parsing with unknown error: " + e.message;
35
+ }
36
+ }
37
+
38
+ return result;
39
+ }
40
+ };
41
+ },
42
+
43
+ toNotParse: function() {
44
+ return {
45
+ compare: function(actual) {
46
+ var result = {
47
+ pass: false,
48
+ message: "Expected '" + actual + "' to fail " +
49
+ "parsing, but it succeeded"
50
+ };
51
+
52
+ try {
53
+ parseTree(actual);
54
+ } catch (e) {
55
+ if (e instanceof ParseError) {
56
+ result.pass = true;
57
+ result.message = "'" + actual + "' correctly " +
58
+ "didn't parse with error: " + e.message;
59
+ } else {
60
+ result.message = "'" + actual + "' failed " +
61
+ "parsing with unknown error: " + e.message;
62
+ }
63
+ }
64
+
65
+ return result;
66
+ }
67
+ };
68
+ },
69
+
70
+ toBuild: function() {
71
+ return {
72
+ compare: function(actual) {
73
+ var result = {
74
+ pass: true,
75
+ message: "'" + actual + "' succeeded in building"
76
+ };
77
+
78
+ expect(actual).toParse();
79
+
80
+ try {
81
+ buildTree(parseTree(actual));
82
+ } catch (e) {
83
+ result.pass = false;
84
+ if (e instanceof ParseError) {
85
+ result.message = "'" + actual + "' failed to " +
86
+ "build with error: " + e.message;
87
+ } else {
88
+ result.message = "'" + actual + "' failed " +
89
+ "building with unknown error: " + e.message;
90
+ }
91
+ }
92
+
93
+ return result;
94
+ }
95
+ };
96
+ }
97
+ });
98
+ });
99
+
100
+ describe("A parser", function() {
101
+ it("should not fail on an empty string", function() {
102
+ expect("").toParse();
103
+ });
104
+
105
+ it("should ignore whitespace", function() {
106
+ var parseA = parseTree(" x y ");
107
+ var parseB = parseTree("xy");
108
+ expect(parseA).toEqual(parseB);
109
+ });
110
+ });
111
+
112
+ describe("An ord parser", function() {
113
+ var expression = "1234|/@.\"`abcdefgzABCDEFGZ";
114
+
115
+ it("should not fail", function() {
116
+ expect(expression).toParse();
117
+ });
118
+
119
+ it("should build a list of ords", function() {
120
+ var parse = parseTree(expression);
121
+
122
+ expect(parse).toBeTruthy();
123
+
124
+ for (var i = 0; i < parse.length; i++) {
125
+ var group = parse[i];
126
+ expect(group.type).toMatch("ord");
127
+ }
128
+ });
129
+
130
+ it("should parse the right number of ords", function() {
131
+ var parse = parseTree(expression);
132
+
133
+ expect(parse.length).toBe(expression.length);
134
+ });
135
+ });
136
+
137
+ describe("A bin parser", function() {
138
+ var expression = "+-*\\cdot\\pm\\div";
139
+
140
+ it("should not fail", function() {
141
+ expect(expression).toParse();
142
+ });
143
+
144
+ it("should build a list of bins", function() {
145
+ var parse = parseTree(expression);
146
+ expect(parse).toBeTruthy();
147
+
148
+ for (var i = 0; i < parse.length; i++) {
149
+ var group = parse[i];
150
+ expect(group.type).toMatch("bin");
151
+ }
152
+ });
153
+ });
154
+
155
+ describe("A rel parser", function() {
156
+ var expression = "=<>\\leq\\geq\\neq\\nleq\\ngeq\\cong";
157
+
158
+ it("should not fail", function() {
159
+ expect(expression).toParse();
160
+ });
161
+
162
+ it("should build a list of rels", function() {
163
+ var parse = parseTree(expression);
164
+ expect(parse).toBeTruthy();
165
+
166
+ for (var i = 0; i < parse.length; i++) {
167
+ var group = parse[i];
168
+ expect(group.type).toMatch("rel");
169
+ }
170
+ });
171
+ });
172
+
173
+ describe("A punct parser", function() {
174
+ var expression = ",;\\colon";
175
+
176
+ it("should not fail", function() {
177
+ expect(expression).toParse();
178
+ });
179
+
180
+ it("should build a list of puncts", function() {
181
+ var parse = parseTree(expression);
182
+ expect(parse).toBeTruthy();
183
+
184
+ for (var i = 0; i < parse.length; i++) {
185
+ var group = parse[i];
186
+ expect(group.type).toMatch("punct");
187
+ }
188
+ });
189
+ });
190
+
191
+ describe("An open parser", function() {
192
+ var expression = "([";
193
+
194
+ it("should not fail", function() {
195
+ expect(expression).toParse();
196
+ });
197
+
198
+ it("should build a list of opens", function() {
199
+ var parse = parseTree(expression);
200
+ expect(parse).toBeTruthy();
201
+
202
+ for (var i = 0; i < parse.length; i++) {
203
+ var group = parse[i];
204
+ expect(group.type).toMatch("open");
205
+ }
206
+ });
207
+ });
208
+
209
+ describe("A close parser", function() {
210
+ var expression = ")]?!";
211
+
212
+ it("should not fail", function() {
213
+ expect(expression).toParse();
214
+ });
215
+
216
+ it("should build a list of closes", function() {
217
+ var parse = parseTree(expression);
218
+ expect(parse).toBeTruthy();
219
+
220
+ for (var i = 0; i < parse.length; i++) {
221
+ var group = parse[i];
222
+ expect(group.type).toMatch("close");
223
+ }
224
+ });
225
+ });
226
+
227
+ describe("A \\KaTeX parser", function() {
228
+ it("should not fail", function() {
229
+ expect("\\KaTeX").toParse();
230
+ });
231
+ });
232
+
233
+ describe("A subscript and superscript parser", function() {
234
+ it("should not fail on superscripts", function() {
235
+ expect("x^2").toParse();
236
+ });
237
+
238
+ it("should not fail on subscripts", function() {
239
+ expect("x_3").toParse();
240
+ });
241
+
242
+ it("should not fail on both subscripts and superscripts", function() {
243
+ expect("x^2_3").toParse();
244
+
245
+ expect("x_2^3").toParse();
246
+ });
247
+
248
+ it("should not fail when there is no nucleus", function() {
249
+ expect("^3").toParse();
250
+ expect("_2").toParse();
251
+ expect("^3_2").toParse();
252
+ expect("_2^3").toParse();
253
+ });
254
+
255
+ it("should produce supsubs for superscript", function() {
256
+ var parse = parseTree("x^2")[0];
257
+
258
+ expect(parse.type).toBe("supsub");
259
+ expect(parse.value.base).toBeDefined();
260
+ expect(parse.value.sup).toBeDefined();
261
+ expect(parse.value.sub).toBeUndefined();
262
+ });
263
+
264
+ it("should produce supsubs for subscript", function() {
265
+ var parse = parseTree("x_3")[0];
266
+
267
+ expect(parse.type).toBe("supsub");
268
+ expect(parse.value.base).toBeDefined();
269
+ expect(parse.value.sub).toBeDefined();
270
+ expect(parse.value.sup).toBeUndefined();
271
+ });
272
+
273
+ it("should produce supsubs for ^_", function() {
274
+ var parse = parseTree("x^2_3")[0];
275
+
276
+ expect(parse.type).toBe("supsub");
277
+ expect(parse.value.base).toBeDefined();
278
+ expect(parse.value.sup).toBeDefined();
279
+ expect(parse.value.sub).toBeDefined();
280
+ });
281
+
282
+ it("should produce supsubs for _^", function() {
283
+ var parse = parseTree("x_3^2")[0];
284
+
285
+ expect(parse.type).toBe("supsub");
286
+ expect(parse.value.base).toBeDefined();
287
+ expect(parse.value.sup).toBeDefined();
288
+ expect(parse.value.sub).toBeDefined();
289
+ });
290
+
291
+ it("should produce the same thing regardless of order", function() {
292
+ var parseA = parseTree("x^2_3");
293
+ var parseB = parseTree("x_3^2");
294
+
295
+ expect(parseA).toEqual(parseB);
296
+ });
297
+
298
+ it("should not parse double subscripts or superscripts", function() {
299
+ expect("x^x^x").toNotParse();
300
+
301
+ expect("x_x_x").toNotParse();
302
+
303
+ expect("x_x^x_x").toNotParse();
304
+
305
+ expect("x_x^x^x").toNotParse();
306
+
307
+ expect("x^x_x_x").toNotParse();
308
+
309
+ expect("x^x_x^x").toNotParse();
310
+ });
311
+
312
+ it("should work correctly with {}s", function() {
313
+ expect("x^{2+3}").toParse();
314
+
315
+ expect("x_{3-2}").toParse();
316
+
317
+ expect("x^{2+3}_3").toParse();
318
+
319
+ expect("x^2_{3-2}").toParse();
320
+
321
+ expect("x^{2+3}_{3-2}").toParse();
322
+
323
+ expect("x_{3-2}^{2+3}").toParse();
324
+
325
+ expect("x_3^{2+3}").toParse();
326
+
327
+ expect("x_{3-2}^2").toParse();
328
+ });
329
+
330
+ it("should work with nested super/subscripts", function() {
331
+ expect("x^{x^x}").toParse();
332
+ expect("x^{x_x}").toParse();
333
+ expect("x_{x^x}").toParse();
334
+ expect("x_{x_x}").toParse();
335
+ });
336
+ });
337
+
338
+ describe("A subscript and superscript tree-builder", function() {
339
+ it("should not fail when there is no nucleus", function() {
340
+ expect("^3").toBuild();
341
+ expect("_2").toBuild();
342
+ expect("^3_2").toBuild();
343
+ expect("_2^3").toBuild();
344
+ });
345
+ });
346
+
347
+ describe("A group parser", function() {
348
+ it("should not fail", function() {
349
+ expect("{xy}").toParse();
350
+ });
351
+
352
+ it("should produce a single ord", function() {
353
+ var parse = parseTree("{xy}");
354
+
355
+ expect(parse.length).toBe(1);
356
+
357
+ var ord = parse[0];
358
+
359
+ expect(ord.type).toMatch("ord");
360
+ expect(ord.value).toBeTruthy();
361
+ });
362
+ });
363
+
364
+ describe("An implicit group parser", function() {
365
+ it("should not fail", function() {
366
+ expect("\\Large x").toParse();
367
+ expect("abc {abc \\Large xyz} abc").toParse();
368
+ });
369
+
370
+ it("should produce a single object", function() {
371
+ var parse = parseTree("\\Large abc");
372
+
373
+ expect(parse.length).toBe(1);
374
+
375
+ var sizing = parse[0];
376
+
377
+ expect(sizing.type).toMatch("sizing");
378
+ expect(sizing.value).toBeTruthy();
379
+ });
380
+
381
+ it("should apply only after the function", function() {
382
+ var parse = parseTree("a \\Large abc");
383
+
384
+ expect(parse.length).toBe(2);
385
+
386
+ var sizing = parse[1];
387
+
388
+ expect(sizing.type).toMatch("sizing");
389
+ expect(sizing.value.value.length).toBe(3);
390
+ });
391
+
392
+ it("should stop at the ends of groups", function() {
393
+ var parse = parseTree("a { b \\Large c } d");
394
+
395
+ var group = parse[1];
396
+ var sizing = group.value[1];
397
+
398
+ expect(sizing.type).toMatch("sizing");
399
+ expect(sizing.value.value.length).toBe(1);
400
+ });
401
+ });
402
+
403
+ describe("A function parser", function() {
404
+ it("should parse no argument functions", function() {
405
+ expect("\\div").toParse();
406
+ });
407
+
408
+ it("should parse 1 argument functions", function() {
409
+ expect("\\blue x").toParse();
410
+ });
411
+
412
+ it("should parse 2 argument functions", function() {
413
+ expect("\\frac 1 2").toParse();
414
+ });
415
+
416
+ it("should not parse 1 argument functions with no arguments", function() {
417
+ expect("\\blue").toNotParse();
418
+ });
419
+
420
+ it("should not parse 2 argument functions with 0 or 1 arguments", function() {
421
+ expect("\\frac").toNotParse();
422
+
423
+ expect("\\frac 1").toNotParse();
424
+ });
425
+
426
+ it("should not parse a function with text right after it", function() {
427
+ expect("\\redx").toNotParse();
428
+ });
429
+
430
+ it("should parse a function with a number right after it", function() {
431
+ expect("\\frac12").toParse();
432
+ });
433
+
434
+ it("should parse some functions with text right after it", function() {
435
+ expect("\\;x").toParse();
436
+ });
437
+ });
438
+
439
+ describe("A frac parser", function() {
440
+ var expression = "\\frac{x}{y}";
441
+ var dfracExpression = "\\dfrac{x}{y}";
442
+ var tfracExpression = "\\tfrac{x}{y}";
443
+
444
+ it("should not fail", function() {
445
+ expect(expression).toParse();
446
+ });
447
+
448
+ it("should produce a frac", function() {
449
+ var parse = parseTree(expression)[0];
450
+
451
+ expect(parse.type).toMatch("frac");
452
+ expect(parse.value.numer).toBeDefined();
453
+ expect(parse.value.denom).toBeDefined();
454
+ });
455
+
456
+ it("should also parse dfrac and tfrac", function() {
457
+ expect(dfracExpression).toParse();
458
+
459
+ expect(tfracExpression).toParse();
460
+ });
461
+
462
+ it("should parse dfrac and tfrac as fracs", function() {
463
+ var dfracParse = parseTree(dfracExpression)[0];
464
+
465
+ expect(dfracParse.type).toMatch("frac");
466
+ expect(dfracParse.value.numer).toBeDefined();
467
+ expect(dfracParse.value.denom).toBeDefined();
468
+
469
+ var tfracParse = parseTree(tfracExpression)[0];
470
+
471
+ expect(tfracParse.type).toMatch("frac");
472
+ expect(tfracParse.value.numer).toBeDefined();
473
+ expect(tfracParse.value.denom).toBeDefined();
474
+ });
475
+ });
476
+
477
+ describe("An over parser", function() {
478
+ var simpleOver = "1 \\over x";
479
+ var complexOver = "1+2i \\over 3+4i";
480
+
481
+ it("should not fail", function () {
482
+ expect(simpleOver).toParse();
483
+ expect(complexOver).toParse();
484
+ });
485
+
486
+ it("should produce a frac", function() {
487
+ var parse;
488
+
489
+ parse = parseTree(simpleOver)[0];
490
+
491
+ expect(parse.type).toMatch("frac");
492
+ expect(parse.value.numer).toBeDefined();
493
+ expect(parse.value.denom).toBeDefined();
494
+
495
+ parse = parseTree(complexOver)[0];
496
+
497
+ expect(parse.type).toMatch("frac");
498
+ expect(parse.value.numer).toBeDefined();
499
+ expect(parse.value.denom).toBeDefined();
500
+ });
501
+
502
+ it("should create a numerator from the atoms before \\over", function () {
503
+ var parse = parseTree(complexOver)[0];
504
+
505
+ var numer = parse.value.numer;
506
+ expect(numer.value.length).toEqual(4);
507
+ });
508
+
509
+ it("should create a demonimator from the atoms after \\over", function () {
510
+ var parse = parseTree(complexOver)[0];
511
+
512
+ var denom = parse.value.numer;
513
+ expect(denom.value.length).toEqual(4);
514
+ });
515
+
516
+ it("should handle empty numerators", function () {
517
+ var emptyNumerator = "\\over x";
518
+ expect(emptyNumerator).toParse();
519
+
520
+ var parse = parseTree(emptyNumerator)[0];
521
+ expect(parse.type).toMatch("frac");
522
+ expect(parse.value.numer).toBeDefined();
523
+ expect(parse.value.denom).toBeDefined();
524
+ });
525
+
526
+ it("should handle empty denominators", function () {
527
+ var emptyDenominator = "1 \\over";
528
+ expect(emptyDenominator).toParse();
529
+
530
+ var parse = parseTree(emptyDenominator)[0];
531
+ expect(parse.type).toMatch("frac");
532
+ expect(parse.value.numer).toBeDefined();
533
+ expect(parse.value.denom).toBeDefined();
534
+ });
535
+
536
+ it("should handle \\displaystyle correctly", function () {
537
+ var displaystyleExpression = "\\displaystyle 1 \\over 2";
538
+ expect(displaystyleExpression).toParse();
539
+
540
+ var parse = parseTree(displaystyleExpression)[0];
541
+ expect(parse.type).toMatch("frac");
542
+ expect(parse.value.numer.value[0].type).toMatch("styling");
543
+ expect(parse.value.denom).toBeDefined();
544
+ });
545
+
546
+ it("should handle nested factions", function () {
547
+ var nestedOverExpression = "{1 \\over 2} \\over 3";
548
+ expect(nestedOverExpression).toParse();
549
+
550
+ var parse = parseTree(nestedOverExpression)[0];
551
+ expect(parse.type).toMatch("frac");
552
+ expect(parse.value.numer.value[0].type).toMatch("frac");
553
+ expect(parse.value.numer.value[0].value.numer.value[0].value).toMatch(1);
554
+ expect(parse.value.numer.value[0].value.denom.value[0].value).toMatch(2);
555
+ expect(parse.value.denom).toBeDefined();
556
+ expect(parse.value.denom.value[0].value).toMatch(3);
557
+ });
558
+
559
+ it("should fail with multiple overs in the same group", function () {
560
+ var badMultipleOvers = "1 \\over 2 + 3 \\over 4";
561
+ expect(badMultipleOvers).toNotParse();
562
+
563
+ var badOverChoose = "1 \\over 2 \\choose 3";
564
+ expect(badOverChoose).toNotParse();
565
+ });
566
+ });
567
+
568
+ describe("A sizing parser", function() {
569
+ var sizeExpression = "\\Huge{x}\\small{x}";
570
+ var nestedSizeExpression = "\\Huge{\\small{x}}";
571
+
572
+ it("should not fail", function() {
573
+ expect(sizeExpression).toParse();
574
+ });
575
+
576
+ it("should produce a sizing node", function() {
577
+ var parse = parseTree(sizeExpression)[0];
578
+
579
+ expect(parse.type).toMatch("sizing");
580
+ expect(parse.value).toBeDefined();
581
+ });
582
+ });
583
+
584
+ describe("A text parser", function() {
585
+ var textExpression = "\\text{a b}";
586
+ var noBraceTextExpression = "\\text x";
587
+ var nestedTextExpression =
588
+ "\\text{a {b} \\blue{c} \\color{#fff}{x} \\llap{x}}";
589
+ var spaceTextExpression = "\\text{ a \\ }";
590
+ var leadingSpaceTextExpression = "\\text {moo}";
591
+ var badTextExpression = "\\text{a b%}";
592
+ var badFunctionExpression = "\\text{\\sqrt{x}}";
593
+
594
+ it("should not fail", function() {
595
+ expect(textExpression).toParse();
596
+ });
597
+
598
+ it("should produce a text", function() {
599
+ var parse = parseTree(textExpression)[0];
600
+
601
+ expect(parse.type).toMatch("text");
602
+ expect(parse.value).toBeDefined();
603
+ });
604
+
605
+ it("should produce textords instead of mathords", function() {
606
+ var parse = parseTree(textExpression)[0];
607
+ var group = parse.value.body;
608
+
609
+ expect(group[0].type).toMatch("textord");
610
+ });
611
+
612
+ it("should not parse bad text", function() {
613
+ expect(badTextExpression).toNotParse();
614
+ });
615
+
616
+ it("should not parse bad functions inside text", function() {
617
+ expect(badFunctionExpression).toNotParse();
618
+ });
619
+
620
+ it("should parse text with no braces around it", function() {
621
+ expect(noBraceTextExpression).toParse();
622
+ });
623
+
624
+ it("should parse nested expressions", function() {
625
+ expect(nestedTextExpression).toParse();
626
+ });
627
+
628
+ it("should contract spaces", function() {
629
+ var parse = parseTree(spaceTextExpression)[0];
630
+ var group = parse.value.body;
631
+
632
+ expect(group[0].type).toMatch("spacing");
633
+ expect(group[1].type).toMatch("textord");
634
+ expect(group[2].type).toMatch("spacing");
635
+ expect(group[3].type).toMatch("spacing");
636
+ });
637
+
638
+ it("should ignore a space before the text group", function() {
639
+ var parse = parseTree(leadingSpaceTextExpression)[0];
640
+ // [m, o, o]
641
+ expect(parse.value.body.length).toBe(3);
642
+ expect(
643
+ parse.value.body.map(function(n) { return n.value; }).join("")
644
+ ).toBe("moo");
645
+ });
646
+ });
647
+
648
+ describe("A color parser", function() {
649
+ var colorExpression = "\\blue{x}";
650
+ var customColorExpression = "\\color{#fA6}{x}";
651
+ var badCustomColorExpression = "\\color{bad-color}{x}";
652
+
653
+ it("should not fail", function() {
654
+ expect(colorExpression).toParse();
655
+ });
656
+
657
+ it("should build a color node", function() {
658
+ var parse = parseTree(colorExpression)[0];
659
+
660
+ expect(parse.type).toMatch("color");
661
+ expect(parse.value.color).toBeDefined();
662
+ expect(parse.value.value).toBeDefined();
663
+ });
664
+
665
+ it("should parse a custom color", function() {
666
+ expect(customColorExpression).toParse();
667
+ });
668
+
669
+ it("should correctly extract the custom color", function() {
670
+ var parse = parseTree(customColorExpression)[0];
671
+
672
+ expect(parse.value.color).toMatch("#fA6");
673
+ });
674
+
675
+ it("should not parse a bad custom color", function() {
676
+ expect(badCustomColorExpression).toNotParse();
677
+ });
678
+ });
679
+
680
+ describe("A tie parser", function() {
681
+ var mathTie = "a~b";
682
+ var textTie = "\\text{a~ b}";
683
+
684
+ it("should parse ties in math mode", function() {
685
+ expect(mathTie).toParse();
686
+ });
687
+
688
+ it("should parse ties in text mode", function() {
689
+ expect(textTie).toParse();
690
+ });
691
+
692
+ it("should produce spacing in math mode", function() {
693
+ var parse = parseTree(mathTie);
694
+
695
+ expect(parse[1].type).toMatch("spacing");
696
+ });
697
+
698
+ it("should produce spacing in text mode", function() {
699
+ var text = parseTree(textTie)[0];
700
+ var parse = text.value.body;
701
+
702
+ expect(parse[1].type).toMatch("spacing");
703
+ });
704
+
705
+ it("should not contract with spaces in text mode", function() {
706
+ var text = parseTree(textTie)[0];
707
+ var parse = text.value.body;
708
+
709
+ expect(parse[2].type).toMatch("spacing");
710
+ });
711
+ });
712
+
713
+ describe("A delimiter sizing parser", function() {
714
+ var normalDelim = "\\bigl |";
715
+ var notDelim = "\\bigl x";
716
+ var bigDelim = "\\Biggr \\langle";
717
+
718
+ it("should parse normal delimiters", function() {
719
+ expect(normalDelim).toParse();
720
+ expect(bigDelim).toParse();
721
+ });
722
+
723
+ it("should not parse not-delimiters", function() {
724
+ expect(notDelim).toNotParse();
725
+ });
726
+
727
+ it("should produce a delimsizing", function() {
728
+ var parse = parseTree(normalDelim)[0];
729
+
730
+ expect(parse.type).toMatch("delimsizing");
731
+ });
732
+
733
+ it("should produce the correct direction delimiter", function() {
734
+ var leftParse = parseTree(normalDelim)[0];
735
+ var rightParse = parseTree(bigDelim)[0];
736
+
737
+ expect(leftParse.value.delimType).toMatch("open");
738
+ expect(rightParse.value.delimType).toMatch("close");
739
+ });
740
+
741
+ it("should parse the correct size delimiter", function() {
742
+ var smallParse = parseTree(normalDelim)[0];
743
+ var bigParse = parseTree(bigDelim)[0];
744
+
745
+ expect(smallParse.value.size).toEqual(1);
746
+ expect(bigParse.value.size).toEqual(4);
747
+ });
748
+ });
749
+
750
+ describe("An overline parser", function() {
751
+ var overline = "\\overline{x}";
752
+
753
+ it("should not fail", function() {
754
+ expect(overline).toParse();
755
+ });
756
+
757
+ it("should produce an overline", function() {
758
+ var parse = parseTree(overline)[0];
759
+
760
+ expect(parse.type).toMatch("overline");
761
+ });
762
+ });
763
+
764
+ describe("A rule parser", function() {
765
+ var emRule = "\\rule{1em}{2em}";
766
+ var exRule = "\\rule{1ex}{2em}";
767
+ var badUnitRule = "\\rule{1px}{2em}";
768
+ var noNumberRule = "\\rule{1em}{em}";
769
+ var incompleteRule = "\\rule{1em}";
770
+ var hardNumberRule = "\\rule{ 01.24ex}{2.450 em }";
771
+
772
+ it("should not fail", function() {
773
+ expect(emRule).toParse();
774
+ expect(exRule).toParse();
775
+ });
776
+
777
+ it("should not parse invalid units", function() {
778
+ expect(badUnitRule).toNotParse();
779
+
780
+ expect(noNumberRule).toNotParse();
781
+ });
782
+
783
+ it("should not parse incomplete rules", function() {
784
+ expect(incompleteRule).toNotParse();
785
+ });
786
+
787
+ it("should produce a rule", function() {
788
+ var parse = parseTree(emRule)[0];
789
+
790
+ expect(parse.type).toMatch("rule");
791
+ });
792
+
793
+ it("should list the correct units", function() {
794
+ var emParse = parseTree(emRule)[0];
795
+ var exParse = parseTree(exRule)[0];
796
+
797
+ expect(emParse.value.width.unit).toMatch("em");
798
+ expect(emParse.value.height.unit).toMatch("em");
799
+
800
+ expect(exParse.value.width.unit).toMatch("ex");
801
+ expect(exParse.value.height.unit).toMatch("em");
802
+ });
803
+
804
+ it("should parse the number correctly", function() {
805
+ var hardNumberParse = parseTree(hardNumberRule)[0];
806
+
807
+ expect(hardNumberParse.value.width.number).toBeCloseTo(1.24);
808
+ expect(hardNumberParse.value.height.number).toBeCloseTo(2.45);
809
+ });
810
+
811
+ it("should parse negative sizes", function() {
812
+ expect("\\rule{-1em}{- 0.2em}").toParse();
813
+
814
+ var parse = parseTree("\\rule{-1em}{- 0.2em}")[0];
815
+
816
+ expect(parse.value.width.number).toBeCloseTo(-1);
817
+ expect(parse.value.height.number).toBeCloseTo(-0.2);
818
+ });
819
+ });
820
+
821
+ describe("A left/right parser", function() {
822
+ var normalLeftRight = "\\left( \\dfrac{x}{y} \\right)";
823
+ var emptyRight = "\\left( \\dfrac{x}{y} \\right.";
824
+
825
+ it("should not fail", function() {
826
+ expect(normalLeftRight).toParse();
827
+ });
828
+
829
+ it("should produce a leftright", function() {
830
+ var parse = parseTree(normalLeftRight)[0];
831
+
832
+ expect(parse.type).toMatch("leftright");
833
+ expect(parse.value.left).toMatch("\\(");
834
+ expect(parse.value.right).toMatch("\\)");
835
+ });
836
+
837
+ it("should error when it is mismatched", function() {
838
+ var unmatchedLeft = "\\left( \\dfrac{x}{y}";
839
+ var unmatchedRight = "\\dfrac{x}{y} \\right)";
840
+
841
+ expect(unmatchedLeft).toNotParse();
842
+
843
+ expect(unmatchedRight).toNotParse();
844
+ });
845
+
846
+ it("should error when braces are mismatched", function() {
847
+ var unmatched = "{ \\left( \\dfrac{x}{y} } \\right)";
848
+ expect(unmatched).toNotParse();
849
+ });
850
+
851
+ it("should error when non-delimiters are provided", function() {
852
+ var nonDelimiter = "\\left$ \\dfrac{x}{y} \\right)";
853
+ expect(nonDelimiter).toNotParse();
854
+ });
855
+
856
+ it("should parse the empty '.' delimiter", function() {
857
+ expect(emptyRight).toParse();
858
+ });
859
+
860
+ it("should parse the '.' delimiter with normal sizes", function() {
861
+ var normalEmpty = "\\Bigl .";
862
+ expect(normalEmpty).toParse();
863
+ });
864
+ });
865
+
866
+ describe("A sqrt parser", function() {
867
+ var sqrt = "\\sqrt{x}";
868
+ var missingGroup = "\\sqrt";
869
+
870
+ it("should parse square roots", function() {
871
+ expect(sqrt).toParse();
872
+ });
873
+
874
+ it("should error when there is no group", function() {
875
+ expect(missingGroup).toNotParse();
876
+ });
877
+
878
+ it("should produce sqrts", function() {
879
+ var parse = parseTree(sqrt)[0];
880
+
881
+ expect(parse.type).toMatch("sqrt");
882
+ });
883
+ });
884
+
885
+ describe("A TeX-compliant parser", function() {
886
+ it("should work", function() {
887
+ expect("\\frac 2 3").toParse();
888
+ });
889
+
890
+ it("should fail if there are not enough arguments", function() {
891
+ var missingGroups = [
892
+ "\\frac{x}",
893
+ "\\color{#fff}",
894
+ "\\rule{1em}",
895
+ "\\llap",
896
+ "\\bigl",
897
+ "\\text"
898
+ ];
899
+
900
+ for (var i = 0; i < missingGroups.length; i++) {
901
+ expect(missingGroups[i]).toNotParse();
902
+ }
903
+ });
904
+
905
+ it("should fail when there are missing sup/subscripts", function() {
906
+ expect("x^").toNotParse();
907
+ expect("x_").toNotParse();
908
+ });
909
+
910
+ it("should fail when arguments require arguments", function() {
911
+ var badArguments = [
912
+ "\\frac \\frac x y z",
913
+ "\\frac x \\frac y z",
914
+ "\\frac \\sqrt x y",
915
+ "\\frac x \\sqrt y",
916
+ "\\frac \\llap x y",
917
+ "\\frac x \\llap y",
918
+ // This actually doesn't work in real TeX, but it is suprisingly
919
+ // hard to get this to correctly work. So, we take hit of very small
920
+ // amounts of non-compatiblity in order for the rest of the tests to
921
+ // work
922
+ // "\\llap \\frac x y",
923
+ "\\llap \\llap x",
924
+ "\\sqrt \\llap x"
925
+ ];
926
+
927
+ for (var i = 0; i < badArguments.length; i++) {
928
+ expect(badArguments[i]).toNotParse();
929
+ }
930
+ });
931
+
932
+ it("should work when the arguments have braces", function() {
933
+ var goodArguments = [
934
+ "\\frac {\\frac x y} z",
935
+ "\\frac x {\\frac y z}",
936
+ "\\frac {\\sqrt x} y",
937
+ "\\frac x {\\sqrt y}",
938
+ "\\frac {\\llap x} y",
939
+ "\\frac x {\\llap y}",
940
+ "\\llap {\\frac x y}",
941
+ "\\llap {\\llap x}",
942
+ "\\sqrt {\\llap x}"
943
+ ];
944
+
945
+ for (var i = 0; i < goodArguments.length; i++) {
946
+ expect(goodArguments[i]).toParse();
947
+ }
948
+ });
949
+
950
+ it("should fail when sup/subscripts require arguments", function() {
951
+ var badSupSubscripts = [
952
+ "x^\\sqrt x",
953
+ "x^\\llap x",
954
+ "x_\\sqrt x",
955
+ "x_\\llap x"
956
+ ];
957
+
958
+ for (var i = 0; i < badSupSubscripts.length; i++) {
959
+ expect(badSupSubscripts[i]).toNotParse();
960
+ }
961
+ });
962
+
963
+ it("should work when sup/subscripts arguments have braces", function() {
964
+ var goodSupSubscripts = [
965
+ "x^{\\sqrt x}",
966
+ "x^{\\llap x}",
967
+ "x_{\\sqrt x}",
968
+ "x_{\\llap x}"
969
+ ];
970
+
971
+ for (var i = 0; i < goodSupSubscripts.length; i++) {
972
+ expect(goodSupSubscripts[i]).toParse();
973
+ }
974
+ });
975
+
976
+ it("should parse multiple primes correctly", function() {
977
+ expect("x''''").toParse();
978
+ expect("x_2''").toParse();
979
+ expect("x''_2").toParse();
980
+ expect("x'_2'").toParse();
981
+ });
982
+
983
+ it("should fail when sup/subscripts are interspersed with arguments", function() {
984
+ expect("\\sqrt^23").toNotParse();
985
+ expect("\\frac^234").toNotParse();
986
+ expect("\\frac2^34").toNotParse();
987
+ });
988
+
989
+ it("should succeed when sup/subscripts come after whole functions", function() {
990
+ expect("\\sqrt2^3").toParse();
991
+ expect("\\frac23^4").toParse();
992
+ });
993
+
994
+ it("should succeed with a sqrt around a text/frac", function() {
995
+ expect("\\sqrt \\frac x y").toParse();
996
+ expect("\\sqrt \\text x").toParse();
997
+ expect("x^\\frac x y").toParse();
998
+ expect("x_\\text x").toParse();
999
+ });
1000
+
1001
+ it("should fail when arguments are \\left", function() {
1002
+ var badLeftArguments = [
1003
+ "\\frac \\left( x \\right) y",
1004
+ "\\frac x \\left( y \\right)",
1005
+ "\\llap \\left( x \\right)",
1006
+ "\\sqrt \\left( x \\right)",
1007
+ "x^\\left( x \\right)"
1008
+ ];
1009
+
1010
+ for (var i = 0; i < badLeftArguments.length; i++) {
1011
+ expect(badLeftArguments[i]).toNotParse();
1012
+ }
1013
+ });
1014
+
1015
+ it("should succeed when there are braces around the \\left/\\right", function() {
1016
+ var goodLeftArguments = [
1017
+ "\\frac {\\left( x \\right)} y",
1018
+ "\\frac x {\\left( y \\right)}",
1019
+ "\\llap {\\left( x \\right)}",
1020
+ "\\sqrt {\\left( x \\right)}",
1021
+ "x^{\\left( x \\right)}"
1022
+ ];
1023
+
1024
+ for (var i = 0; i < goodLeftArguments.length; i++) {
1025
+ expect(goodLeftArguments[i]).toParse();
1026
+ }
1027
+ });
1028
+ });
1029
+
1030
+ describe("A style change parser", function() {
1031
+ it("should not fail", function() {
1032
+ expect("\\displaystyle x").toParse();
1033
+ expect("\\textstyle x").toParse();
1034
+ expect("\\scriptstyle x").toParse();
1035
+ expect("\\scriptscriptstyle x").toParse();
1036
+ });
1037
+
1038
+ it("should produce the correct style", function() {
1039
+ var displayParse = parseTree("\\displaystyle x")[0];
1040
+ expect(displayParse.value.style).toMatch("display");
1041
+
1042
+ var scriptscriptParse = parseTree("\\scriptscriptstyle x")[0];
1043
+ expect(scriptscriptParse.value.style).toMatch("scriptscript");
1044
+ });
1045
+
1046
+ it("should only change the style within its group", function() {
1047
+ var text = "a b { c d \\displaystyle e f } g h";
1048
+ expect(text).toParse();
1049
+
1050
+ var parse = parseTree(text);
1051
+
1052
+ var displayNode = parse[2].value[2];
1053
+
1054
+ expect(displayNode.type).toMatch("styling");
1055
+
1056
+ var displayBody = displayNode.value.value;
1057
+
1058
+ expect(displayBody.length).toEqual(2);
1059
+ expect(displayBody[0].value).toMatch("e");
1060
+ });
1061
+ });
1062
+
1063
+ describe("A bin builder", function() {
1064
+ it("should create mbins normally", function() {
1065
+ var built = getBuilt("x + y");
1066
+
1067
+ expect(built[1].classes).toContain("mbin");
1068
+ });
1069
+
1070
+ it("should create ords when at the beginning of lists", function() {
1071
+ var built = getBuilt("+ x");
1072
+
1073
+ expect(built[0].classes).toContain("mord");
1074
+ expect(built[0].classes).not.toContain("mbin");
1075
+ });
1076
+
1077
+ it("should create ords after some other objects", function() {
1078
+ expect(getBuilt("x + + 2")[2].classes).toContain("mord");
1079
+ expect(getBuilt("( + 2")[1].classes).toContain("mord");
1080
+ expect(getBuilt("= + 2")[1].classes).toContain("mord");
1081
+ expect(getBuilt("\\sin + 2")[1].classes).toContain("mord");
1082
+ expect(getBuilt(", + 2")[1].classes).toContain("mord");
1083
+ });
1084
+
1085
+ it("should correctly interact with color objects", function() {
1086
+ expect(getBuilt("\\blue{x}+y")[1].classes).toContain("mbin");
1087
+ expect(getBuilt("\\blue{x+}+y")[1].classes).toContain("mord");
1088
+ });
1089
+ });
1090
+
1091
+ describe("A markup generator", function() {
1092
+ it("marks trees up", function() {
1093
+ // Just a few quick sanity checks here...
1094
+ var markup = katex.renderToString("\\sigma^2");
1095
+ expect(markup.indexOf("<span")).toBe(0);
1096
+ expect(markup).toContain("\u03c3"); // sigma
1097
+ expect(markup).toContain("margin-right");
1098
+ expect(markup).not.toContain("marginRight");
1099
+ });
1100
+ });
1101
+
1102
+ describe("An accent parser", function() {
1103
+ it("should not fail", function() {
1104
+ expect("\\vec{x}").toParse();
1105
+ expect("\\vec{x^2}").toParse();
1106
+ expect("\\vec{x}^2").toParse();
1107
+ expect("\\vec x").toParse();
1108
+ });
1109
+
1110
+ it("should produce accents", function() {
1111
+ var parse = parseTree("\\vec x")[0];
1112
+
1113
+ expect(parse.type).toMatch("accent");
1114
+ });
1115
+
1116
+ it("should be grouped more tightly than supsubs", function() {
1117
+ var parse = parseTree("\\vec x^2")[0];
1118
+
1119
+ expect(parse.type).toMatch("supsub");
1120
+ });
1121
+
1122
+ it("should not parse expanding accents", function() {
1123
+ expect("\\widehat{x}").toNotParse();
1124
+ });
1125
+ });
1126
+
1127
+ describe("An accent builder", function() {
1128
+ it("should not fail", function() {
1129
+ expect("\\vec{x}").toBuild();
1130
+ expect("\\vec{x}^2").toBuild();
1131
+ expect("\\vec{x}_2").toBuild();
1132
+ expect("\\vec{x}_2^2").toBuild();
1133
+ });
1134
+
1135
+ it("should produce mords", function() {
1136
+ expect(getBuilt("\\vec x")[0].classes).toContain("mord");
1137
+ expect(getBuilt("\\vec +")[0].classes).toContain("mord");
1138
+ expect(getBuilt("\\vec +")[0].classes).not.toContain("mbin");
1139
+ expect(getBuilt("\\vec )^2")[0].classes).toContain("mord");
1140
+ expect(getBuilt("\\vec )^2")[0].classes).not.toContain("mclose");
1141
+ });
1142
+ });
1143
+
1144
+ describe("A parser error", function () {
1145
+ it("should report the position of an error", function () {
1146
+ try {
1147
+ parseTree("\\sqrt}");
1148
+ } catch (e) {
1149
+ expect(e.position).toEqual(5);
1150
+ }
1151
+ });
1152
+ });
1153
+
1154
+ describe("An optional argument parser", function() {
1155
+ it("should not fail", function() {
1156
+ // Note this doesn't actually make an optional argument, but still
1157
+ // should work
1158
+ expect("\\frac[1]{2}{3}").toParse();
1159
+
1160
+ expect("\\rule[0.2em]{1em}{1em}").toParse();
1161
+ });
1162
+
1163
+ it("should fail on sqrts for now", function() {
1164
+ expect("\\sqrt[3]{2}").toNotParse();
1165
+ });
1166
+
1167
+ it("should work when the optional argument is missing", function() {
1168
+ expect("\\sqrt{2}").toParse();
1169
+ expect("\\rule{1em}{2em}").toParse();
1170
+ });
1171
+
1172
+ it("should fail when the optional argument is malformed", function() {
1173
+ expect("\\rule[1]{2em}{3em}").toNotParse();
1174
+ });
1175
+
1176
+ it("should not work if the optional argument isn't closed", function() {
1177
+ expect("\\sqrt[").toNotParse();
1178
+ });
1179
+ });