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.html.tera 1.3KB

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