jekyll-llms-generator 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/jekyll/llms_txt_generator.rb +17 -7
- data/lib/jekyll-llms-generator/version.rb +1 -1
- 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: c1ecfa381c475f48a225d4dce09749a61889301fe215e18001957dec8f550712
|
|
4
|
+
data.tar.gz: 03774436373f3565bf0435a733b3cc6faaaa318ed209a8bc553990b1c9a6cfd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4ab4518dd4d44c26fca849984e755b10ab7e19d97cab3866ebb9af8873e951b62f2fe1bfd68dd8fde6fcb4218582d7da2961fc886133e1affa8631f88b3a363
|
|
7
|
+
data.tar.gz: 53ddba5fd8e241338169001f0d0bad3356c948b43d308cae8a44fc90f3c9cbb36961248ef044b7ef840055ad6d0af6db9a9ff6950ceebd16c96d39784fe27ecb
|
|
@@ -136,15 +136,22 @@ module Jekyll
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
def doc_to_item(doc)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
raw_desc = doc.data["description"] ||
|
|
140
|
+
doc.data["tagline"] ||
|
|
141
|
+
(doc.data["excerpt"]&.output ? strip_html(doc.data["excerpt"].output) : nil) ||
|
|
142
|
+
(doc.excerpt ? strip_html(doc.excerpt.output) : nil)
|
|
143
|
+
|
|
144
|
+
description = if raw_desc
|
|
145
|
+
cleaned = raw_desc.strip.gsub(/\s+/, " ")
|
|
146
|
+
# Use first sentence rather than a hard char truncation
|
|
147
|
+
first_sentence = cleaned.match(/\A.+?[.!?](?:\s|$)/)
|
|
148
|
+
first_sentence ? first_sentence[0].strip : cleaned
|
|
149
|
+
end
|
|
143
150
|
|
|
144
151
|
{
|
|
145
152
|
title: doc.data["title"],
|
|
146
153
|
url: "#{site_base_url}#{doc.url}",
|
|
147
|
-
description: description
|
|
154
|
+
description: description,
|
|
148
155
|
content: doc.content
|
|
149
156
|
}
|
|
150
157
|
end
|
|
@@ -158,11 +165,14 @@ module Jekyll
|
|
|
158
165
|
|
|
159
166
|
def format_item_full(item)
|
|
160
167
|
lines = []
|
|
161
|
-
lines << "
|
|
168
|
+
lines << "### [#{item[:title]}](#{item[:url]})"
|
|
169
|
+
desc = item[:description]
|
|
170
|
+
lines << "" << "> #{desc}" if desc && !desc.empty?
|
|
162
171
|
if item[:content] && !item[:content].empty?
|
|
163
172
|
stripped = strip_html(item[:content]).strip.gsub(/\s+/, " ")
|
|
164
|
-
lines << "" << stripped
|
|
173
|
+
lines << "" << stripped
|
|
165
174
|
end
|
|
175
|
+
lines << "" << "---"
|
|
166
176
|
lines.join("\n")
|
|
167
177
|
end
|
|
168
178
|
|