The backend of a gist server written in Rust
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

show.html.tera 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. flex-wrap: wrap;
  14. font-family: serif;
  15. justify-content: space-between;
  16. margin-bottom: 10px;
  17. padding: 0;
  18. }
  19. .header__title {
  20. font-size: 28px;
  21. margin-right: 10px;
  22. }
  23. .header__date {
  24. font-size: 16px;
  25. font-weight: normal;
  26. margin-right: 10px;
  27. }
  28. .header__raw-link {
  29. font-size: 16px;
  30. font-weight: normal;
  31. }
  32. pre {
  33. background-color: #f5f5f5;
  34. counter-reset: line;
  35. font-size: 16px;
  36. margin: 0;
  37. padding: 15px;
  38. }
  39. pre code {
  40. counter-increment: line;
  41. }
  42. pre code:before {
  43. content: counter(line);
  44. margin-right: 10px;
  45. }
  46. </style>
  47. <meta name="viewport" content="width=device-width">
  48. </head>
  49. <body>
  50. <div class="container">
  51. <h1 class="header">
  52. <span class="header__title">{{ snippet.title }}</span>
  53. <div class="header__right">
  54. <span class="header__date">{{ snippet.created_at | date(format="%Y-%m-%d %H:%M:%S") }} UTC</span>
  55. <a class="header__raw-link" href="/snippets/{{ snippet.uuid }}/raw">
  56. view raw
  57. </a>
  58. </div>
  59. </h1>
  60. <div class="body">
  61. {% set length = context.lines | length - 1 %}
  62. {{ context.lines | first | safe }}{% for line in context.lines | slice(start=1, end=length) %}<code id="line-{{ loop.index }}">{{ line | safe }}</code>
  63. {% endfor %}</pre>
  64. </div>
  65. </div>
  66. </body>
  67. </html>