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

post.tmpl.py 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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.1278715
  9. _enable_loop = True
  10. _template_filename = 'themes/bootblog/templates/post.tmpl'
  11. _template_uri = 'post.tmpl'
  12. _source_encoding = 'utf-8'
  13. _exports = ['extra_head', 'content', 'sourcelink']
  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. ns = runtime.TemplateNamespace('math', context._clean_inheritance_tokens(), templateuri='math_helper.tmpl', callables=None, calling_uri=_template_uri)
  28. context.namespaces[(__name__, 'math')] = ns
  29. def _mako_inherit(template, context):
  30. _mako_generate_namespaces(context)
  31. return runtime._inherit_from(context, 'base.tmpl', _template_uri)
  32. def render_body(context,**pageargs):
  33. __M_caller = context.caller_stack._push_frame()
  34. try:
  35. __M_locals = __M_dict_builtin(pageargs=pageargs)
  36. math = _mako_get_namespace(context, 'math')
  37. parent = context.get('parent', UNDEFINED)
  38. messages = context.get('messages', UNDEFINED)
  39. def extra_head():
  40. return render_extra_head(context._locals(__M_locals))
  41. comments = _mako_get_namespace(context, 'comments')
  42. post = context.get('post', UNDEFINED)
  43. helper = _mako_get_namespace(context, 'helper')
  44. pheader = _mako_get_namespace(context, 'pheader')
  45. def content():
  46. return render_content(context._locals(__M_locals))
  47. site_has_comments = context.get('site_has_comments', UNDEFINED)
  48. def sourcelink():
  49. return render_sourcelink(context._locals(__M_locals))
  50. show_sourcelink = context.get('show_sourcelink', UNDEFINED)
  51. __M_writer = context.writer()
  52. __M_writer('\n')
  53. __M_writer('\n')
  54. __M_writer('\n')
  55. __M_writer('\n')
  56. __M_writer('\n\n')
  57. if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_head'):
  58. context['self'].extra_head(**pageargs)
  59. __M_writer('\n\n')
  60. if 'parent' not in context._data or not hasattr(context._data['parent'], 'content'):
  61. context['self'].content(**pageargs)
  62. __M_writer('\n\n')
  63. if 'parent' not in context._data or not hasattr(context._data['parent'], 'sourcelink'):
  64. context['self'].sourcelink(**pageargs)
  65. __M_writer('\n')
  66. return ''
  67. finally:
  68. context.caller_stack._pop_frame()
  69. def render_extra_head(context,**pageargs):
  70. __M_caller = context.caller_stack._push_frame()
  71. try:
  72. post = context.get('post', UNDEFINED)
  73. math = _mako_get_namespace(context, 'math')
  74. helper = _mako_get_namespace(context, 'helper')
  75. parent = context.get('parent', UNDEFINED)
  76. def extra_head():
  77. return render_extra_head(context)
  78. __M_writer = context.writer()
  79. __M_writer('\n ')
  80. __M_writer(str(parent.extra_head()))
  81. __M_writer('\n')
  82. if post.meta('keywords'):
  83. __M_writer(' <meta name="keywords" content="')
  84. __M_writer(filters.html_escape(str(post.meta('keywords'))))
  85. __M_writer('">\n')
  86. if post.description():
  87. __M_writer(' <meta name="description" itemprop="description" content="')
  88. __M_writer(str(post.description()))
  89. __M_writer('">\n')
  90. __M_writer(' <meta name="author" content="')
  91. __M_writer(str(post.author()))
  92. __M_writer('">\n')
  93. if post.prev_post:
  94. __M_writer(' <link rel="prev" href="')
  95. __M_writer(str(post.prev_post.permalink()))
  96. __M_writer('" title="')
  97. __M_writer(filters.html_escape(str(post.prev_post.title())))
  98. __M_writer('" type="text/html">\n')
  99. if post.next_post:
  100. __M_writer(' <link rel="next" href="')
  101. __M_writer(str(post.next_post.permalink()))
  102. __M_writer('" title="')
  103. __M_writer(filters.html_escape(str(post.next_post.title())))
  104. __M_writer('" type="text/html">\n')
  105. if post.is_draft:
  106. __M_writer(' <meta name="robots" content="noindex">\n')
  107. __M_writer(' ')
  108. __M_writer(str(helper.open_graph_metadata(post)))
  109. __M_writer('\n ')
  110. __M_writer(str(helper.twitter_card_information(post)))
  111. __M_writer('\n ')
  112. __M_writer(str(helper.meta_translations(post)))
  113. __M_writer('\n ')
  114. __M_writer(str(math.math_styles_ifpost(post)))
  115. __M_writer('\n')
  116. return ''
  117. finally:
  118. context.caller_stack._pop_frame()
  119. def render_content(context,**pageargs):
  120. __M_caller = context.caller_stack._push_frame()
  121. try:
  122. math = _mako_get_namespace(context, 'math')
  123. messages = context.get('messages', UNDEFINED)
  124. comments = _mako_get_namespace(context, 'comments')
  125. post = context.get('post', UNDEFINED)
  126. helper = _mako_get_namespace(context, 'helper')
  127. site_has_comments = context.get('site_has_comments', UNDEFINED)
  128. def content():
  129. return render_content(context)
  130. pheader = _mako_get_namespace(context, 'pheader')
  131. __M_writer = context.writer()
  132. __M_writer('\n<article class="post-')
  133. __M_writer(str(post.meta('type')))
  134. __M_writer(' h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article">\n ')
  135. __M_writer(str(pheader.html_post_header()))
  136. __M_writer('\n <div class="e-content entry-content" itemprop="articleBody text">\n ')
  137. __M_writer(str(post.text()))
  138. __M_writer('\n </div>\n <aside class="postpromonav">\n <nav>\n ')
  139. __M_writer(str(helper.html_tags(post)))
  140. __M_writer('\n ')
  141. __M_writer(str(helper.html_pager(post)))
  142. __M_writer('\n </nav>\n </aside>\n')
  143. if not post.meta('nocomments') and site_has_comments:
  144. __M_writer(' <section class="comments hidden-print">\n <h2>')
  145. __M_writer(str(messages("Comments")))
  146. __M_writer('</h2>\n ')
  147. __M_writer(str(comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)))
  148. __M_writer('\n </section>\n')
  149. __M_writer(' ')
  150. __M_writer(str(math.math_scripts_ifpost(post)))
  151. __M_writer('\n</article>\n')
  152. __M_writer(str(comments.comment_link_script()))
  153. __M_writer('\n')
  154. return ''
  155. finally:
  156. context.caller_stack._pop_frame()
  157. def render_sourcelink(context,**pageargs):
  158. __M_caller = context.caller_stack._push_frame()
  159. try:
  160. post = context.get('post', UNDEFINED)
  161. def sourcelink():
  162. return render_sourcelink(context)
  163. show_sourcelink = context.get('show_sourcelink', UNDEFINED)
  164. messages = context.get('messages', UNDEFINED)
  165. __M_writer = context.writer()
  166. __M_writer('\n')
  167. if show_sourcelink:
  168. __M_writer(' <a href="')
  169. __M_writer(str(post.source_link()))
  170. __M_writer('" class="blog-nav-item blog-nav-item-aside" id="sourcelink">')
  171. __M_writer(str(messages("Source")))
  172. __M_writer('</a>\n')
  173. return ''
  174. finally:
  175. context.caller_stack._pop_frame()
  176. """
  177. __M_BEGIN_METADATA
  178. {"filename": "themes/bootblog/templates/post.tmpl", "uri": "post.tmpl", "source_encoding": "utf-8", "line_map": {"23": 2, "26": 3, "29": 4, "32": 5, "38": 0, "58": 2, "59": 3, "60": 4, "61": 5, "62": 6, "67": 30, "72": 53, "77": 59, "83": 8, "93": 8, "94": 9, "95": 9, "96": 10, "97": 11, "98": 11, "99": 11, "100": 13, "101": 14, "102": 14, "103": 14, "104": 16, "105": 16, "106": 16, "107": 17, "108": 18, "109": 18, "110": 18, "111": 18, "112": 18, "113": 20, "114": 21, "115": 21, "116": 21, "117": 21, "118": 21, "119": 23, "120": 24, "121": 26, "122": 26, "123": 26, "124": 27, "125": 27, "126": 28, "127": 28, "128": 29, "129": 29, "135": 32, "148": 32, "149": 33, "150": 33, "151": 34, "152": 34, "153": 36, "154": 36, "155": 40, "156": 40, "157": 41, "158": 41, "159": 44, "160": 45, "161": 46, "162": 46, "163": 47, "164": 47, "165": 50, "166": 50, "167": 50, "168": 52, "169": 52, "175": 55, "184": 55, "185": 56, "186": 57, "187": 57, "188": 57, "189": 57, "190": 57, "196": 190}}
  179. __M_END_METADATA
  180. """