simpler gloss

This commit is contained in:
Marcell Mars 2020-12-05 23:14:18 +01:00
parent 598ed03c9b
commit e77911aeac
2 changed files with 14 additions and 28 deletions

View file

@ -886,19 +886,9 @@ details {
} }
.gloss { .gloss {
display: grid;
grid-template-columns: 1fr;
/*grid-template-rows: repeat(3, 1fr);*/
gap: 0px 0px;
grid-template-areas:
"glosstop"
"glossmiddle"
"glossbottom";
grid-area: gloss; grid-area: gloss;
} }
.glosstop { grid-area: glosstop; }
.glossbottom { grid-area: glossbottom; }
.glossmiddle { grid-area: glossmiddle; }
.glossnumber { .glossnumber {
grid-area: glossnumber; grid-area: glossnumber;
} }
@ -907,15 +897,14 @@ details {
content: "(" counter(glossN) ")"; content: "(" counter(glossN) ")";
padding-right: 0.3rem; padding-right: 0.3rem;
} }
.glossline {
border-bottom: lightgray solid 1px;
border-top: lightgray solid 1px;
}
.glosswords { .glosswords {
display: inline-block; display: inline-block;
margin-left: -0.3rem; padding-left: -0.3rem;
} padding-right: 1rem;
.glossword {
margin-left: 0.3rem;
margin-right: 0.5rem;
} }
@media (max-width: 767px) { @media (max-width: 767px) {

View file

@ -1,26 +1,23 @@
{{ $inn := .Inner | $.Page.RenderString }}
<div class="glosscontainer"> <div class="glosscontainer">
<div class="gloss"> <div class="gloss">
{{- range $g := split .Inner "\n" -}} {{- range $g := (split $inn "\n") -}}
{{- if hasPrefix $g "{t}" -}} {{- if hasPrefix $g "{r}" -}}
<div class="glosstop"> <div class="glossregular">
{{- substr $g 3 -}} {{- substr $g 3 -}}
</div> </div>
{{- else if hasPrefix $g "{m}" -}} {{- else if hasPrefix $g "{g}" -}}
<div class="glossmiddle"> <div class="glossline">
{{- range (split (substr $g 3) "|") -}} {{- range (split (substr $g 3) "|") -}}
{{- with . -}} {{- with . -}}
<div class="glosswords"> <div class="glosswords">
{{- range (split . "," ) -}} {{- range (split . "," ) -}}
<div class="glossword">{{- . -}}</div> <div class="glossword">{{- . | htmlUnescape | safeHTML -}}</div>
{{- end -}} {{- end -}}
</div> </div>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</div> </div>
{{- else if hasPrefix $g "{b}" -}}
<div class="glossbottom">
{{- substr $g 3 -}}
</div>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</div> </div>