0
1
Fork 0
textfiles/layouts/_default/list.html

367 lines
19 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{{/*
Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
This file is part of After Dark.
After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/}}
{{ define "header" }}
{{ partial "masthead.html" . }}
<style>
header {
display: flex;
justify-content: space-between;
align-items: baseline;
}
</style>
{{ if .Params.tablehighlight }}
{{/* Used for Top 100 */}}
<style>
table tbody td:last-of-type::first-line {
font-weight: bold;
}
</style>
{{ end }}
{{ if in .Params.tabledata "etext_" }}
<style>
body {
color: #DDD !important;
background-color: var(--page-bg-color);
}
body.light {
color: #000 !important;
}
b a:visited,
a:link {
color: #999;
}
a:active {
color: #DDD;
}
a:visited {
color: #DDD;
}
h1 {
text-transform: uppercase;
text-align: center;
}
h1.author {
text-align: left;
}
ol[itemtype$="BreadcrumbList"] li a {
color: #999 !important;
}
table {
width: 100%;
margin-top: 40px;
}
table th {
text-align: left;
color: #000;
}
table tfoot td {
background-color: #777 !important;
color: #000;
}
body.dark table th:nth-of-type(1) {
background-color: #FFF !important;
}
body.dark table th:nth-of-type(2) {
background-color: #DDD !important;
}
body.dark table th:nth-of-type(3) {
background-color: #AAA !important;
}
</style>
{{ end }}
{{ end }}
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
{{ partialCached "theme-toggle.html" . }}
</header>
{{ partial "breadcrumb.html" . }}
{{ .Content }}
{{ $tabledata := (index site.Data (default "" .Params.tabledata)) }}
{{ if ne (len $tabledata) 0 }}
<table itemscope itemtype="https://schema.org/Collection">
<thead>
<tr>
<th scope="col">Filename</th>
<th scope="col">Size</th>
<th scope="col">Description of the Textfile</th>
</tr>
</thead>
<tbody>
{{ $scratch := newScratch }}
{{ range $tabledata }}
<tr itemscope
{{- if eq .size nil }}
itemtype="https://schema.org/Collection"
{{- else }}
itemtype="https://schema.org/TextDigitalDocument"
{{- end -}}
>
<td itemprop="name">
{{/* Output filnames. Mark missing. */}}
{{ if eq .size nil }}
<b><a href="./{{ .filename }}/">{{ .filename }}</a></b>
{{ else if $.Resources.GetMatch .filename }}
{{ $scratch.Add "numFiles" 1 }}
{{ if gt .size 0 }}
{{/* Sanitize path for bbs/DELAM/CAPTURES/mit#s and the like */}}
{{ $sanitized_filename := replace .filename "#" "_" }}
{{/* Sanitize path for piracy/NFO/b%d and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "%" "_" }}
{{/* Sanitize path for piracy/NFO/&pentium.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "&" "_" }}
{{/* Sanitize path for piracy/NFO/bpc'95.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "'" "_" }}
{{/* Sanitize path for piracy/NFO/tf^t-rel.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "^" "_" }}
{{/* Sanitize path for piracy/NFO/_$ynd.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "$" "_" }}
{{/* Sanitize path for piracy/NFO/_·klan·_ and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "·" "_" }}
{{/* Sanitize path for bbs/ADS/@tribe@.now and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "@" "_" }}
{{/* Sanitize path for bbs/ADS/ei9yeƒ°£.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "ƒ" "_" }}
{{ $sanitized_filename = replace $sanitized_filename "°" "_" }}
{{ $sanitized_filename = replace $sanitized_filename "£" "_" }}
{{/* Sanitize path for bbs/ADS/jetswhq.þþ and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "þ" "_" }}
{{/* Sanitize path for bbs/ADS/u¿gita+.nf° and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "¿" "_" }}
{{ $sanitized_filename = replace $sanitized_filename "+" "_" }}
{{/* Sanitize path for bbs/ADS/x¯nocid¯.inc and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "¯" "_" }}
{{/* Sanitize path for bbs/ADS/¦-¦ello.132 and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "¦" "_" }}
{{/* Sanitize path for bbs/ADS/’of.bbs.html and the like */}}
{{/* Use decodeURI('%c2%92') in browser console to get replacement character */}}
{{ $sanitized_filename = replace $sanitized_filename "’" "_" }}
{{/* Sanitize path for bbs/ADS/¹.out and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "¹" "_" }}
{{/* Sanitize path for bbs/ADS/Æßµ$$.´ƒÝ and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "´" "_" }}
{{/* Sanitize path for piracy/CRACKING/¨cal!go¨.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "¨" "_" }}
{{/* Sanitize path for bbs/ADS/σ¦¦Ô«¾Õ.nfo and the like */}}
{{/* Use decodeURI('%c2%92') in browser console to get replacement character */}}
{{ $sanitized_filename = replace $sanitized_filename "«" "_" }}
{{ $sanitized_filename = replace $sanitized_filename "¾" "_" }}
{{/* {{ anchorize $sanitized_filename }} */}}
{{/* Sanitize path for bbs/ADS/cc_s_.txt.html and the like */}}
{{/* XXX: Below causes issues with !prefixed items in bbs/ADS */}}
{{/* $sanitized_filename = replace $sanitized_filename "!" "_" */}}
{{/* Sanitize path for piracy/NFO/&PENTIUM.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "_PENTIUM.NFO" "__PENTIUM.NFO" }}
{{/* Sanitize path for bbs/ADS/cc's!.txt */}}
{{ $sanitized_filename = replace $sanitized_filename "cc_s!.txt" "cc_s_.txt" }}
{{/* Sanitize path for bbs/ADS/strike!.ßßs */}}
{{ $sanitized_filename = replace $sanitized_filename "strike!.ßßs" "strike_.ßßs" }}
{{/* Sanitize path for "bbs/ADS/¶¡ßÚ$!§ .½ ¼" */}}
{{ $sanitized_filename = replace $sanitized_filename "¶¡ßÚ_!§ .½ ¼" "__ßÚ____.___" }}
{{/* Sanitize path for "bbs/ADS/¿spam!.txt" */}}
{{ $sanitized_filename = replace $sanitized_filename "_spam!.txt" "_spam_.txt" }}
{{/* Sanitize path for bbs/ADS/ׯÞÓ§¡ÓÞ.Ú×· */}}
{{ $sanitized_filename = replace $sanitized_filename "×_ÞÓ§¡ÓÞ.Ú×_" "___Ó__Ó_.Ú__" }}
{{/* Sanitize path for bbs/ADS/ׯÞÓ§¡ÓÞ.Ú×· */}}
{{ $sanitized_filename = replace $sanitized_filename "ÙÕÞÝÕÕµ_.nfo" "ÙÕ_ÝÕÕ__.nfo" }}
{{/* Sanitize path for bbs/ADS/ßl0wmÕßi.tch */}}
{{ $sanitized_filename = replace $sanitized_filename "ßl0wmÕßi.tch" "_ßl0wmÕßi.tch" }}
{{/* Sanitize path for piracy/NFO/NX_0294.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "NX!0294.NFO" "_NX_0294.NFO" }}
{{/* Sanitize path for piracy/NFO/NX_1193.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "NX!1193.NFO" "_NX_1193.NFO" }}
{{/* Sanitize path for piracy/NFO/NX_11932.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "NX!11932.NFO" "_NX_11932.NFO" }}
{{/* Sanitize path for piracy/CRACKING/¨cal!go¨.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "_cal!go_.nfo" "_cal_go_.nfo" }}
{{/* Sanitize path for piracy/CRACKING/¨cal!go¨.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "t!tutor.txt" "t_tutor.txt" }}
{{/* Sanitize path for groups/PHAIT/dontpay!.pht */}}
{{ $sanitized_filename = replace $sanitized_filename "dontpay!.pht" "dontpay_.pht" }}
{{/* Sanitize path for groups/PHAIT/lack!.pht */}}
{{ $sanitized_filename = replace $sanitized_filename "lack!.pht" "lack_.pht" }}
{{/* Sanitize path for groups/OCTOTHORPE/blood! */}}
{{ $sanitized_filename = replace $sanitized_filename "blood!" "blood_" }}
{{/* Sanitize path for piracy/NFO/NEXUS.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "NEXUS.NFO" "_NEXUS.NFO" }}
{{/* Sanitize path for piracy/NFO/PIL.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "PIL.NFO" "_PIL.NFO" }}
{{/* Sanitize path for piracy/NFO/USAW.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "USAW.NFO" "_USAW.NFO" }}
{{/* Sanitize path for piracy/NFO/WINDOWS.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "WINDOWS.NFO" "_WINDOWS.NFO" }}
{{/* Sanitize path for piracy/NFO/INDYCAR.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "INDYCAR.NFO" "_INDYCAR.NFO" }}
{{/* Sanitize path for piracy/NFO/F14.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "F14.NFO" "_F14.NFO" }}
{{/* Sanitize path for piracy/NFO/BOMB.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "BOMB.NFO" "_BOMB.NFO" }}
{{/* Sanitize path for piracy/NFO/BARON1.NFO */}}
{{ $sanitized_filename = replace $sanitized_filename "BARON1.NFO" "_BARON1.NFO" }}
{{/* See textfile.html for companion sanitization logic */}}
{{ $path := path.Join $.RelPermalink $sanitized_filename }}
{{ if fileExists (printf "%s.md" $path) }}
{{ if ge .size 1000000 }}
<a download="{{ .filename }}" href="./{{ $sanitized_filename }}">
{{- .filename -}}
<svg style="margin: 0 0 -3px 5px;color:var(--breadcrumb-link-color)" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="18" height="18" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<path d="M9 22 C0 23 1 12 9 13 6 2 23 2 22 10 32 7 32 23 23 22 M11 26 L16 30 21 26 M16 16 L16 30" />
</svg>
</a>
{{ else }}
{{ if eq " machu.nfo" .filename }}
{{/* Sanitize path for piracy/NFO/ machu.nfo */}}
{{ $href := (site.GetPage (printf "%s.md" .filename)).RelPermalink }}
<a href="{{ $href }}">{{ .filename }}</a>
{{ else if eq "quÛÙr¡££.¡Ú´" .filename }}
{{/* Sanitize path for piracy/NFO/quÛÙr¡££.¡Ú´ */}}
{{ $href := (site.GetPage (printf "%s.md" .filename)).RelPermalink }}
<a href="{{ $href }}">{{ .filename }}</a>
{{ else if eq .filename "pwa ehq .  " }}
{{/* Sanitize path for piracy/NFO/pwa%c2%a0ehq%c2%a0.%c2%a0%c2%a0 */}}
{{/* Use decodeURI('%c2%a0') in browser console to get the character for the matcher */}}
{{ $href := (site.GetPage (printf "%s.md" .filename)).RelPermalink }}
<a href="{{ $href }}">{{ .filename }}</a>
{{ else if eq .filename " l­s­d­ .nfo" }}
{{/* Sanitize path for http://localhost:39309/piracy/COURIERS/%c2%a0l%c2%ads%c2%add%c2%ad%c2%a0.nfo */}}
{{/* Use decodeURI('%c2%a0') in browser console to get the character for the matcher */}}
{{ $href := (site.GetPage (printf "%s.md" .filename)).RelPermalink }}
<a href="{{ $href }}">{{ .filename }}</a>
{{ else if in $sanitized_filename "!" }}
{{/* Sanitize path for piracy/NFO/omega!.nfo and the like */}}
{{ $sanitized_filename = replace $sanitized_filename "!" "_" }}
<a href="{{ $sanitized_filename }}.html">{{ .filename }}</a>
{{ else }}
<a href="./{{ printf "%s.html" $sanitized_filename }}">{{ .filename }}</a>
{{ end }}
{{ end }}
{{ else }}
{{ if ge .size 1000000 }}
{{/* This triggers for hacking/jargon211.hac for example */}}
<a download="{{ .filename }}" href="./{{ $sanitized_filename }}">
{{- .filename -}}
<svg style="margin: 0 0 -3px 5px;color:var(--breadcrumb-link-color)" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="18" height="18" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<path d="M9 22 C0 23 1 12 9 13 6 2 23 2 22 10 32 7 32 23 23 22 M11 26 L16 30 21 26 M16 16 L16 30" />
</svg>
</a>
{{ else }}
{{/* This triggers for bbs/ADS/$legal$.nfo for example */}}
{{/* This also triggers for "bbs/ADS/¶¡ßÚ$!§ .½ ¼" */}}
<a href="./{{ $sanitized_filename }}">{{ .filename }}</a>
{{ end }}
{{ end }}
{{ else }}
<mark>{{ .filename }}</mark>
{{ end }}
{{ else }}
{{ $scratch.Add "numFiles" 1 }}
{{/* Sanitize path for computers/PRESSRELEASE/#9-3ddoc.txt and the like */}}
{{/* See textfile.html for companion sanitization logic */}}
{{ if eq .filename "#9-3ddoc.txt" }}
{{ $sanitized_filename := replace .filename "#" "_" }}
<a href="{{ printf "./%s.html" $sanitized_filename }}">{{ .filename }}</a>
{{ else }}
{{/* Sanitize path for bbs/ADS/drugs.{o} */}}
{{ $sanitized_filename := replace .filename "{o}" "_o_" }}
{{ $path := path.Join $.RelPermalink $sanitized_filename }}
{{ if fileExists (printf "%s.md" $path) }}
<a href="./{{ printf "%s.html" $sanitized_filename }}">{{ .filename }}</a>
{{ else }}
<mark>{{ .filename }}</mark>
{{ end }}
{{ end }}
{{ end }}
</td>
{{/* Output filesizes. Mark unexpected. */}}
<td>
{{ if (fileExists (printf "%s%s" $.RelPermalink .filename)) }}
{{ $fileInfo := os.Stat (printf "%s%s" $.RelPermalink .filename) }}
{{ if not $fileInfo.IsDir }}
{{ $scratch.Add "totalBytes" $fileInfo.Size }}
{{ if eq (int .size) $fileInfo.Size }}
{{ $fileInfo.Size }}
{{ else }}
<s>{{ int .size }}</s><mark>{{ $fileInfo.Size }}</mark>
{{ end }}
{{ else }}
{{ $scratch.Add "numDirs" 1 }}
./..
{{ end }}
{{ end }}
</td>
<td itemprop="description">
{{ if eq .size nil }}
<b>{{ .description | safeHTML }}</b>
{{ else }}
{{ .description | safeHTML }}
{{ end }}
</td>
</tr>
{{ end }}
</tbody>
<tfoot>
<tr>
<td colspan="3">
{{/* Output filesize total and directory count. Mark modified. */}}
{{/* Compare calculated value with category indicies frontmatter. */}}
<small>
{{- $num_files := int ($scratch.Get "numFiles") -}}
{{- $total_bytes := (default 0 ($scratch.Get "totalBytes")) | lang.NumFmt 0 -}}
{{- $num_dirs := int ($scratch.Get "numDirs") -}}
{{- $file_word := cond (eq 1 $num_files) "file" "files" -}}
{{- $file_isare := cond (eq 1 $num_files) "is" "are" -}}
{{- $dir_word := cond (eq 1 $num_dirs) "directory" "directories" -}}
{{- $dir_isare := cond (eq 1 $num_dirs) "is" "are" -}}
{{- $computed_string := "" -}}
{{- if ne 0 $num_files -}}
{{- $computed_string = printf "There %s %v %s for a total of %s bytes." $file_isare $num_files $file_word $total_bytes -}}
{{- end -}}
{{- if ne 0 $num_dirs -}}
{{- $break_maybe := cond (eq 0 $num_files) "" "<br>" -}}
{{- $temp_string := printf "%sThere %s %v %s." $break_maybe $dir_isare $num_dirs $dir_word -}}
{{- $computed_string = printf "%s%s" $computed_string $temp_string -}}
{{ end }}
{{- if eq $computed_string .Params.tablefooter -}}
{{- $computed_string | safeHTML -}}
{{- else -}}
<s>{{ .Params.tablefooter | safeHTML }}</s><br>
<mark>{{ $computed_string | safeHTML }}</mark>
{{- end -}}
</small>
</td>
</tr>
</tfoot>
</table>
{{ end }}
{{ end }}
{{ define "footer" }}
{{ with .Params.pagefooter }}
<p>{{ . | safeHTML }}</p>
{{ end }}
{{ end }}