Get the nethack page looking good again
Update all the CSS classes and fix the layout so it looks good in the new theme. Convert a bunch of CSS classes to BEM style.
This commit is contained in:
parent
2b613de769
commit
d5296995de
10 changed files with 206 additions and 45 deletions
|
@ -1,10 +1,12 @@
|
|||
{{- $cause := .death.cause -}}
|
||||
{{- $didAscend := eq $cause "ascended" -}}
|
||||
{{- $level := (cond (gt .dungeon.level.n 0) (.dungeon.level.descriptive | lower) .dungeon.level.descriptive) -}}
|
||||
<div>{{- if $didAscend -}}✨{{- else -}}🪦{{- end -}}</div>
|
||||
<h4 class="date">{{ time.Format "January 2, 2006" .end_date }}</h4>
|
||||
<div class="character-descriptor">{{ .character.abbreviated }}</div>
|
||||
<p>
|
||||
<div class="nethack-logentry__marker">{{- if $didAscend -}}✨{{- else -}}🪦{{- end -}}</div>
|
||||
<h4 class="nethack-logentry__date">{{ time.Format "January 2, 2006" .end_date }}</h4>
|
||||
{{ with .character.descriptor -}}
|
||||
<p class="nethack-logentry__character-descriptor">{{ . }}</p>
|
||||
{{ end }}
|
||||
<p class="nethack-logentry__description">
|
||||
{{- $name := .character.name -}}
|
||||
{{- $descriptiveAlignment := .character.alignment.descriptive | lower -}}
|
||||
{{- $descriptiveRace := .character.race.descriptive | lower -}}
|
||||
|
@ -19,30 +21,52 @@
|
|||
She was {{ .death.cause }}.
|
||||
{{- end -}}
|
||||
</p>
|
||||
<table class="stats">
|
||||
<table class="nethack-logentry__stats">
|
||||
<thead>
|
||||
<tr>
|
||||
{{- $startDate := time.Format "January, 02 2006" .start_date -}}
|
||||
{{- $startDatetime := time.Format "2006-01-02" .start_date -}}
|
||||
<td class="began">Began <time class="nobreak" datetime="{{ $startDatetime }}">{{ $startDate }}</time></td>
|
||||
<td class="score">{{ .score | lang.FormatNumber 0 }} points</td>
|
||||
{{/*
|
||||
When I first wrote the importer script, I read about the log file
|
||||
format on the Nethackwiki. It labeled a field as "maximum level",
|
||||
which I interpreted as maximum character level. Turns out it's
|
||||
actually maximum *dungeon* level. The script has been updated, but I
|
||||
won't be able to update all the imported logfiles.
|
||||
|
||||
https://nethackwiki.com/wiki/Logfile
|
||||
*/}}
|
||||
{{ with .dungeon.max_level }}
|
||||
<td class="level">{{ .descriptive }}</td>
|
||||
<td class="nethack-logentry__began">{{ i18n "nethackBegan" }}</td>
|
||||
<td class="nethack-logentry__score">{{ i18n "nethackScore" }}</td>
|
||||
<td class="nethack-logentry__level">
|
||||
{{ if .dungeon.max_level }}
|
||||
{{ i18n "nethackDungeonLevel" }}
|
||||
{{ else }}
|
||||
{{ with .character.max_level }}<td class="level">Level {{ . }}</td>{{ end }}
|
||||
{{ i18n "nethackCharacterLevel" }}
|
||||
{{ end }}
|
||||
<td class="hp">
|
||||
{{- $hp := float .character.hp.n -}}
|
||||
{{- $hpMax := .character.hp.max -}}
|
||||
{{- if gt $hp 0 }}{{ $hp }} / {{ $hpMax }}{{ else }}{{ $hp }}{{ end }} hp
|
||||
</td>
|
||||
</td>
|
||||
<td class="nethack-logentry__hp">{{ i18n "nethackHP" }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="nethack-logentry__began">
|
||||
{{- $startDate := time.Format "2006-01-02" .start_date -}}
|
||||
{{- $startDatetime := time.Format "2006-01-02" .start_date -}}
|
||||
<time class="nobreak" datetime="{{ $startDatetime }}">{{ $startDate }}</time>
|
||||
</td>
|
||||
<td class="nethack-logentry__score">
|
||||
{{- .score | lang.FormatNumber 0 -}}
|
||||
</td>
|
||||
{{/*
|
||||
When I first wrote the importer script, I read about the log file
|
||||
format on the Nethackwiki. It labeled a field as "maximum level",
|
||||
which I interpreted as maximum character level. Turns out it's
|
||||
actually maximum *dungeon* level. The script has been updated, but I
|
||||
won't be able to update all the imported logfiles.
|
||||
|
||||
https://nethackwiki.com/wiki/Logfile
|
||||
*/}}
|
||||
{{ with .dungeon.max_level -}}
|
||||
<td class="nethack-logentry__level">{{ .n }}</td>
|
||||
{{ else -}}
|
||||
{{ with .character.max_level -}}
|
||||
<td class="nethack-logentry__level">{{ . }}</td>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<td class="nethack-logentry__hp">
|
||||
{{- $hp := float .character.hp.n -}}
|
||||
{{- $hpMax := .character.hp.max -}}
|
||||
{{- if gt $hp 0 }}{{ $hp }} / {{ $hpMax }}{{ else }}{{ $hp }}{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue