jekyll-llms 0.1.1 → 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: 57d82d3bfe869a5d72d4df4e09ee949f2306986a4280d01ed68f619af99e9876
4
- data.tar.gz: 1f335c5be7fb633c0b140ed57ed5bed3a1e55ea735d78202096d777bf574d75c
3
+ metadata.gz: 48ccdbd84d3c01d8fc4efa05141ab0501416004faf3185fd0e613488ef98accb
4
+ data.tar.gz: 7d116b7037ffd8a96cc7b05ce5f3b2990b772a183e1c4d795f5f6c91b9c5d814
5
5
  SHA512:
6
- metadata.gz: 5d9d5f38e376bb2a707832fb72466a559c31f8c3e7bac12fccdf6f4a4292475bcf57772db5ff577443a55b5c82371cbfd37ccd5692ec12c23a2d9f8c61420ad0
7
- data.tar.gz: '09bacc3aa61d09e578b2a397c7384f75ab4edd5a7509962a8bdb775f74bbcc3bb536107939d2b65acfbed844828d223995da60ee19a7b1b4e0c855def195d231'
6
+ metadata.gz: fc07ec9876c91ba823fd05334393c7f713a58460b9e5d6bffe605b6dbc67fc76c5f8c0e25dff4e4485970ea30148d3fb6f3ba218632ec98d90d1a320e6b4f2cd
7
+ data.tar.gz: fa433ac872fdf80b6f87152209fe06ce7202b2dfadfc8540028bc5f2892c7ca38245a1dee3d4e024124fc4ca5097f75b6ff93314a7b8aab8fe081060178862ac
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.2.0
6
+
7
+ ### Fixed
8
+
9
+ - Ensure that one invalid markdown file will not block publishing of all markdown files.
10
+
5
11
  ## 0.1.1
6
12
 
7
13
  ### Changed
@@ -3,10 +3,10 @@
3
3
  module Jekyll
4
4
  module Llms
5
5
  class Index
6
- def initialize(site:, entries:, markdown:)
6
+ def initialize(site:, entries:, url_for:)
7
7
  @site = site
8
8
  @entries = entries
9
- @markdown = markdown
9
+ @url_for = url_for
10
10
  end
11
11
 
12
12
  def content
@@ -25,7 +25,7 @@ module Jekyll
25
25
 
26
26
  private
27
27
 
28
- attr_reader :site, :entries, :markdown
28
+ attr_reader :site, :entries, :url_for
29
29
 
30
30
  def title
31
31
  site.config.fetch("title", "Jekyll Site")
@@ -36,7 +36,7 @@ module Jekyll
36
36
  end
37
37
 
38
38
  def entry_line(entry)
39
- line = "- [#{entry.title}](#{entry.url.absolute(markdown: markdown && entry.markdown_source?)})"
39
+ line = "- [#{entry.title}](#{url_for.call(entry)})"
40
40
  entry.description.empty? ? line : "#{line}: #{entry.description}"
41
41
  end
42
42
 
@@ -11,28 +11,44 @@ module Jekyll
11
11
  end
12
12
 
13
13
  def write
14
- write_index if config.llms_txt?
15
- if config.markdown?
16
- write_markdown
17
- write_html_links
18
- end
14
+ markdown_entries = config.markdown? ? write_markdown : []
15
+
16
+ write_index(markdown_entries) if config.llms_txt?
17
+ write_html_links(markdown_entries)
19
18
  end
20
19
 
21
20
  private
22
21
 
23
22
  attr_reader :site, :config, :entries, :files
24
23
 
25
- def write_index
26
- files.write("llms.txt", Index.new(site: site, entries: entries, markdown: config.markdown?).content)
24
+ def write_index(markdown_entries)
25
+ files.write("llms.txt", Index.new(site: site, entries: entries, url_for: index_url(markdown_entries)).content)
26
+ end
27
+
28
+ def index_url(markdown_entries)
29
+ lambda do |entry|
30
+ entry.url.absolute(markdown: markdown_entries.include?(entry))
31
+ end
27
32
  end
28
33
 
29
34
  def write_markdown
30
- markdown_entries.each do |entry|
31
- files.write(entry.url.markdown_path, MarkdownSource.new(site: site, item: entry.item).content)
35
+ markdown_entries.filter_map do |entry|
36
+ content = markdown_content(entry)
37
+ next unless content
38
+
39
+ files.write(entry.url.markdown_path, content)
40
+ entry
32
41
  end
33
42
  end
34
43
 
35
- def write_html_links
44
+ def markdown_content(entry)
45
+ MarkdownSource.new(site: site, item: entry.item).content
46
+ rescue Liquid::Error, SystemCallError => error
47
+ Jekyll.logger.warn("LLMs:", "Skipping markdown sidecar for #{entry.item.relative_path}: #{error}")
48
+ nil
49
+ end
50
+
51
+ def write_html_links(markdown_entries)
36
52
  HtmlLinker.new(site: site, entries: markdown_entries).write
37
53
  end
38
54
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Llms
5
- VERSION = "0.1.1"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-llms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav Katkov