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

book.tmpl.py 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.20774
  9. _enable_loop = True
  10. _template_filename = 'templates/book.tmpl'
  11. _template_uri = 'book.tmpl'
  12. _source_encoding = 'utf-8'
  13. _exports = ['extra_head', 'content', 'extra_js']
  14. def _mako_get_namespace(context, name):
  15. try:
  16. return context.namespaces[(__name__, name)]
  17. except KeyError:
  18. _mako_generate_namespaces(context)
  19. return context.namespaces[(__name__, name)]
  20. def _mako_generate_namespaces(context):
  21. ns = runtime.TemplateNamespace('helper', context._clean_inheritance_tokens(), templateuri='post_helper.tmpl', callables=None, calling_uri=_template_uri)
  22. context.namespaces[(__name__, 'helper')] = ns
  23. ns = runtime.TemplateNamespace('pheader', context._clean_inheritance_tokens(), templateuri='post_header.tmpl', callables=None, calling_uri=_template_uri)
  24. context.namespaces[(__name__, 'pheader')] = ns
  25. ns = runtime.TemplateNamespace('comments', context._clean_inheritance_tokens(), templateuri='comments_helper.tmpl', callables=None, calling_uri=_template_uri)
  26. context.namespaces[(__name__, 'comments')] = ns
  27. def _mako_inherit(template, context):
  28. _mako_generate_namespaces(context)
  29. return runtime._inherit_from(context, 'post.tmpl', _template_uri)
  30. def render_body(context,**pageargs):
  31. __M_caller = context.caller_stack._push_frame()
  32. try:
  33. __M_locals = __M_dict_builtin(pageargs=pageargs)
  34. post = context.get('post', UNDEFINED)
  35. parent = context.get('parent', UNDEFINED)
  36. def content():
  37. return render_content(context._locals(__M_locals))
  38. def extra_js():
  39. return render_extra_js(context._locals(__M_locals))
  40. def extra_head():
  41. return render_extra_head(context._locals(__M_locals))
  42. __M_writer = context.writer()
  43. __M_writer('\n')
  44. __M_writer('\n')
  45. __M_writer('\n')
  46. __M_writer('\n\n')
  47. if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_head'):
  48. context['self'].extra_head(**pageargs)
  49. __M_writer('\n\n')
  50. if 'parent' not in context._data or not hasattr(context._data['parent'], 'content'):
  51. context['self'].content(**pageargs)
  52. __M_writer('\n\n')
  53. if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_js'):
  54. context['self'].extra_js(**pageargs)
  55. __M_writer('\n')
  56. return ''
  57. finally:
  58. context.caller_stack._pop_frame()
  59. def render_extra_head(context,**pageargs):
  60. __M_caller = context.caller_stack._push_frame()
  61. try:
  62. def extra_head():
  63. return render_extra_head(context)
  64. parent = context.get('parent', UNDEFINED)
  65. __M_writer = context.writer()
  66. __M_writer('\n ')
  67. __M_writer(str(parent.extra_head()))
  68. __M_writer("\n <link href='https://fonts.googleapis.com/css?family=Gentium+Book+Basic' rel='stylesheet' type='text/css'>\n <style>\n .smallcaps {\n font-variant: small-caps;\n }\n .chapter {\n width: 100%;\n padding: 10px;\n -webkit-column-gap: 40px;\n -moz-column-gap: 40px;\n column-gap: 40px;\n -webkit-column-width: 400px;\n -moz-column-width: 400px;\n column-width: 400px;\n -webkit-column-count: 2;\n -moz-column-count: 2;\n column-count: 2;\n -webkit-column-rule: 1px solid #ddd;\n -moz-column-rule: 1px solid #ddd;\n column-rule: 1px solid #ddd;\n height: 90vh;\n font-family: 'Gentium Book Basic', serif;\n color: #2d2e2e;\n font-weight: 500;\n }\n div.frame {\n overflow: hidden;\n padding: 0;\n margin: 0;\n }\n div.scrolling-cont {\n overflow-x: scroll;\n padding: 0;\n margin: 0;\n }\n h1, h2, h3, h4 {\n text-align: center;\n width: 100%;\n font-family: 'Gentium Book Basic', serif;\n font-size: 120%;\n font-weight: 900;\n }\n h1 {\n font-size: 150%;\n }\n .subtitle {\n text-align: center;\n width: 100%;\n }\n .bookfig {\n width: 100%;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n }\n div.figure {\n height: 88vh;\n margin: 0;\n }\n div.topic {\n margin: 0;\n }\n div.section > p {\n text-indent: 1em;\n margin-bottom: 0;\n text-align: justify;\n }\n </style>\n")
  69. return ''
  70. finally:
  71. context.caller_stack._pop_frame()
  72. def render_content(context,**pageargs):
  73. __M_caller = context.caller_stack._push_frame()
  74. try:
  75. def content():
  76. return render_content(context)
  77. post = context.get('post', UNDEFINED)
  78. __M_writer = context.writer()
  79. __M_writer('\n<article class="storypage" itemscope="itemscope" itemtype="http://schema.org/Article">\n <div class="frame">\n <div class="scrolling-cont" id="scrolling-cont" name="scrolling-cont">\n <div class="e-content entry-content chapter" itemprop="articleBody text">\n <h1>')
  80. __M_writer(str(post.title()))
  81. __M_writer('</h1>\n ')
  82. __M_writer(str(post.text()))
  83. __M_writer('\n </div>\n </div>\n </div>\n</article>\n')
  84. return ''
  85. finally:
  86. context.caller_stack._pop_frame()
  87. def render_extra_js(context,**pageargs):
  88. __M_caller = context.caller_stack._push_frame()
  89. try:
  90. def extra_js():
  91. return render_extra_js(context)
  92. __M_writer = context.writer()
  93. __M_writer('\n <script src="https://cdnjs.cloudflare.com/ajax/libs/Flowtype.js/1.1.0/flowtype.min.js"></script>\n <script>\n $(\'#scrolling-cont\').flowtype({\n minimum: 500,\n maximum: 1200,\n minFont: 20,\n maxFont: 40,\n fontRatio: 50\n });\n $(document).ready(function() {\n var elem = $(\'#scrolling-cont\');\n elem.click(function(event) {\n var x1 = elem.position().left;\n var pw = elem.width() + 20;\n var x2 = event.pageX;\n if (x2 - x1 < pw / 2) {\n pw = -pw;\n }\n elem.animate({\n scrollLeft: \'+=\' + pw\n }, 500)\n });\n });\n </script>\n')
  94. return ''
  95. finally:
  96. context.caller_stack._pop_frame()
  97. """
  98. __M_BEGIN_METADATA
  99. {"filename": "templates/book.tmpl", "uri": "book.tmpl", "source_encoding": "utf-8", "line_map": {"23": 2, "26": 3, "29": 4, "35": 0, "48": 2, "49": 3, "50": 4, "51": 5, "56": 77, "61": 90, "66": 117, "72": 7, "79": 7, "80": 8, "81": 8, "87": 79, "94": 79, "95": 84, "96": 84, "97": 85, "98": 85, "104": 92, "110": 92, "116": 110}}
  100. __M_END_METADATA
  101. """