A new Riff-radio.org site with a static approach.

math_helper.tmpl.py 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # -*- coding:utf-8 -*-
  2. from mako import runtime, filters, cache
  3. UNDEFINED = runtime.UNDEFINED
  4. STOP_RENDERING = runtime.STOP_RENDERING
  5. __M_dict_builtin = dict
  6. __M_locals_builtin = locals
  7. _magic_number = 10
  8. _modified_time = 1676236796.120317
  9. _enable_loop = True
  10. _template_filename = '/home/thomas/.local/lib/python3.9/site-packages/nikola/data/themes/base/templates/math_helper.tmpl'
  11. _template_uri = 'math_helper.tmpl'
  12. _source_encoding = 'utf-8'
  13. _exports = ['math_scripts', 'math_styles', 'math_scripts_ifpost', 'math_scripts_ifposts', 'math_styles_ifpost', 'math_styles_ifposts']
  14. def render_body(context,**pageargs):
  15. __M_caller = context.caller_stack._push_frame()
  16. try:
  17. __M_locals = __M_dict_builtin(pageargs=pageargs)
  18. __M_writer = context.writer()
  19. __M_writer('\n\n')
  20. __M_writer('\n\n')
  21. __M_writer('\n\n')
  22. __M_writer('\n\n')
  23. __M_writer('\n\n')
  24. __M_writer('\n')
  25. return ''
  26. finally:
  27. context.caller_stack._pop_frame()
  28. def render_math_scripts(context):
  29. __M_caller = context.caller_stack._push_frame()
  30. try:
  31. use_katex = context.get('use_katex', UNDEFINED)
  32. mathjax_config = context.get('mathjax_config', UNDEFINED)
  33. katex_auto_render = context.get('katex_auto_render', UNDEFINED)
  34. __M_writer = context.writer()
  35. __M_writer('\n')
  36. if use_katex:
  37. __M_writer(' <script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script>\n <script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>\n')
  38. if katex_auto_render:
  39. __M_writer(' <script>\n renderMathInElement(document.body,\n {\n ')
  40. __M_writer(str(katex_auto_render))
  41. __M_writer('\n }\n );\n </script>\n')
  42. else:
  43. __M_writer(' <script>\n renderMathInElement(document.body,\n {\n delimiters: [\n {left: "$$", right: "$$", display: true},\n {left: "\\\\[", right: "\\\\]", display: true},\n {left: "\\\\begin{equation*}", right: "\\\\end{equation*}", display: true},\n {left: "\\\\(", right: "\\\\)", display: false}\n ]\n }\n );\n </script>\n')
  44. else:
  45. __M_writer(' <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" integrity="sha384-3lJUsx1TJHt7BA4udB5KPnDrlkO8T6J6v/op7ui0BbCjvZ9WqV4Xm6DTP6kQ/iBH" crossorigin="anonymous"></script>\n')
  46. if mathjax_config:
  47. __M_writer(' ')
  48. __M_writer(str(mathjax_config))
  49. __M_writer('\n')
  50. else:
  51. __M_writer(' <script type="text/x-mathjax-config">\n MathJax.Hub.Config({tex2jax: {inlineMath: [[\'$latex \',\'$\'], [\'\\\\(\',\'\\\\)\']]}});\n </script>\n')
  52. return ''
  53. finally:
  54. context.caller_stack._pop_frame()
  55. def render_math_styles(context):
  56. __M_caller = context.caller_stack._push_frame()
  57. try:
  58. use_katex = context.get('use_katex', UNDEFINED)
  59. __M_writer = context.writer()
  60. __M_writer('\n')
  61. if use_katex:
  62. __M_writer(' <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">\n')
  63. return ''
  64. finally:
  65. context.caller_stack._pop_frame()
  66. def render_math_scripts_ifpost(context,post):
  67. __M_caller = context.caller_stack._push_frame()
  68. try:
  69. def math_scripts():
  70. return render_math_scripts(context)
  71. __M_writer = context.writer()
  72. __M_writer('\n')
  73. if post.has_math:
  74. __M_writer(' ')
  75. __M_writer(str(math_scripts()))
  76. __M_writer('\n')
  77. return ''
  78. finally:
  79. context.caller_stack._pop_frame()
  80. def render_math_scripts_ifposts(context,posts):
  81. __M_caller = context.caller_stack._push_frame()
  82. try:
  83. any = context.get('any', UNDEFINED)
  84. def math_scripts():
  85. return render_math_scripts(context)
  86. __M_writer = context.writer()
  87. __M_writer('\n')
  88. if any(post.has_math for post in posts):
  89. __M_writer(' ')
  90. __M_writer(str(math_scripts()))
  91. __M_writer('\n')
  92. return ''
  93. finally:
  94. context.caller_stack._pop_frame()
  95. def render_math_styles_ifpost(context,post):
  96. __M_caller = context.caller_stack._push_frame()
  97. try:
  98. def math_styles():
  99. return render_math_styles(context)
  100. __M_writer = context.writer()
  101. __M_writer('\n')
  102. if post.has_math:
  103. __M_writer(' ')
  104. __M_writer(str(math_styles()))
  105. __M_writer('\n')
  106. return ''
  107. finally:
  108. context.caller_stack._pop_frame()
  109. def render_math_styles_ifposts(context,posts):
  110. __M_caller = context.caller_stack._push_frame()
  111. try:
  112. any = context.get('any', UNDEFINED)
  113. def math_styles():
  114. return render_math_styles(context)
  115. __M_writer = context.writer()
  116. __M_writer('\n')
  117. if any(post.has_math for post in posts):
  118. __M_writer(' ')
  119. __M_writer(str(math_styles()))
  120. __M_writer('\n')
  121. return ''
  122. finally:
  123. context.caller_stack._pop_frame()
  124. """
  125. __M_BEGIN_METADATA
  126. {"filename": "/home/thomas/.local/lib/python3.9/site-packages/nikola/data/themes/base/templates/math_helper.tmpl", "uri": "math_helper.tmpl", "source_encoding": "utf-8", "line_map": {"16": 0, "21": 39, "22": 45, "23": 51, "24": 57, "25": 63, "26": 69, "32": 2, "39": 2, "40": 3, "41": 4, "42": 6, "43": 7, "44": 10, "45": 10, "46": 14, "47": 15, "48": 28, "49": 30, "50": 31, "51": 32, "52": 32, "53": 32, "54": 33, "55": 34, "61": 41, "66": 41, "67": 42, "68": 43, "74": 47, "80": 47, "81": 48, "82": 49, "83": 49, "84": 49, "90": 53, "97": 53, "98": 54, "99": 55, "100": 55, "101": 55, "107": 59, "113": 59, "114": 60, "115": 61, "116": 61, "117": 61, "123": 65, "130": 65, "131": 66, "132": 67, "133": 67, "134": 67, "140": 134}}
  127. __M_END_METADATA
  128. """