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.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. padding: 15px;
  11. }
  12. .header__raw-link {
  13. font-size: 16px;
  14. font-weight: normal;
  15. }
  16. pre {
  17. counter-reset: line;
  18. font-size: 16px;
  19. padding: 15px;
  20. }
  21. pre code {
  22. counter-increment: line;
  23. }
  24. pre code:before {
  25. content: counter(line);
  26. margin-right: 10px;
  27. }
  28. </style>
  29. <meta name="viewport" content="width=device-width">
  30. </head>
  31. <body>
  32. <div class="container">
  33. <h1 class="header">
  34. {% if context %}
  35. {{ context.snippet.title }}
  36. <a class="header__raw-link" href="/snippets/{{ context.snippet.id }}/raw">raw</a>
  37. {% else %}
  38. 404 - snippet not found
  39. {% endif %}
  40. </h1>
  41. {% if context %}
  42. <div class="body">
  43. {% set length = context.lines | length - 1 %}
  44. {{ context.lines | first | safe }}{% for line in context.lines | slice(start=1, end=length) %}<code id="line-{{ loop.index }}">{{ line | safe }}</code>
  45. {% endfor %}</pre>
  46. </div>
  47. {% endif %}
  48. </div>
  49. </body>
  50. </html>