website
git clone https://git.pyrossh.dev/website
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
src/_includes/file-layout.njk
| 44991dd | 1 | {% macro fileLayout(repo, filepath, filename, ext, tab) %} |
| 44991dd | 2 | {% set base = "/repos/" + repo + "/files/" + filepath %} |
| 44991dd | 3 | <div class="file-layout"> |
| 44991dd | 4 | <div class="title">{{ filename | fileIcon(ext) | safe }}<span>{{ filename }}</span></div> |
| 44991dd | 5 | <div class="nav"> |
| 44991dd | 6 | <div><a href="{{ base }}/" hx-get="{{ base }}/" hx-select="#file-pane" hx-target="#file-pane" hx-swap="outerHTML" hx-push-url="true" aria-current="{% if tab == 'Contents' %}true{% else %}false{% endif %}">Contents</a></div> |
| 44991dd | 7 | <div>|</div> |
| 44991dd | 8 | <div><a href="{{ base }}/history/" hx-get="{{ base }}/history/" hx-select="#file-pane" hx-target="#file-pane" hx-swap="outerHTML" hx-push-url="true" aria-current="{% if tab == 'History' %}true{% else %}false{% endif %}">History</a></div> |
| 44991dd | 9 | <div>|</div> |
| 44991dd | 10 | <div><a href="{{ base }}/blame/" hx-get="{{ base }}/blame/" hx-select="#file-pane" hx-target="#file-pane" hx-swap="outerHTML" hx-push-url="true" aria-current="{% if tab == 'Blame' %}true{% else %}false{% endif %}">Blame</a></div> |
| 44991dd | 11 | </div> |
| 44991dd | 12 | </div> |
| 44991dd | 13 | {% endmacro %} |
| 3931c4d | 14 | |
| 3931c4d | 15 | {% macro fileContent(render, size, filepath) %} |
| 3931c4d | 16 | <div id="file-content"> |
| 3931c4d | 17 | {% if render.kind == "binary" %} |
| 3931c4d | 18 | <p>Binary file ({{ size }} bytes).</p> |
| 3931c4d | 19 | {% elif render.kind == "large" %} |
| 3931c4d | 20 | <p>File too large to display ({{ size }} bytes).</p> |
| 3931c4d | 21 | {% elif render.kind == "image" %} |
| 3931c4d | 22 | <img src="{{ render.src }}" alt="{{ filepath }}" /> |
| 3931c4d | 23 | {% else %} |
| 3931c4d | 24 | <pre class="code-view" data-lang="{{ render.lang }}"><code class="language-{{ render.lang }}">{{ render.html | safe }}</code></pre> |
| 3931c4d | 25 | {% endif %} |
| 3931c4d | 26 | </div> |
| 3931c4d | 27 | {% endmacro %} |