al_folio_distill 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AlFolioDistill
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require_relative "al_folio_distill/version"
5
+
6
+ module AlFolioDistill
7
+ PLUGIN_ROOT = File.expand_path("..", __dir__)
8
+ TEMPLATES_ROOT = File.join(PLUGIN_ROOT, "templates")
9
+ ASSETS_ROOT = File.join(PLUGIN_ROOT, "assets")
10
+ DISTILL_REMOTE_LOADER_PATTERN = %r{https://distill\.pub/template\.v2\.js}
11
+
12
+ class PluginStaticFile < Jekyll::StaticFile; end
13
+
14
+ module_function
15
+
16
+ def enabled?(site)
17
+ site.config.dig("al_folio", "features", "distill", "enabled") != false
18
+ end
19
+
20
+ def remote_loader_allowed?(site)
21
+ site.config.dig("al_folio", "distill", "allow_remote_loader") == true
22
+ end
23
+
24
+ class AssetsGenerator < Jekyll::Generator
25
+ safe true
26
+ priority :low
27
+
28
+ def generate(site)
29
+ return unless AlFolioDistill.enabled?(site)
30
+
31
+ Dir.glob(File.join(ASSETS_ROOT, "**", "*")).sort.each do |source_path|
32
+ next if File.directory?(source_path)
33
+
34
+ relative_dir = File.dirname(source_path).sub("#{PLUGIN_ROOT}/", "")
35
+ site.static_files << PluginStaticFile.new(site, PLUGIN_ROOT, relative_dir, File.basename(source_path))
36
+ end
37
+ end
38
+ end
39
+
40
+ class RenderTag < Liquid::Tag
41
+ def render(context)
42
+ site = context.registers[:site]
43
+ return "" unless site && AlFolioDistill.enabled?(site)
44
+
45
+ Liquid::Template.parse("{% include distill/render.liquid %}").render!(
46
+ context.environments.first,
47
+ registers: context.registers
48
+ )
49
+ end
50
+ end
51
+ end
52
+
53
+ Liquid::Template.register_tag("al_folio_distill_render", AlFolioDistill::RenderTag)
54
+
55
+ Jekyll::Hooks.register :site, :after_init do |site|
56
+ next unless site.respond_to?(:includes_load_paths)
57
+
58
+ include_path = AlFolioDistill::TEMPLATES_ROOT
59
+ site.includes_load_paths << include_path unless site.includes_load_paths.include?(include_path)
60
+ end
61
+
62
+ Jekyll::Hooks.register :site, :post_read do |site|
63
+ next unless AlFolioDistill.enabled?(site)
64
+ next if AlFolioDistill.remote_loader_allowed?(site)
65
+
66
+ transforms_path = File.join(AlFolioDistill::ASSETS_ROOT, "js", "distillpub", "transforms.v2.js")
67
+ next unless File.file?(transforms_path)
68
+
69
+ content = File.read(transforms_path)
70
+ if content.match?(AlFolioDistill::DISTILL_REMOTE_LOADER_PATTERN)
71
+ Jekyll.logger.warn("al_folio_distill:", "remote Distill template loader detected while `al_folio.distill.allow_remote_loader` is false")
72
+ end
73
+ end
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Sync vendored Distill runtime assets from a pinned upstream ref.
5
+ #
6
+ # Default upstream source:
7
+ # https://github.com/al-org-dev/distill-template.git (branch: al-folio)
8
+ #
9
+ # Usage:
10
+ # scripts/distill/sync_distill.sh [upstream-ref]
11
+ #
12
+ # Examples:
13
+ # scripts/distill/sync_distill.sh
14
+ # scripts/distill/sync_distill.sh <commit-sha>
15
+
16
+ UPSTREAM_REPO="${UPSTREAM_REPO:-https://github.com/al-org-dev/distill-template.git}"
17
+ UPSTREAM_BRANCH="${UPSTREAM_BRANCH:-al-folio}"
18
+ DEFAULT_UPSTREAM_REF="d907ccdb526166c615f53487ec01e92e92f28f46"
19
+ UPSTREAM_REF="${1:-${UPSTREAM_REF:-$DEFAULT_UPSTREAM_REF}}"
20
+
21
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
22
+ TMP_DIR="$(mktemp -d)"
23
+
24
+ cleanup() {
25
+ rm -rf "${TMP_DIR}"
26
+ }
27
+ trap cleanup EXIT
28
+
29
+ git clone --quiet --depth 1 --branch "${UPSTREAM_BRANCH}" "${UPSTREAM_REPO}" "${TMP_DIR}/distill-template"
30
+ pushd "${TMP_DIR}/distill-template" >/dev/null
31
+
32
+ # Ensure deterministic vendoring from an explicit ref.
33
+ git fetch --quiet --depth 1 origin "${UPSTREAM_REF}"
34
+ git checkout --quiet "${UPSTREAM_REF}"
35
+
36
+ OUT_DIR="${ROOT}/assets/js/distillpub"
37
+ mkdir -p "${OUT_DIR}"
38
+ cp dist/template.v2.js "${OUT_DIR}/template.v2.js"
39
+ cp dist/template.v2.js.map "${OUT_DIR}/template.v2.js.map"
40
+ cp dist/transforms.v2.js "${OUT_DIR}/transforms.v2.js"
41
+ cp dist/transforms.v2.js.map "${OUT_DIR}/transforms.v2.js.map"
42
+ cp dist/overrides.js "${OUT_DIR}/overrides.js"
43
+
44
+ SOURCE_COMMIT="$(git rev-parse HEAD)"
45
+ SOURCE_COMMIT_SHORT="$(git rev-parse --short HEAD)"
46
+ popd >/dev/null
47
+
48
+ TEMPLATE_SHA256="$(shasum -a 256 "${OUT_DIR}/template.v2.js" | awk '{print $1}')"
49
+ TRANSFORMS_SHA256="$(shasum -a 256 "${OUT_DIR}/transforms.v2.js" | awk '{print $1}')"
50
+ SYNCED_AT_UTC="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
51
+
52
+ cat > "${OUT_DIR}/provenance.json" <<JSON
53
+ {
54
+ "upstream_repo": "${UPSTREAM_REPO}",
55
+ "upstream_branch": "${UPSTREAM_BRANCH}",
56
+ "upstream_ref": "${SOURCE_COMMIT}",
57
+ "upstream_ref_short": "${SOURCE_COMMIT_SHORT}",
58
+ "synced_at_utc": "${SYNCED_AT_UTC}",
59
+ "toolchain": {
60
+ "sync_mode": "copy-dist-artifacts"
61
+ },
62
+ "remote_loader_patched": false,
63
+ "assets": {
64
+ "template.v2.js": "${TEMPLATE_SHA256}",
65
+ "transforms.v2.js": "${TRANSFORMS_SHA256}",
66
+ "overrides.js": "$(shasum -a 256 "${OUT_DIR}/overrides.js" | awk '{print $1}')"
67
+ }
68
+ }
69
+ JSON
70
+
71
+ echo "Synced Distill runtime from ${UPSTREAM_REPO}@${SOURCE_COMMIT}"
72
+ echo "Updated assets in ${OUT_DIR}"
@@ -0,0 +1,131 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ {% include head.liquid %}
5
+ <link rel="stylesheet" href="{{ '/assets/css/al-folio-distill.css' | relative_url | bust_file_cache }}">
6
+
7
+ <!-- Distill js -->
8
+ <script src="{{ '/assets/js/distillpub/template.v2.js' | relative_url }}"></script>
9
+ <script src="{{ '/assets/js/distillpub/transforms.v2.js' | relative_url }}"></script>
10
+ {% if page._styles %}
11
+ <!-- Page/Post style -->
12
+ <style type="text/css">
13
+ {{ page._styles }}
14
+ </style>
15
+ {% endif %}
16
+ </head>
17
+
18
+ <d-front-matter>
19
+ <script async type="text/json">
20
+ {
21
+ "title": "{{ page.title }}",
22
+ "description": "{{ page.description }}",
23
+ "published": "{{ page.date | date: '%B %d, %Y' }}",
24
+ "authors": [
25
+ {% for author in page.authors %}
26
+ {
27
+ "author": "{{ author.name }}",
28
+ "authorURL": "{{ author.url }}",
29
+ "affiliations": [
30
+ {
31
+ "name": "{{ author.affiliations.name }}",
32
+ "url": "{{ author.affiliations.url }}"
33
+ }
34
+ ]
35
+ }{% if forloop.last == false %},{% endif %}
36
+ {% endfor %}
37
+ ],
38
+ "katex": {
39
+ "delimiters": [
40
+ {
41
+ "left": "$",
42
+ "right": "$",
43
+ "display": false
44
+ },
45
+ {
46
+ "left": "$$",
47
+ "right": "$$",
48
+ "display": true
49
+ }
50
+ ]
51
+ }
52
+ }
53
+ </script>
54
+ </d-front-matter>
55
+
56
+ <body class="{% if site.navbar_fixed %}fixed-top-nav{% endif %} {% unless site.footer_fixed %}sticky-bottom-footer{% endunless %}">
57
+ <!-- Header -->
58
+ {% include header.liquid %}
59
+
60
+ <!-- Content -->
61
+ <div class="post distill">
62
+ <d-title>
63
+ <h1>{{ page.title }}</h1>
64
+ <p>{{ page.description }}</p>
65
+ </d-title>
66
+ {% if page.authors %}
67
+ <d-byline></d-byline>
68
+ {% endif %}
69
+
70
+ <d-article>
71
+ {% if page.toc and page.toc.size > 0 %}
72
+ <d-contents>
73
+ <nav class="l-text figcaption">
74
+ <h3>Contents</h3>
75
+ {% for section in page.toc %}
76
+ <div>
77
+ <a href="#{{ section.name | slugify }}">{{ section.name }}</a>
78
+ </div>
79
+ {% if section.subsections %}
80
+ <ul>
81
+ {% for subsection in section.subsections %}
82
+ <li>
83
+ <a href="#{{ subsection.name | slugify }}">{{ subsection.name }}</a>
84
+ </li>
85
+ {% endfor %}
86
+ </ul>
87
+ {% endif %}
88
+ {% endfor %}
89
+ </nav>
90
+ </d-contents>
91
+
92
+ {% elsif page.toc == true %}
93
+ <d-contents>
94
+ <nav class="l-text figcaption">
95
+ <h3>Contents</h3>
96
+ {% toc %}
97
+ </nav>
98
+ </d-contents>
99
+ {% endif %}
100
+
101
+ {{ content }}
102
+ </d-article>
103
+
104
+ <d-appendix>
105
+ <d-footnote-list></d-footnote-list>
106
+ <d-citation-list></d-citation-list>
107
+ </d-appendix>
108
+
109
+ <d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}"></d-bibliography>
110
+
111
+ <d-article>
112
+ {% if site.related_blog_posts and site.related_blog_posts.enabled %}
113
+ {% if page.related_posts == null or page.related_posts %}
114
+ {% include related_posts.liquid %}
115
+ {% endif %}
116
+ {% endif %}
117
+ <br>
118
+ <br>
119
+ {% if site.plugins contains 'al_comments' %}
120
+ {% include plugins/al_comments.liquid %}
121
+ {% endif %}
122
+ </d-article>
123
+ </div>
124
+
125
+ <!-- Footer -->
126
+ {% include footer.liquid %}
127
+
128
+ <!-- JavaScripts -->
129
+ {% include distill/scripts.liquid %}
130
+ </body>
131
+ </html>
@@ -0,0 +1,92 @@
1
+ <script>
2
+ window.alFolio = {
3
+ compatBootstrap: {{ site.al_folio.compat.bootstrap.enabled | default: false | jsonify }}
4
+ };
5
+ </script>
6
+
7
+ <!-- Core navigation/runtime scripts -->
8
+ <script src="{{ '/assets/js/nav-toggle.js' | relative_url | bust_file_cache }}"></script>
9
+ {% if site.al_folio.compat.bootstrap.enabled %}
10
+ <script src="{{ '/assets/js/bootstrap-compat.js' | relative_url | bust_file_cache }}"></script>
11
+ {% endif %}
12
+
13
+ <!-- Custom overrides -->
14
+ <script src="{{ '/assets/js/distillpub/overrides.js' | relative_url }}"></script>
15
+
16
+ {% if site.plugins contains 'al_charts' %}
17
+ <!-- Charts and Diagrams -->
18
+ {% include plugins/al_charts_scripts.liquid %}
19
+ {% endif %}
20
+
21
+ {% if site.plugins contains 'al_math' %}
22
+ <!-- Math and Tikzjax -->
23
+ {% include plugins/al_math_scripts.liquid %}
24
+ {% endif %}
25
+
26
+ {% if page.typograms %}
27
+ <!-- Typograms -->
28
+ <script src="{{ '/assets/js/typograms.js' | relative_url | bust_file_cache }}"></script>
29
+ {% endif %}
30
+
31
+ <!-- Tooltips & popovers runtime -->
32
+ <script src="{{ '/assets/js/tooltips-setup.js' | relative_url | bust_file_cache }}"></script>
33
+
34
+ {% if page.pretty_table and site.al_folio.compat.bootstrap.enabled %}
35
+ <!-- Bootstrap Table -->
36
+ <!-- Bootstrap Table doesn't go well with diff2html -->
37
+ <script
38
+ defer
39
+ src="{{ site.third_party_libraries.bootstrap-table.url.js }}"
40
+ integrity="{{ site.third_party_libraries.bootstrap-table.integrity.js }}"
41
+ crossorigin="anonymous"
42
+ ></script>
43
+ {% endif %}
44
+
45
+ <!-- Load Common JS -->
46
+ <script src="{{ '/assets/js/no_defer.js' | relative_url | bust_file_cache }}"></script>
47
+ <script defer src="{{ '/assets/js/common.js' | relative_url | bust_file_cache }}"></script>
48
+ <script defer src="{{ '/assets/js/copy_code.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
49
+
50
+ <!-- Jupyter Open External Links New Tab -->
51
+ <script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
52
+
53
+ <!-- Removed Badges -->
54
+
55
+ {% if site.enable_cookie_consent and site.plugins contains 'al_cookie' %}
56
+ <!-- Cookie Consent -->
57
+ {% include plugins/al_cookie_scripts.liquid %}
58
+ {% endif %}
59
+ {% if site.plugins contains 'al_analytics' %}
60
+ <!-- Analytics -->
61
+ {% include plugins/al_analytics_scripts.liquid %}
62
+ {% endif %}
63
+
64
+ {% if site.plugins contains 'al_img_tools' %}
65
+ <!-- Image Features -->
66
+ {% include plugins/al_img_tools_scripts.liquid %}
67
+ {% endif %}
68
+
69
+ {% if site.enable_progressbar %}
70
+ <!-- Scrolling Progress Bar -->
71
+ <script defer src="{{ '/assets/js/progress-bar.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
72
+ {% endif %}
73
+
74
+ {% if page.tabs %}
75
+ <!-- Jekyll Tabs -->
76
+ <script src="{{ '/assets/js/tabs.min.js' | relative_url | bust_file_cache }}"></script>
77
+ {% endif %}
78
+
79
+ {% if site.back_to_top %}
80
+ <!-- Back to Top -->
81
+ <script src="{{ '/assets/js/vanilla-back-to-top.min.js' | relative_url | bust_file_cache }}"></script>
82
+ <script>
83
+ addBackToTop();
84
+ </script>
85
+ {% endif %}
86
+
87
+ {% if site.search_enabled %}
88
+ <!-- Search -->
89
+ {% if site.plugins contains 'al_search' %}
90
+ {% include plugins/al_search_assets.liquid %}
91
+ {% endif %}
92
+ {% endif %}
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: al_folio_distill
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - al-folio maintainers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-02-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: liquid
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '6.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '4.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '6.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '2.0'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '2.0'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '3.0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: rake
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '13.0'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '13.0'
87
+ - !ruby/object:Gem::Dependency
88
+ name: minitest
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: '5.0'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: '5.0'
101
+ description: Provides Distill templates, runtime assets, and policy checks for al-folio
102
+ sites.
103
+ email:
104
+ - maintainers@al-folio.dev
105
+ executables: []
106
+ extensions: []
107
+ extra_rdoc_files: []
108
+ files:
109
+ - CHANGELOG.md
110
+ - LICENSE
111
+ - README.md
112
+ - assets/css/al-folio-distill.css
113
+ - assets/js/distillpub/overrides.js
114
+ - assets/js/distillpub/provenance.json
115
+ - assets/js/distillpub/template.v2.js
116
+ - assets/js/distillpub/template.v2.js.map
117
+ - assets/js/distillpub/transforms.v2.js
118
+ - assets/js/distillpub/transforms.v2.js.map
119
+ - lib/al_folio_distill.rb
120
+ - lib/al_folio_distill/version.rb
121
+ - scripts/distill/sync_distill.sh
122
+ - templates/distill/render.liquid
123
+ - templates/distill/scripts.liquid
124
+ homepage: https://github.com/al-org-dev/al-folio-distill
125
+ licenses:
126
+ - MIT
127
+ metadata:
128
+ allowed_push_host: https://rubygems.org
129
+ homepage_uri: https://github.com/al-org-dev/al-folio-distill
130
+ source_code_uri: https://github.com/al-org-dev/al-folio-distill
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '2.7'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubygems_version: 3.4.10
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: Distill rendering plugin for al-folio v1.x
150
+ test_files: []