Skip to content

Commit

Permalink
Update template and figure data structure to display figures in order
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed May 14, 2024
1 parent d7c77e2 commit 5f61398
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions content/2024/afterlives/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ type: article
title: Figures for The Afterlives of Shakespeare and Company in Online Social Readership
shortTitle: Afterlives
figures:
author:
figure: 2
- id: author
number: 2
title: Author Popularity
src: figures/2024/afterlives/author-popularity/
style:
aspect-ratio: "65 / 49"
min-width: "772px"
max-height: "80vh"
relative:
figure: 3
- id: relative
number: 3
title: Relative popularity of work by publication year
src: figures/2024/afterlives/relative-popularity/
style:
Expand Down
4 changes: 2 additions & 2 deletions content/2024/counterfactual-canon/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ type: article
title: Figures for A Counterfactual Canon
shortTitle: Counterfactual Canon
figures:
gendered-reading:
figure: 3
- id: gendered-reading
number: 3
title: Authors with the highest deltas
src: figures/2024/counterfactual-canon/gendered-reading-delta/
style:
Expand Down
12 changes: 6 additions & 6 deletions content/2024/missingdata-specreading/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ type: article
title: Figures for Missing Data, Speculative Reading
shortTitle: Missing Data, Speculative Reading
figures:
weekly-activity-logbooks:
figure: 2
- id: weekly-activity-logbooks
number: 2
title: Weekly activity from logbooks
src: figures/2024/missingdata-specreading/weekly-activity-logbooks/
style:
aspect-ratio: "130 / 40"
min-width: "600px"
hemingway:
figure: 12
- id: hemingway
number: 12
title: Hemingway's Borrowing
src: figures/2024/missingdata-specreading/hemingway-borrowing/
style:
aspect-ratio: "407 / 144"
min-width: "600px"
recommendation-scores:
figure: 14
- id: recommendation-scores
number: 14
title: Distributions of Prediction Scores for the Top Books for Ernest Hemingway
src: figures/2024/missingdata-specreading/recommendation-scores/
cssString: "
Expand Down
4 changes: 2 additions & 2 deletions content/2024/peggrams-library/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ type: article
title: Figures for Unpacking Reed Peggram's Library
shortTitle: Peggram's Library
figures:
map:
figure: 4
- id: map
number: 4
title: Map of Reed Peggram's addresses in Paris
src: figures/2024/peggrams-library/map/
style:
Expand Down
12 changes: 6 additions & 6 deletions content/2024/woolf-common-readers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ type: article
title: Figures for Virginia Woolf’s Common Readers in Paris
shortTitle: Woolf's Common Readers
figures:
borrows:
figure: 9
- id: borrows
number: 9
title: Number of times Woolf books were borrowed
src: figures/2024/woolf-common-readers/borrows/
style:
aspect-ratio: "100 / 76"
min-width: "600px"
gender:
figure: 10
- id: gender
number: 10
title: Woolf’s borrowers by gender
src: figures/2024/woolf-common-readers/gender/
style:
aspect-ratio: "100 / 76"
min-width: "600px"
community:
figure: 11
- id: community
number: 11
title: The community of readers of Virginia Woolf’s books
src: figures/2024/woolf-common-readers/community/
allowfullscreen: true
Expand Down
21 changes: 11 additions & 10 deletions themes/shxco/layouts/article/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ <h2>{{ .Title }}</h2>
{{/* generate brief list with anchor links */}}
<h3>Contents</h3>
<ul>
{{- range $figureId, $props := .Params.figures -}}
<li><a href="#{{ $figureId}}">{{ with $props.figure }}Figure {{ . }}.{{ end }} {{ $props.title }} </a></li>
{{- range $figure := sort .Params.figures -}}
<li><a href="#{{ $figure.id }}">{{ with $figure.number }}Figure {{ . }}.{{ end }} {{ $figure.title }} </a></li>
{{- end -}}
</ul>

<hr/>

{{/* display figures */}}
{{ partial "figure/styles.css" . }} {{/* include styles for display on this page */}}

{{- range $figureId, $props := .Params.figures -}}
<div id="{{ $figureId }}">
<h3>{{ $props.title }}</h3>
{{ partial "figure/iframe.html" (dict "figureId" $figureId "props" $props "baseurl" $.Site.BaseURL ) }}
{{- range $figure := .Params.figures -}}
<div id="{{ $figure.id }}">
<h3>{{ $figure.title }}</h3>
{{ partial "figure/iframe.html" (dict "figureId" $figure.id "props" $figure "baseurl" $.Site.BaseURL ) }}
</div>
{{- end -}}

Expand All @@ -27,15 +28,15 @@ <h3>{{ $props.title }}</h3>
{{ $css := partial "figure/styles.css" . }} {{/* styles for display when embedding; output as string */}}
{{ transform.Highlight (printf "%s\n" $css ) "css" }}

{{- range $figureId, $props := .Params.figures -}}
{{- $iframe := partial "figure/iframe.html" (dict "figureId" $figureId "props" $props "baseurl" $.Site.BaseURL ) -}}
{{- range $figure := .Params.figures -}}
{{- $iframe := partial "figure/iframe.html" (dict "figureId" $figure.id "props" $figure "baseurl" $.Site.BaseURL ) -}}
{{ transform.Highlight ( printf "%s\n" $iframe ) "html" }}
{{- end -}}

<hr/>
<div>
{{- range $figureId, $props := .Params.figures -}}
<p><a href="{{ $.Site.BaseURL }}{{ $props.src }}">view embed : {{ $props.title }} </a></p>
{{- range $figure := .Params.figures -}}
<p><a href="{{ $.Site.BaseURL }}{{ $figure.src }}">view embed : {{ $figure.title }} </a></p>
{{- end -}}
</div>
</details>
Expand Down
11 changes: 5 additions & 6 deletions themes/shxco/layouts/partials/figure/styles.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<style type="text/css">
{{- range $figureId, $props := .Params.figures -}}
{{- if $props.cssString -}}
{{ $props.cssString | safeURL }}
{{/* printf "\n%s\n " $props.cssString */}}
{{- range $figure := .Params.figures -}}
{{- if $figure.cssString -}}
{{ $figure.cssString | safeURL }}
{{- else -}}
{{ printf "\n iframe#%s { " $figureId }}
{{- range $attr, $value := $props.style -}}
{{ printf "\n iframe#%s { " $figure.id }}
{{- range $attr, $value := $figure.style -}}
{{- if ne $value "string" -}}
{{ printf "\n %s: %s;" $attr $value | safeURL }}
{{- end -}}
Expand Down

0 comments on commit 5f61398

Please sign in to comment.