show.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>试卷OCR</title>
  6. <link rel="stylesheet" type="text/css" href="../static/mathquill.css">
  7. </head>
  8. <body>
  9. {#<span style="white-space:normal;#}
  10. {#word-wrap:break-word;font-size: 10px;#}
  11. {#word-break:break-all; " class="math-field">这边汉字 x^2 \frac {1}{3} 啊 好多好多航 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊</span>#}
  12. <div id="container" style="width:{{ w }}px;">
  13. {% for content in contents %}
  14. <p class="math-field" style="font-size:{{content.size}}px ;margin-left:{{ content.left }}px;margin-top:{{ content.top }}px;position: absolute;width:{{content.w}};height: {{content.h}} ">
  15. {{ content.s }}</p>
  16. {% endfor %}
  17. <!--<img src="data:image/png;base64,{{ base64 }}"/>-->
  18. {% for image in images %}
  19. <img src="data:image/png;base64,{{ image.b64 }}"
  20. style="background-color:#FFA500;margin-left:{{ image.left }}px;margin-top:{{ image.top }}px;position: absolute;"/>
  21. <!--</p>-->
  22. {% endfor %}
  23. </div>
  24. <script src="../static/jquery-1.7.2.min.js"></script>
  25. <script src="../static/mathquill.js"></script>
  26. <script>
  27. var staticMathSpan = document.getElementById('static-math');
  28. var mathFieldSpan_list = document.getElementsByClassName('math-field');
  29. var latexSpan = document.getElementById('latex');
  30. var MQ = MathQuill.getInterface(2); // keeps the API stable
  31. // easily create static or editable math from a DOM element by calling the
  32. // appropriate constructor: http://docs.mathquill.com/en/latest/Api_Methods/
  33. MQ.StaticMath(staticMathSpan);
  34. for (var i = 0; i < mathFieldSpan_list.length; i++) {
  35. // you may pass in an options object:
  36. var mathField = MQ.MathField(mathFieldSpan_list[i], {
  37. spaceBehavesLikeTab: true, // an example config option, for more see:
  38. // http://docs.mathquill.com/en/latest/Config/
  39. handlers: {
  40. edit: function () {
  41. // retrieve, in LaTeX format, the math that was typed:
  42. latexSpan.textContent = mathField.latex();
  43. }
  44. }
  45. });
  46. }
  47. </script>
  48. </body>
  49. </html>