Add a .no-value style to the items in the table. Streamline the logic for filling in table values.
84 lines
3 KiB
HTML
84 lines
3 KiB
HTML
<div class="photo-params">
|
||
<table>
|
||
{{ if and .Tags.Make .Tags.Model }}
|
||
<thead>
|
||
<td class="make-model" colspan=4>
|
||
{{- $make := .Tags.Make -}}
|
||
{{- $model := .Tags.Model -}}
|
||
{{- if in $model $make -}}
|
||
{{ .Tags.Model }}
|
||
{{- else -}}
|
||
{{ .Tags.Make }} {{ .Tags.Model }}
|
||
{{- end -}}
|
||
</td>
|
||
</thead>
|
||
{{ end }}
|
||
{{ with .Tags.LensModel -}}
|
||
<tr><td colspan="4" class="lens">{{ . }}</td></tr>
|
||
{{ end }}
|
||
<tr>
|
||
{{- $hasLocation := and .Lat .Long -}}
|
||
{{- $hasPixelDimensions := and .Tags.PixelXDimension .Tags.PixelYDimension -}}
|
||
{{ if $hasLocation -}}
|
||
<td
|
||
colspan="{{ cond $hasPixelDimensions 2 4 }}"
|
||
class="location">
|
||
{{ $latitude := float .Lat }}
|
||
{{ $latitudeDirection := cond (eq $latitude 0) "" (cond (gt $latitude 0) "N" "S") }}
|
||
<data class="latitude" value="{{ $latitude }}">
|
||
{{ $latitude | lang.FormatNumber (cond (ne $latitude 0) 3 0) }}º{{ $latitudeDirection }}
|
||
</data>,
|
||
{{ $longitude := float .Long }}
|
||
{{ $longitudeDirection := cond (eq $longitude 0) "" (cond (gt $longitude 0) "E" "W") }}
|
||
<data class="longitude" value="{{ $longitude }}">
|
||
{{ $longitude | lang.FormatNumber (cond (ne $longitude 0) 3 0) }}º{{ $longitudeDirection }}
|
||
</data>
|
||
</td>
|
||
{{- end -}}
|
||
{{ if $hasPixelDimensions -}}
|
||
<td colspan="{{ cond $hasLocation 2 4 }}" class="size">
|
||
{{- $widthpx := .Tags.PixelXDimension -}}
|
||
{{- $heightpx := .Tags.PixelYDimension -}}
|
||
{{- if and (gt $widthpx 0) (gt $heightpx 0) -}}
|
||
{{- $megapixels := div (mul $widthpx $heightpx) 1e6 -}}
|
||
<data class="megapixels nobreak" value="{{ $megapixels }}">{{ $megapixels | lang.FormatNumber 0 }} MP</data>
|
||
•
|
||
<span class="nobreak"><data class="width">{{ $widthpx }}</data> × <data class="height">{{ $heightpx }}</data></span>
|
||
{{- end -}}
|
||
</td>
|
||
{{ end }}
|
||
</tr>
|
||
{{ if or
|
||
.Tags.ISOSpeedRatings
|
||
.Tags.FocalLengthIn35mmFilm
|
||
.Tags.FocalLength
|
||
.Tags.FNumber
|
||
.Tags.ExposureTime
|
||
}}
|
||
<tr class="exposure-attributes">
|
||
{{ with .Tags.ISOSpeedRatings -}}
|
||
<td class="iso">ISO {{ . }}</td>
|
||
{{ else }}
|
||
<td class="iso no-value">--</td>
|
||
{{- end -}}
|
||
<td class="focal-length">
|
||
{{- with .Tags.FocalLengthIn35mmFilm | default .Tags.FocalLength -}}
|
||
{{ printf "%3.2f" (float .) }} mm
|
||
{{- end -}}
|
||
</td>
|
||
<td class="f-number">
|
||
{{ with .Tags.FNumber }}{{ printf "ƒ%0.1f" (float .) }}{{ end }}
|
||
</td>
|
||
<td class="exposure-time">
|
||
{{- with $exposureTime := .Tags.ExposureTime -}}
|
||
{{- if in $exposureTime "/" -}}
|
||
{{ . }} s
|
||
{{- else -}}
|
||
1/{{ printf "%.0f" (div 1.0 (float $exposureTime)) }} s
|
||
{{- end -}}
|
||
{{- end -}}
|
||
</td>
|
||
</tr>
|
||
{{ end }}
|
||
</table>
|
||
</div>
|