article.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {% extends "base.html" %}
  2. {% block title %}
  3. {{ article.title }} - {{ super() }}
  4. {% endblock title %}
  5. {% block content %}
  6. <script language="javascript" type="text/javascript">
  7. function moveTOC() {
  8. var table_of_contents = document.getElementById('contents');
  9. var toc_sidebar = document.getElementById('toc_sidebar');
  10. if (table_of_contents && toc_sidebar)
  11. toc_sidebar.appendChild(table_of_contents);
  12. }
  13. </script>
  14. <div class="row-fluid">
  15. <header class="page_header span12">
  16. <h1><a href="/{{ article.url }}"> {{ article.title }} {%if article.subtext %} <small> {{ article.subtext }} </small> {% endif %} </a></h1>
  17. </header>
  18. </div>
  19. <div class="row-fluid">
  20. <div class="span8 offset1 article-content">
  21. {{ article.content }}
  22. </div>
  23. <div class="span2 offset1">
  24. <h4>Published</h4>
  25. {% if article.date %}
  26. {% set day = article.date.strftime('%d')|int %}
  27. {% set suffix = ['st', 'nd', 'rd', 'th'] %}
  28. {{ article.date.strftime('%b') }} {{ day }}
  29. {%- if 4 <= day <= 20 or 24 <= day <= 30 -%} {{ suffix[3] }}
  30. {%- elif day % 10 - 1 == 0 -%} {{ suffix[0] }}
  31. {%- elif day % 10 - 1 == 1 -%} {{ suffix[1] }}
  32. {%- elif day % 10 - 1 == 2 -%} {{ suffix[2] }}
  33. {%- endif -%}
  34. {{ article.date.strftime(', %Y') }}
  35. {% endif %}
  36. {% if article.modified %}
  37. <h4>Last Updated</h4>
  38. {{ article.modified }}
  39. {% endif %}
  40. {% if article.category %}
  41. <h4>Category</h4>
  42. <a href="{{ SITEURL }}/categories.html#{{ category|replace(' ', '-')|e }}-ref">{{ article.category }}</a>
  43. {% endif %}
  44. {% if article.tags %}
  45. <h4>Tags</h4>
  46. <ul class="list-of-tags tags-in-article">
  47. {% for tag in article.tags %}
  48. <li><a href="/tags.html#{{ tag|replace(' ', '-')|e }}-ref">{{ tag }}
  49. {% for aTag, tagged_articles in tags if aTag == tag %}
  50. <span>{{ tagged_articles|count }}</span>
  51. {% endfor %}</a></li>
  52. {% endfor %}
  53. </ul>
  54. {% endif %}
  55. </div>
  56. </div>
  57. <script type="text/javascript" language="JavaScript">
  58. moveTOC();
  59. </script>
  60. {% endblock content %}