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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ded1a72f3e590ee00a81fa796362243e35b58e419f158f851a7ca4db19905ce8
4
- data.tar.gz: 89c1b7b0b246359871a47b872c92e198f85bd8d61d6bf9f72ca8e9c49ce2dca9
3
+ metadata.gz: c1ecfa381c475f48a225d4dce09749a61889301fe215e18001957dec8f550712
4
+ data.tar.gz: 03774436373f3565bf0435a733b3cc6faaaa318ed209a8bc553990b1c9a6cfd8
5
5
  SHA512:
6
- metadata.gz: d1238923ed9780e6a0314b9b2a03407b40036948f1ee241147e4820036d2db3c5167972d970f468803853eca4613ee2881e4d3471df8ccf4222889563d026f96
7
- data.tar.gz: 284fd114b4d63d660c3619ecbb1352057035b8ef9ed1ed6708eb1bdbeef78932849f9a111ef96acebfbb2fc120a79d87e990d671f9c0a6a4076707eb40869495
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
- description = 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)
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&.strip&.gsub(/\s+/, " ")&.slice(0, 200),
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 << "- [#{item[:title]}](#{item[:url]})"
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllLlmsGenerator
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-llms-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Chance