forked from mirrors/hugo-tufte
refine figure
This commit is contained in:
parent
bb73762987
commit
3cda34976f
5 changed files with 52 additions and 41 deletions
|
@ -29,6 +29,8 @@ $ht-code-border-radius: .4em;
|
|||
|
||||
&::before{
|
||||
content: "> ";
|
||||
// font-family: "Noto Emoji";
|
||||
font-family: inherit;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: #111;
|
||||
|
@ -65,7 +67,7 @@ $ht-code-border-radius: .4em;
|
|||
|
||||
|
||||
@media screen and (max-width: 760px) {
|
||||
.highlight .chroma {
|
||||
.highlight {
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
|
|
5
assets/scss/vendor/tufte.scss
vendored
5
assets/scss/vendor/tufte.scss
vendored
|
@ -310,13 +310,12 @@ div.table-wrapper {
|
|||
}
|
||||
|
||||
@media screen and (max-width: 760px) {
|
||||
h2,
|
||||
h3,
|
||||
p,
|
||||
footer {
|
||||
width: 90%;
|
||||
}
|
||||
pre.code {
|
||||
width: 87.5%;
|
||||
}
|
||||
ul {
|
||||
width: 85%;
|
||||
}
|
||||
|
|
|
@ -1,47 +1,57 @@
|
|||
{{ $alt := .Get "alt" | default "Image" }}
|
||||
{{ $type := .Get "type" | default "normal" }}
|
||||
|
||||
<!-- get a default label just in case -->
|
||||
{{- $label := printf "%#v" (add .Ordinal 1) | printf "%s%s" "marginfig-" | printf "%s" -}}
|
||||
{{- if .Get "label" -}}
|
||||
{{- $label = .Get "label" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- begin figure tag -->
|
||||
{{ if not (eq $type "margin") }}
|
||||
{{ if eq $type "full" }}
|
||||
{{- if not (eq $type "margin") -}}
|
||||
{{ if eq $type "full" }}<!-- full -->
|
||||
<figure class="fullwidth">
|
||||
{{ else }}
|
||||
{{ else }}<!-- normal -->
|
||||
<figure {{ with .Get "class" }}class="{{ . }}"{{ end }}>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
<!-- begin inner elements -->
|
||||
{{ if eq $type "full" }}
|
||||
<!-- begin child elements -->
|
||||
{{- if eq $type "full" -}}<!-- child for full -->
|
||||
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
||||
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
|
||||
<img src="{{ .Get "src" }}" alt="{{ $alt }}">
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
<figcaption>
|
||||
{{ else }}{{/* margin or normal */}}
|
||||
<label for="{{ .Get "label" }}" class="margin-toggle marginnote-ind">{{ .Site.Params.marginNoteInd }}</label>
|
||||
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle"/>
|
||||
{{- else -}}<!-- child for margin or normal (begin) -->
|
||||
|
||||
{{- if or (or (.Get "caption") (.Get "attr")) (eq $type "margin") -}}<!-- begin marginnote -->
|
||||
<label for="{{ $label }}" class="margin-toggle marginnote-ind">{{ .Site.Params.marginNoteInd }}</label>
|
||||
<input type="checkbox" id="{{ $label }}" class="margin-toggle"/>
|
||||
<span class="marginnote">
|
||||
{{ if eq $type "margin" }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if eq $type "margin" -}}<!-- margin image inside marginnote -->
|
||||
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
||||
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
|
||||
<img src="{{ .Get "src" }}" alt="{{ $alt }}">
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{ with .Get "title"}}<strong>{{ . }} </strong>{{ end}}
|
||||
{{ with .Get "caption"}}{{ . }}{{ end }}
|
||||
{{ with .Get "attrlink"}}<a href="{{ .}}">{{ end }}
|
||||
{{ with .Get "attr" }}{{ . }}{{ end }}
|
||||
{{ if .Get "attrlink" }}</a>{{ end }}
|
||||
{{- end -}}<!-- child for margin or normal (end) -->
|
||||
|
||||
<!-- end inner elements -->
|
||||
{{ if eq $type "full" }}
|
||||
{{ with .Get "title"}}<strong>{{ . | markdownify }}. </strong>{{ end}}
|
||||
{{ with .Get "caption"}}{{ . | markdownify }}{{ end }}
|
||||
{{ with .Get "attr" }}{{ . | markdownify }}.{{ end }}
|
||||
|
||||
<!-- end child elements -->
|
||||
{{ if eq $type "full" }}<!-- end full -->
|
||||
</figcaption>
|
||||
{{ else }}
|
||||
</span>
|
||||
{{ else }}<!-- end margin or normal -->
|
||||
{{- if or (or (.Get "caption") (.Get "attr")) (eq $type "margin") -}}</span>{{- end -}}<!-- end marginnote -->
|
||||
{{ end }}
|
||||
|
||||
{{ if (eq $type "normal") }}
|
||||
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
||||
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
|
||||
<img src="{{ .Get "src" }}" alt="{{ $alt }}">
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{- $marginnoteDomIdSuffix := (add .Ordinal 1) -}}
|
||||
{{- $label := (add .Ordinal 1) -}}
|
||||
{{- $ind := .Get "ind" | default .Site.Params.marginNoteInd -}}
|
||||
<label for="marginnote-{{ $marginnoteDomIdSuffix }}" class="margin-toggle marginnote-ind">{{ $ind }}</label>
|
||||
<input type="checkbox" id="marginnote-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
|
||||
<label for="marginnote-{{ $label }}" class="margin-toggle marginnote-ind">{{ $ind }}</label>
|
||||
<input type="checkbox" id="marginnote-{{ $label }}" class="margin-toggle"/>
|
||||
<span class="marginnote">
|
||||
{{ .Inner | markdownify}}
|
||||
</span>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
{{- else -}}
|
||||
{{- $.Page.Scratch.Set "sidenoteCounter" 1 -}}
|
||||
{{- end -}}
|
||||
{{- $sidenoteDomIdSuffix := $.Page.Scratch.Get "sidenoteCounter" -}}
|
||||
<label for="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle sidenote-number">({{ $sidenoteDomIdSuffix }})</label>
|
||||
<input type="checkbox" id="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle"/>
|
||||
{{- $label := $.Page.Scratch.Get "sidenoteCounter" -}}
|
||||
<label for="sidenote-{{ $label }}" class="margin-toggle sidenote-number">({{ $label }})</label>
|
||||
<input type="checkbox" id="sidenote-{{ $label }}" class="margin-toggle"/>
|
||||
<span class="sidenote">
|
||||
<span class="sidenote-number">({{ $sidenoteDomIdSuffix }})</span>{{ .Inner | markdownify }}
|
||||
<span class="sidenote-number">({{ $label }})</span>{{ .Inner | markdownify }}
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue