The backend of a gist server written in Rust
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

show.tera 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <html>
  2. <head>
  3. <title>{% if context %}{{ context.snippet.title }}{% else %}404 - snippet not found{% endif %}</title>
  4. <style>
  5. .container {
  6. margin: auto;
  7. max-width: 800px;
  8. }
  9. .header {
  10. align-items: baseline;
  11. display: flex;
  12. justify-content: space-between;
  13. padding: 15px;
  14. }
  15. .header__raw-link {
  16. font-size: 16px;
  17. font-weight: normal;
  18. }
  19. pre {
  20. background-color: #f5f5f5;
  21. counter-reset: line;
  22. font-size: 16px;
  23. padding: 15px;
  24. }
  25. pre code {
  26. counter-increment: line;
  27. }
  28. pre code:before {
  29. content: counter(line);
  30. margin-right: 10px;
  31. }
  32. </style>
  33. <meta name="viewport" content="width=device-width">
  34. </head>
  35. <body>
  36. <div class="container">
  37. <h1 class="header">
  38. {% if context %}
  39. {{ context.snippet.title }}
  40. <a class="header__raw-link" href="/snippets/{{ context.snippet.id }}/raw">raw</a>
  41. {% else %}
  42. 404 - snippet not found
  43. {% endif %}
  44. </h1>
  45. {% if context %}
  46. <div class="body">
  47. {% set length = context.lines | length - 1 %}
  48. {{ context.lines | first | safe }}{% for line in context.lines | slice(start=1, end=length) %}<code id="line-{{ loop.index }}">{{ line | safe }}</code>
  49. {% endfor %}</pre>
  50. </div>
  51. {% endif %}
  52. </div>
  53. </body>
  54. </html>