Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zwbetz-gh/cayman-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwbetz <zwbetz@gmail.com>2019-04-02 21:27:00 +0300
committerzwbetz <zwbetz@gmail.com>2019-04-02 21:27:00 +0300
commit478ae7774a189df479e983613019b248705b038b (patch)
treeb29ea10f58d1f9fe53d45c4b193c7ae851bd8220
parent51469b0fd3ef7904dcdae0bda768ae98341d1ff4 (diff)
Add figure shortcode & a post to show it off
-rw-r--r--exampleSite/content/post/nasa-images/earth.jpgbin0 -> 518573 bytes
-rw-r--r--exampleSite/content/post/nasa-images/index.md29
-rw-r--r--exampleSite/content/post/nasa-images/moon.jpgbin0 -> 381038 bytes
-rw-r--r--exampleSite/content/post/nasa-images/sun.jpgbin0 -> 3118921 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_700x0_resize_q75_box.jpgbin0 -> 79902 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_800x0_resize_q75_box.jpgbin0 -> 102538 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_700x0_resize_q75_box.jpgbin0 -> 58313 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_800x0_resize_q75_box.jpgbin0 -> 74933 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_1200x0_resize_q75_box.jpgbin0 -> 306482 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_700x0_resize_q75_box.jpgbin0 -> 115034 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_800x0_resize_q75_box.jpgbin0 -> 146690 bytes
-rw-r--r--exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_900x0_resize_q75_box.jpgbin0 -> 186364 bytes
-rw-r--r--layouts/shortcodes/figure.html30
13 files changed, 59 insertions, 0 deletions
diff --git a/exampleSite/content/post/nasa-images/earth.jpg b/exampleSite/content/post/nasa-images/earth.jpg
new file mode 100644
index 0000000..7c03342
--- /dev/null
+++ b/exampleSite/content/post/nasa-images/earth.jpg
Binary files differ
diff --git a/exampleSite/content/post/nasa-images/index.md b/exampleSite/content/post/nasa-images/index.md
new file mode 100644
index 0000000..e81b9a3
--- /dev/null
+++ b/exampleSite/content/post/nasa-images/index.md
@@ -0,0 +1,29 @@
+---
+title: "NASA Images"
+date: 2018-12-27
+tags: [nasa, shortcodes, figure, sun, moon, earth]
+---
+
+The below images are from the [NASA Image and Video Library](https://images.nasa.gov/) -- indulge yourself, revel in their beauty.
+
+{{< figure
+img="sun.jpg"
+caption="The Sun is the star at the center of the Solar System. It is a nearly perfect sphere of hot plasma, with internal convective motion that generates a magnetic field via a dynamo process. It is by far the most important source of energy for life on Earth. [Credits](https://images.nasa.gov/details-GSFC_20171208_Archive_e000393.html)."
+command="Resize"
+options="800x" >}}
+
+<br>
+
+{{< figure
+img="moon.jpg"
+caption="The Moon is an astronomical body that orbits planet Earth and is Earth's only permanent natural satellite. It is the fifth-largest natural satellite in the Solar System, and the largest among planetary satellites relative to the size of the planet that it orbits (its primary). The Moon is after Jupiter's satellite Io the second-densest satellite in the Solar System among those whose densities are known. [Credits](https://images.nasa.gov/details-GSFC_20171208_Archive_e001861.html)."
+command="Resize"
+options="800x" >}}
+
+<br>
+
+{{< figure
+img="earth.jpg"
+caption="Earth is the third planet from the Sun and the only astronomical object known to harbor life. According to radiometric dating and other sources of evidence, Earth formed over 4.5 billion years ago. Earth's gravity interacts with other objects in space, especially the Sun and the Moon, Earth's only natural satellite. Earth revolves around the Sun in 365.26 days, a period known as an Earth year. During this time, Earth rotates about its axis about 366.26 times. [Credits](https://images.nasa.gov/details-PIA18033.html)."
+command="Resize"
+options="800x" >}}
diff --git a/exampleSite/content/post/nasa-images/moon.jpg b/exampleSite/content/post/nasa-images/moon.jpg
new file mode 100644
index 0000000..0119a33
--- /dev/null
+++ b/exampleSite/content/post/nasa-images/moon.jpg
Binary files differ
diff --git a/exampleSite/content/post/nasa-images/sun.jpg b/exampleSite/content/post/nasa-images/sun.jpg
new file mode 100644
index 0000000..0faeb53
--- /dev/null
+++ b/exampleSite/content/post/nasa-images/sun.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_700x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_700x0_resize_q75_box.jpg
new file mode 100644
index 0000000..8e29aff
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_700x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_800x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_800x0_resize_q75_box.jpg
new file mode 100644
index 0000000..11a03e3
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/earth_huaae7be4ba70df7325b57cd351ea21ee7_518573_800x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_700x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_700x0_resize_q75_box.jpg
new file mode 100644
index 0000000..b9cca6f
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_700x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_800x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_800x0_resize_q75_box.jpg
new file mode 100644
index 0000000..37bedc0
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/moon_huaae7be4ba70df7325b57cd351ea21ee7_381038_800x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_1200x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_1200x0_resize_q75_box.jpg
new file mode 100644
index 0000000..557b0b7
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_1200x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_700x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_700x0_resize_q75_box.jpg
new file mode 100644
index 0000000..d1bf2c0
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_700x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_800x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_800x0_resize_q75_box.jpg
new file mode 100644
index 0000000..e9fa79a
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_800x0_resize_q75_box.jpg
Binary files differ
diff --git a/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_900x0_resize_q75_box.jpg b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_900x0_resize_q75_box.jpg
new file mode 100644
index 0000000..b075075
--- /dev/null
+++ b/exampleSite/resources/_gen/images/nasa-images/sun_huc3d26fbb16c0f70400041133778c1446_3118921_900x0_resize_q75_box.jpg
Binary files differ
diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
new file mode 100644
index 0000000..b05f8d1
--- /dev/null
+++ b/layouts/shortcodes/figure.html
@@ -0,0 +1,30 @@
+{{ $img := .Get "img" }}
+{{ $caption := .Get "caption" }}
+{{ $command := .Get "command" }}
+{{ $options := .Get "options" }}
+
+{{ $original := .Page.Resources.GetMatch (printf "*%s*" $img) }}
+{{ $new := "" }}
+
+{{ if eq $command "Fit" }}
+ {{ $new = $original.Fit $options }}
+{{ else if eq $command "Fill" }}
+ {{ $new = $original.Fill $options }}
+{{ else if eq $command "Resize" }}
+ {{ $new = $original.Resize $options }}
+{{ else if eq $command "Original" }}
+ {{ $new = $original }}
+{{ else }}
+ {{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
+{{ end }}
+
+{{ $captionId := printf "caption-%s" ($caption | md5) }}
+
+<figure role="group" aria-describedby="{{ $captionId }}">
+ <a href="{{ $original.Permalink }}" class="">
+ <img src="{{ $new.Permalink }}">
+ </a>
+ <figcaption id="{{ $captionId }}">
+ {{ $caption | markdownify }}
+ </figcaption>
+</figure>