Chronological nethack logfile page

This commit is contained in:
Eryn Wells 2022-04-16 16:21:35 -07:00
parent a279e4bb11
commit d1dfea9f97
3 changed files with 85 additions and 54 deletions

View file

@ -1,43 +1,24 @@
{{ $nethack_logfile := $.Site.Data.nethack }}
<dl class="logfile">
{{ range sort $nethack_logfile.nutmeg.records "end_date" "desc" }}
{{ if ne .reason_for_death "quit" }}
<!-- <table class="logfile logentry">
<tr>
<td colspan=5>{{ time.Format "January 2, 2006" .end_date }}</td>
</tr>
<tr>
<td></td>
<td class="name" colspan=4>{{ .name }}, a {{ .alignment | lower }} {{ .race | lower }} {{ .gender | lower }} {{ .role }},
died {{ if gt .number_of_deaths 1 }}for the last time{{ end }} in <span class="nobreak">{{ .dungeon_name }}</span>
on <span class="nobreak">{{ if gt .level 0 }}{{ .level_descriptive | lower }}{{ else }}{{ .level_descriptive }}{{ end }}</span>.
{{ if eq .reason_for_death "quit" }}She quit.{{ else }}She was {{ .reason_for_death }}.{{ end }}</td>
</tr>
<tr>
<td></td>
<td class="began">Began {{ time.Format "January 2, 2006" .start_date }}</td>
<td class="score">{{ .score }} points</td>
<td class="level">Level {{ .max_level }}</td>
<td class="hp">{{ if gt .hit_points 0 }}{{ .hit_points }} / {{ end }}{{ .max_hit_points }} hp</td>
</tr>
</table> -->
<dt class="start-date">{{ time.Format "January 2, 2006" .end_date }}</dt>
<dd class="logentry">
{{ .name }}, a {{ .alignment | lower }} {{ .race | lower }} {{ .gender | lower }} {{ .role }},
died {{ if gt .number_of_deaths 1 }}for the last time{{ end }} in <span class="nobreak">{{ .dungeon_name }}</span>
on <span class="nobreak">{{ cond (gt .level 0) (.level_descriptive | lower) .level_descriptive }}</span>.
{{ cond (eq .reason_for_death "quit") "She quit." (printf "She was %s" .reason_for_death) }}.
<table class="stats">
<tr>
<td class="began">Began {{ time.Format "January 2, 2006" .start_date }}</td>
<td class="score">{{ .score }} points</td>
<td class="level">Level {{ .max_level }}</td>
<td class="hp">{{ cond (gt .hit_points 0) (printf "%s / %s" .hit_points .max_hit_points) .max_hit_points }} hp</td>
</tr>
</table>
</dd>
{{ end }}
{{ end }}
</dl>
{{ $nethack_logfile := $.Site.Data.nethack.logfile.nutmeg }}
<ol class="logfile">
{{ range sort $nethack_logfile "end_date" "desc" }}
{{ if ne .death.cause "quit" }}
<li class="logentry">
<div>{{ if .death.cause }}🪦{{ end }}</div>
<h4 class="date">{{ time.Format "January 2, 2006" .end_date }}</h4>
<div class="character-descriptor">{{ .character.abbreviated }}</div>
<p>{{ .character.name }}, a {{ .character.alignment.descriptive | lower }} {{ .character.race.descriptive | lower }} {{ .character.gender.descriptive | lower }} {{ .character.role.descriptive }},
died {{ if gt .death.count 1 }}for the last time{{ end }} in <span class="nobreak">{{ .dungeon.name }}</span>
on <span class="nobreak">{{ cond (gt .dungeon.level.n 0) (.dungeon.level.descriptive | lower) .dungeon.level.descriptive }}</span>.
She was {{ .death.cause }}.</p>
<table class="stats">
<tr>
<td class="began">Began {{ time.Format "January 2, 2006" .start_date }}</td>
<td class="score">{{ .score }} points</td>
<td class="level">Level {{ .character.max_level }}</td>
<td class="hp">{{ cond (gt .character.hp.n 0) (printf "%s / %s" .character.hp.n .character.hp.max) .character.hp.max }} hp</td>
</tr>
</table>
</li>
{{ end }}
{{ end }}
</ol>