Added image and caption in style 'imagecontainer'
This commit is contained in:
parent
38f85dc36e
commit
7a45525073
2 changed files with 62 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
<!--
|
||||
Sandpoints uses the Markdown image convention 
|
||||
also for internal links, as in 
|
||||
also for bib references, as in 
|
||||
-->
|
||||
|
||||
{{- $text_link := .Text -}}
|
||||
|
||||
{{ $_ := newScratch }}
|
||||
|
@ -5,16 +11,20 @@
|
|||
{{ $_.Add "triads" $k }}
|
||||
{{- end -}}
|
||||
|
||||
<!-- IMG-->
|
||||
{{- if strings.HasPrefix .Destination "img:" -}}
|
||||
{{- $img_params := (substr .Destination 4) -}}
|
||||
{{- $img_src := index (split $img_params " ") 0 -}}
|
||||
{{- $img_attr := index (split $img_params $img_src) 1 -}}
|
||||
<img class="sandpoints-img" src="{{ $img_src }}" {{ $img_attr | safeHTMLAttr }} />
|
||||
<!-- VIDEO -->
|
||||
{{- else if strings.HasPrefix .Destination "vid:" -}}
|
||||
{{- $vid_params := (substr .Destination 4) -}}
|
||||
{{- $vid_src := index (split $vid_params " ") 0 -}}
|
||||
{{- $vid_attr := index (split $vid_params $vid_src) 1 -}}
|
||||
<video class="sandpoints-vid" controls src="{{ $vid_src }}" {{ $vid_attr | safeHTMLAttr }}></video>
|
||||
|
||||
<!-- BIB REFERENCE FROM LIBRARY -->
|
||||
{{- else if strings.HasPrefix .Destination "bib:" -}}
|
||||
{{- $destination := (substr .Destination 4) -}}
|
||||
{{- $c_prefix := .Page.Site.Params.sandpointsCatalogPrefix | default "/library/" -}}
|
||||
|
@ -34,6 +44,8 @@
|
|||
{{- else -}}
|
||||
<a href="{{- $c_prefix | safeURL -}}BROWSE_LIBRARY.html#/book/{{- $destination -}}"{{- with .Title}} title="{{- . -}}"{{- end -}}>{{- $text_link -}}⦚<span>bib:{{- $destination -}} not found</span></a>
|
||||
{{- end -}}
|
||||
|
||||
<!-- TRIAD REFERENCE  -->
|
||||
{{- else if in ($_.Get "triads") (index (split .Destination ":") 0) -}}
|
||||
{{- if $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
|
||||
{{- $session := $.Page.Site.GetPage (printf "/%s" (replace .Destination ":" "/")) -}}
|
||||
|
@ -46,6 +58,7 @@
|
|||
{{- else -}}
|
||||
<a href="{{- .Destination -}}/{{- if eq hugo.Environment "offline" -}}index.html{{- end -}}">{{- $text_link -}}⦚<span>{{- .Destination -}} not found</span></a>
|
||||
{{- end -}}
|
||||
<!-- AUDIO -->
|
||||
{{- else if strings.HasPrefix .Destination "audio:" -}}
|
||||
{{- $a_destination := (substr .Destination 6) -}}
|
||||
{{- if findRE "^.*static" $a_destination -}}
|
||||
|
@ -53,14 +66,41 @@
|
|||
{{- else -}}
|
||||
<span class="soundcite" data-url="{{- $a_destination | safeURL -}}">{{ .Text }}</span>
|
||||
{{- end -}}
|
||||
{{- else if findRE "^.*static" .Destination -}} <!-- EDITED clause for link to file in /static/ folder -->
|
||||
|
||||
<!-- JGDR IMAGE EDIT
|
||||
edit to support the following:
|
||||

|
||||
|
||||
.Text > Text in square brackets becomes caption (CSS/figcaption), and Alt text
|
||||
.Title > Title (text after image URL) becomes mouse over text
|
||||
|
||||
html 'title' is for mouse over pop up text
|
||||
html 'alt' is for alt text
|
||||
|
||||
TODO:
|
||||
- enclose image and caption in block
|
||||
-->
|
||||
|
||||
<!-- Images from STATIC -->
|
||||
{{- else if findRE "^.*static" .Destination -}} <!-- EDITED: clause for link to file in /static/ folder -->
|
||||
<div class="imagecontainer">
|
||||
<img src="{{- (replaceRE "^.*static" "" .Destination ) | safeURL -}}" alt="{{- .Title -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
|
||||
{{ if .Text }}
|
||||
<figcaption> {{with .Text }} {{ . }} {{end}}</figcaption> <!-- ALT becomes caption. Title becomes moouse over text.-->
|
||||
{{ $x:= safeHTML .Text }}
|
||||
<figcaption> {{ $x }}</figcaption> </div><!-- ALT becomes caption. Title becomes moouse over text.-->
|
||||
{{ else }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{- else -}} <!-- else; EDIT TO COVER IMGs in STATIC via link that does not include /static/-->
|
||||
<img src="{{- .Destination | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- . -}}"{{- end -}} />
|
||||
<!-- OTHER IMAGES/ or ommitting static/-->
|
||||
{{- else -}} <!-- else; EDIT TO COVER IMGs files via link that does not include /static/-->
|
||||
<div class="imagecontainer">
|
||||
|
||||
<img src="{{- .Destination | safeURL -}}" alt="{{- .Text -}}" {{- with .Title}} title="{{- markdownify . -}}"{{- end -}} />
|
||||
<!-- Add .Text as Image caption (figcaption)-->
|
||||
{{ if .Text }}
|
||||
<figcaption> {{with .Text }} {{ . }} {{end}}</figcaption> <!-- ALT becomes caption. Title becomes moouse over text.-->
|
||||
{{ $x:= safeHTML .Text }} <!-- Safe HTML to support styling, e.g. italics -->
|
||||
<figcaption> {{ $x }} </figcaption></div>
|
||||
{{ else }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
|
|
@ -4,12 +4,12 @@ THIS IS BASED ON THE DOTAWO CUSTOMIZATION
|
|||
INCLUDING MODIFICATIONS:
|
||||
- Use original Sandpoints fonts / revert to original font weight
|
||||
- EDIT table: add vert line to the right
|
||||
- ADD figcaption
|
||||
- ADD figcaption definition (image/table captions)
|
||||
- EDIT pre (font scale, line wrapping)
|
||||
- ADD code (border and background)
|
||||
- EDIT remove italics from abstract
|
||||
|
||||
all edits include a comment including the keyword anybody
|
||||
|
||||
*/
|
||||
|
||||
html,body,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr{
|
||||
|
@ -413,6 +413,15 @@ ol li{
|
|||
.afterhas{
|
||||
grid-column:2
|
||||
}
|
||||
/* EDIT: Make visible Frontmatter field 'publishDate' if available */
|
||||
.haspublishdate{
|
||||
grid-column: 3
|
||||
font-family:great vibes,cursive;
|
||||
font-size:.9em;
|
||||
font-style:italic;
|
||||
vertical-align:baseline;
|
||||
position:relative
|
||||
}
|
||||
.content{
|
||||
margin-top:4rem;
|
||||
padding-left:3rem;
|
||||
|
@ -459,8 +468,13 @@ h6{
|
|||
font-weight:500;/*700;*/
|
||||
font-size:1rem
|
||||
}
|
||||
.imagecontainer {/* test by anybody */
|
||||
display: block;
|
||||
/*background: grey; */
|
||||
}
|
||||
|
||||
.abstract{
|
||||
font-style:italic;
|
||||
/*font-style:italic;*/ /* Remove italics from abstract*/
|
||||
border-left:1px solid #000;
|
||||
margin-left:5rem;
|
||||
margin-right:2rem;
|
||||
|
|
Loading…
Add table
Reference in a new issue