From 2ef7c0ec1ff976b807691fea23eaaf5ea1e93bc9 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Sun, 27 Mar 2022 19:19:28 -0700 Subject: init --- templates/shortcodes/audio.html | 7 +++++++ templates/shortcodes/gif.html | 7 +++++++ templates/shortcodes/image.html | 7 +++++++ templates/shortcodes/img.html | 42 +++++++++++++++++++++++++++++++++++++++++ templates/shortcodes/katex.html | 1 + templates/shortcodes/quote.html | 6 ++++++ templates/shortcodes/video.html | 7 +++++++ templates/shortcodes/vm.html | 3 +++ templates/shortcodes/yt.html | 3 +++ 9 files changed, 83 insertions(+) create mode 100644 templates/shortcodes/audio.html create mode 100644 templates/shortcodes/gif.html create mode 100644 templates/shortcodes/image.html create mode 100644 templates/shortcodes/img.html create mode 100644 templates/shortcodes/katex.html create mode 100644 templates/shortcodes/quote.html create mode 100644 templates/shortcodes/video.html create mode 100644 templates/shortcodes/vm.html create mode 100644 templates/shortcodes/yt.html (limited to 'templates/shortcodes') diff --git a/templates/shortcodes/audio.html b/templates/shortcodes/audio.html new file mode 100644 index 0000000..3f9368e --- /dev/null +++ b/templates/shortcodes/audio.html @@ -0,0 +1,7 @@ + diff --git a/templates/shortcodes/gif.html b/templates/shortcodes/gif.html new file mode 100644 index 0000000..3ae56fd --- /dev/null +++ b/templates/shortcodes/gif.html @@ -0,0 +1,7 @@ + diff --git a/templates/shortcodes/image.html b/templates/shortcodes/image.html new file mode 100644 index 0000000..ea236ef --- /dev/null +++ b/templates/shortcodes/image.html @@ -0,0 +1,7 @@ + + {% for source in sources -%} + {% set type = source | split(pat=".") | last -%} + + {% endfor -%} + {{ fallback_alt }} + diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html new file mode 100644 index 0000000..94cb9fa --- /dev/null +++ b/templates/shortcodes/img.html @@ -0,0 +1,42 @@ +{# {{ img(path="", alt="", caption="", extended_width_pct=1.3, quality=90) }} #} + +{# container_width = (pixel size, px) * (.container's max-width) #} +{% set container_width = 16 * 42 %} + +{# figure_width = container_width - (figure margin_blocks) #} +{% set figure_width = container_width - (40 * 2) %} + +{% if path is starting_with("./") %} + {% set relative_path = page.relative_path | split(pat="/") | slice(end=-1) | join(sep="/") %} + {% set img_path = path | trim_start_matches(pat="./") %} + {% set img_path = relative_path ~ "/" ~ img_path %} +{% else %} + {% set img_path = path %} +{% endif %} + +{% if path is not ending_with(".svg") %} + {% set resize = true %} + {% set image_quality = 90 %} + {% if quality %} + {% set image_quality = quality %} + {% endif %} + + {% if extended_width_pct %} + {% if extended_width_pct == -1 %} + {# adjust extended width to container width #} + {% set extended_width_pct = 0.042 %} + {% endif %} + {% set _width = config.extra.images.max_width - figure_width %} + {% set extended_width = (extended_width_pct * _width + figure_width) | round | int %} + {% if extended_width > config.extra.images.max_width %} + {% set extended_width = config.extra.images.max_width %} + {% endif %} + {% set resized_image = resize_image(path=img_path, width=extended_width, op="fit_width", quality=image_quality) %} + {% else %} + {% set resized_image = resize_image(path=img_path, width=figure_width, op="fit_width", quality=image_quality) %} + {% endif %} +{% endif %} +
+ + {% if caption %}
{{ caption | safe }}
{% endif %} +
diff --git a/templates/shortcodes/katex.html b/templates/shortcodes/katex.html new file mode 100644 index 0000000..cac8e97 --- /dev/null +++ b/templates/shortcodes/katex.html @@ -0,0 +1 @@ + diff --git a/templates/shortcodes/quote.html b/templates/shortcodes/quote.html new file mode 100644 index 0000000..8238b71 --- /dev/null +++ b/templates/shortcodes/quote.html @@ -0,0 +1,6 @@ +
+ {{body}}
+ {% if author %} + -- {{ author }} + {% endif %} +
diff --git a/templates/shortcodes/video.html b/templates/shortcodes/video.html new file mode 100644 index 0000000..a1a2f31 --- /dev/null +++ b/templates/shortcodes/video.html @@ -0,0 +1,7 @@ + diff --git a/templates/shortcodes/vm.html b/templates/shortcodes/vm.html new file mode 100644 index 0000000..230e557 --- /dev/null +++ b/templates/shortcodes/vm.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/templates/shortcodes/yt.html b/templates/shortcodes/yt.html new file mode 100644 index 0000000..7816bd8 --- /dev/null +++ b/templates/shortcodes/yt.html @@ -0,0 +1,3 @@ +
+ +
-- cgit v1.3.1