Files
pages/templates/pages/print.gohtml
T
Anya Tokugawa c1175d389f Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
2026-09-27 14:44:43 +09:00

75 lines
5.9 KiB
Go Template
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{ define "print.gohtml" }}
<!doctype html>
<html lang="{{ .Locale }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/static/css/theme/base.css">
<link rel="stylesheet" href="{{ .ThemeCSS }}">
<link rel="stylesheet" href="/static/css/content-viewer.css">
<script defer src="/static/js/content-viewer.js"></script>
<style>
body { margin: 0; background: var(--bg); color: var(--fg); }
.print-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 1rem; border-bottom: 1px solid var(--border-soft); background: var(--panel); }
.print-document { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.print-meta { margin-bottom: 1.5rem; color: var(--muted); font-size: .82rem; }
.print-code { overflow-wrap: anywhere; white-space: pre-wrap; tab-size: 4; }
.print-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.print-table th, .print-table td { padding: .3rem .45rem; border: 1px solid var(--border-soft); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.print-image { display: block; max-width: 100%; height: auto; margin: auto; }
.print-media-note { padding: 1rem; border: 1px solid var(--border-soft); }
.print-pdf { width: 100%; min-height: 80vh; border: 0; }
@page { margin: 15mm; }
@media print {
.print-toolbar { display: none !important; }
body { background: white; color: black; }
.print-document { max-width: none; padding: 0; }
.print-meta { color: #555; }
a { color: inherit; text-decoration: none; }
.excalidraw-plugin-frame { min-height: 180mm; border: 0; }
.print-table tr, .print-image { break-inside: avoid; }
}
</style>
</head>
<body>
<header class="print-toolbar"><span>{{ .Path }}</span><span class="print-actions">{{ if and .SocialMetadata .SocialMetadata.URL }}<a href="https://twitter.com/intent/tweet?url={{ .SocialMetadata.URL | urlquery }}&text={{ .SocialMetadata.ShareText | urlquery }}" target="_blank" rel="noopener noreferrer" title="{{ T "viewer.share" }}" aria-label="{{ T "viewer.share" }}">𝕏</a>{{ end }}<button type="button" data-print-document title="{{ T "viewer.print" }}" aria-label="{{ T "viewer.print" }}">{{ T "viewer.print" }}</button></span></header>
<script>document.querySelector('[data-print-document]').addEventListener('click',()=>window.print());</script>
<main class="print-document">
<div class="print-meta">{{ .ContentView.Filename }} · {{ .ContentView.ContentType }} · rev:{{ .Revision.UUID }}</div>
{{ if eq .ContentView.Kind "html" }}
<article class="page-html">{{ .RenderedHTML }}</article>
{{ else if eq .ContentView.Kind "code" }}
<pre class="print-code"><code>{{ .ContentView.Text }}</code></pre>
{{ if .ContentView.Windowed }}<p>{{ T "viewer.print_truncated" }}</p>{{ end }}
{{ else if eq .ContentView.Kind "csv" }}
<table class="print-table">{{ range $rowIndex, $row := .ContentView.CSVRows }}<tr>{{ range $row }}{{ if eq $rowIndex 0 }}<th>{{ . }}</th>{{ else }}<td>{{ . }}</td>{{ end }}{{ end }}</tr>{{ end }}</table>
{{ if .ContentView.CSVTruncated }}<p>{{ T "viewer.csv_truncated" }}</p>{{ end }}
{{ else if eq .ContentView.Kind "image" }}
<img class="print-image" src="{{ .ContentView.RawURL }}" alt="{{ .ContentView.Filename }}">
{{ else if eq .ContentView.Kind "pdf" }}
<iframe class="print-pdf" src="{{ .ContentView.RawURL }}" title="{{ .ContentView.Filename }}"></iframe>
{{ else if eq .ContentView.Kind "excalidraw" }}
{{ if .ContentView.ExcalidrawValid }}
<div class="excalidraw-plugin-host" data-excalidraw-plugin-host>
<iframe class="excalidraw-plugin-frame" data-excalidraw-plugin src="/_/adaptor/excalidraw/?url={{ .ContentView.RawURL | urlquery }}" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer" title="{{ .ContentView.Filename }}"></iframe>
<div class="excalidraw-viewer" data-excalidraw-viewer data-excalidraw-fallback hidden><canvas data-excalidraw-canvas></canvas><textarea data-excalidraw-source hidden>{{ .ContentView.Text }}</textarea></div>
</div>
{{ else }}<p>{{ .ContentView.ParseError }}</p><pre class="print-code"><code>{{ .ContentView.Text }}</code></pre>{{ end }}
{{ else if eq .ContentView.Kind "archive" }}
<div data-archive-metadata data-metadata-url="{{ .ContentView.MetadataURL }}" data-metadata-status="{{ .ContentView.MetadataStatus }}" data-loading-label="{{ T "viewer.metadata_pending" }}" data-failed-label="{{ T "viewer.metadata_failed" }}" data-unavailable-label="{{ T "viewer.metadata_unavailable" }}" data-truncated-label="{{ T "viewer.archive_truncated" }}">
<p data-projection-status aria-live="polite">{{ if eq .ContentView.MetadataStatus "pending" }}{{ T "viewer.metadata_pending" }}{{ else if eq .ContentView.MetadataStatus "failed" }}{{ T "viewer.metadata_failed" }}{{ else if eq .ContentView.MetadataStatus "unavailable" }}{{ T "viewer.metadata_unavailable" }}{{ else }}{{ .ContentView.ParseError }}{{ end }}</p><button type="button" data-projection-retry hidden>{{ T "config.retry" }}</button>
<table class="print-table"><thead><tr><th>{{ T "viewer.entry" }}</th><th>{{ T "viewer.size" }}</th></tr></thead><tbody data-archive-entries>{{ range .ContentView.ArchiveEntries }}<tr><td>{{ .Name }}</td><td>{{ .Size }}</td></tr>{{ end }}</tbody></table>
</div>
{{ else if or (eq .ContentView.Kind "audio") (eq .ContentView.Kind "video") }}
<div class="print-media-note"><strong>{{ .ContentView.Filename }}</strong><br><a href="{{ .ContentView.RawURL }}">{{ .ContentView.RawURL }}</a></div>
{{ else if or (eq .ContentView.Kind "email") (eq .ContentView.Kind "metadata") }}
<dl>{{ range .ContentView.Metadata }}<dt>{{ .Name }}</dt><dd>{{ .Value }}</dd>{{ end }}</dl>{{ if .ContentView.Text }}<pre class="print-code">{{ .ContentView.Text }}</pre>{{ end }}
{{ else }}
<p>{{ .ContentView.ParseError }}</p><a href="{{ .ContentView.RawURL }}" download="{{ .ContentView.Filename }}">{{ T "viewer.download" }}</a>
{{ end }}
</main>
</body>
</html>
{{ end }}