al_comments 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/al_comments.rb +34 -17
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b21be4d1edaba6ece5ead7b8a4a367d44f8931ba71e789923d5420a3edc88958
|
|
4
|
+
data.tar.gz: 378e2a1016b2e1775665ab3ff6ade1bf21fd4cc9c37ba24d31efcba5f7b56ae1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 458b7d6f979287163ccdc1ee7a59be3d8989aace5cf526bb6826809e4a0fbacba2e9255f8796d4045eb703dc9a7982e4454109b30f377171b93da38b2def58d1
|
|
7
|
+
data.tar.gz: 3eb9b4fc9c64fc6414d5411635503a37ee8fff72edcc8d9e26498f4eb5959874f5d435fc450fcbabb9b7503cda215e772f579aef559af6a678d94c959a8948a8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2 - 2026-02-07
|
|
4
|
+
- Aligned giscus activation behavior with al-folio main branch expectations:
|
|
5
|
+
- Removed fallback from `site.repository` / `site.github.repository_nwo` to avoid partially configured giscus injection.
|
|
6
|
+
- Requires `repo`, `repo_id`, `category`, and `category_id` before loading giscus client script.
|
|
7
|
+
- Shows theme-side warning with missing required keys when configuration is incomplete.
|
|
8
|
+
- Expanded tests for incomplete giscus config handling.
|
|
9
|
+
|
|
3
10
|
## 0.1.1 - 2026-02-07
|
|
4
11
|
- Improved config compatibility for comment rendering:
|
|
5
12
|
- Supports both string and symbol keys for nested config values.
|
data/lib/al_comments.rb
CHANGED
|
@@ -81,20 +81,42 @@ module AlComments
|
|
|
81
81
|
nested.is_a?(Hash) ? nested : {}
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
def resolve_giscus_repo(
|
|
84
|
+
def resolve_giscus_repo(_site, giscus)
|
|
85
85
|
repo = fetch_key(giscus, 'repo', 'repository', 'repo_name')
|
|
86
|
-
return
|
|
86
|
+
return '' if value_blank?(repo)
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
repo.to_s
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def missing_giscus_fields(giscus, repo)
|
|
92
|
+
required = {
|
|
93
|
+
'repo' => repo,
|
|
94
|
+
'repo_id' => fetch_key(giscus, 'repo_id'),
|
|
95
|
+
'category' => fetch_key(giscus, 'category'),
|
|
96
|
+
'category_id' => fetch_key(giscus, 'category_id')
|
|
97
|
+
}
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
repository_nwo = fetch_key(github, 'repository_nwo')
|
|
94
|
-
return repository_nwo.to_s unless value_blank?(repository_nwo)
|
|
99
|
+
required.each_with_object([]) do |(name, value), missing|
|
|
100
|
+
missing << name if value_blank?(value)
|
|
95
101
|
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def giscus_warning_html(style, spacer, missing_fields)
|
|
105
|
+
details = if missing_fields.empty?
|
|
106
|
+
''
|
|
107
|
+
else
|
|
108
|
+
"<p>Missing required keys: <code>#{missing_fields.join(', ')}</code>.</p>"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
warning = <<~HTML
|
|
112
|
+
<blockquote class="block-danger">
|
|
113
|
+
<h5>giscus comments misconfigured</h5>
|
|
114
|
+
<p>Please follow instructions at <a href="http://giscus.app">http://giscus.app</a> and update your giscus configuration.</p>
|
|
115
|
+
#{details}
|
|
116
|
+
</blockquote>
|
|
117
|
+
HTML
|
|
96
118
|
|
|
97
|
-
|
|
119
|
+
%(<div id="giscus_thread"#{style}>#{spacer}\n#{warning}</div>)
|
|
98
120
|
end
|
|
99
121
|
|
|
100
122
|
def disqus_html(site, page, disqus_shortname)
|
|
@@ -127,15 +149,10 @@ module AlComments
|
|
|
127
149
|
max_width = fetch_key(site.config, 'max_width')
|
|
128
150
|
style = post_layout?(page) ? " style=\"max-width: #{max_width}; margin: 0 auto;\"" : ''
|
|
129
151
|
spacer = post_layout?(page) ? "\n <br>" : ''
|
|
152
|
+
missing_fields = missing_giscus_fields(giscus, repo)
|
|
130
153
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<blockquote class="block-danger">
|
|
134
|
-
<h5>giscus comments misconfigured</h5>
|
|
135
|
-
<p>Please follow instructions at <a href="http://giscus.app">http://giscus.app</a> and update your giscus configuration.</p>
|
|
136
|
-
</blockquote>
|
|
137
|
-
HTML
|
|
138
|
-
return %(<div id="giscus_thread"#{style}>#{spacer}\n#{warning}</div>)
|
|
154
|
+
unless missing_fields.empty?
|
|
155
|
+
return giscus_warning_html(style, spacer, missing_fields)
|
|
139
156
|
end
|
|
140
157
|
|
|
141
158
|
<<~HTML
|