jekyll-bluesky 0.11.0 → 0.12.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: 179c2fb2821b468b6c7b23798efd0b4287055a2024e879e2ce8555772d6eb03c
4
- data.tar.gz: 1c9c2121eb2b825f1ad449991a5ddbee65d4af159642d2d33bef84d149ed22b4
3
+ metadata.gz: b99ca50ea8fe4e2638f5a302deacf09e97bcbecd8069e361d781cd8fa19b8179
4
+ data.tar.gz: 5631fd6df6e75c4da2837bd58e254412a428f130237cae9f42b89242f869d2e4
5
5
  SHA512:
6
- metadata.gz: e7fc45af09ee3430f0b2a8fede4cffd3a9edf1b548f0c5cffc6c84784360db176e8a365bb06b66efade9e4fd3208f3b046d9e175add9a9d7448890223d1a7519
7
- data.tar.gz: 16e2690e404e7100e849be1874776cdd3bcab8801a726f252e368381f455d42eb4117c330fe0a0fb621c0336d87974f1a9112fe3951e10b1ce3886af6667b0dc
6
+ metadata.gz: 249d7ddba3aa9cba3ad066149ffda4debe5ad89f428dd7267153176ba55bd1eec1586159058d345d7bbb03b0a76fc24dcd01cf20f83d3f9804e82046e9629de6
7
+ data.tar.gz: 9d1ede5999d1848f6aa3e216435a0afc6c0c0984f8fa847451717019024e617ff049391fc4eafa2ca4d4a2ee3e77b9ad0c02041103f6682e26bf0a9fb7c1cbfa
@@ -1,6 +1,6 @@
1
1
  # lib/jekyll-bluesky/version.rb
2
2
  module Jekyll
3
3
  module Bluesky
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
6
6
  end
@@ -5,7 +5,7 @@ require "json"
5
5
  require "digest"
6
6
  require "fileutils" # Needed for FileCache
7
7
 
8
- puts "Plugin jekyll-bluesky load sucessfuly!"
8
+ puts "Plugin jekyll-bluesky load successfully!"
9
9
 
10
10
  module Jekyll
11
11
  class BlueskyPlugin < Liquid::Tag
@@ -43,62 +43,61 @@ module Jekyll
43
43
  end
44
44
  end
45
45
 
46
- class Client
47
- API_URL = "https://public.api.bsky.app"
46
+ class Client
47
+ API_URL = "https://public.api.bsky.app"
48
48
 
49
- def self.fetch_post(actor, limit)
50
- response = HTTP.get("#{API_URL}/xrpc/app.bsky.feed.getAuthorFeed?actor=#{actor}&limit=#{limit}&filter=posts_and_author_threads")
51
- if response.status.success?
52
- data = JSON.parse(response.body)
53
- format_post(data)
54
- else
55
- "Error fetching post from Bluesky."
56
- end
49
+ def self.fetch_post(actor, limit)
50
+ response = HTTP.get("#{API_URL}/xrpc/app.bsky.feed.getAuthorFeed?actor=#{actor}&limit=#{limit}&filter=posts_and_author_threads")
51
+ if response.status.success?
52
+ data = JSON.parse(response.body)
53
+ format_post(data)
54
+ else
55
+ "Error fetching post from Bluesky."
57
56
  end
57
+ end
58
58
 
59
- def self.format_post(data)
60
- posts = data["feed"]
61
- posts.map do |post|
62
- post_data = post["post"]
63
- author = post_data["author"]
64
- record = post_data["record"]
65
- embed = post_data["embed"]
66
-
67
- text = record["text"]
68
- author_name = author["displayName"]
69
- author_handle = author["handle"]
70
-
71
- image_html = ""
72
- if embed && embed["$type"] == "app.bsky.embed.images#view"
73
- image_html = embed["images"].map do |image|
74
- <<~HTML
75
- <img src="#{image['thumb']}" alt="#{image['alt']}" class="bluesky-image" />
76
- HTML
77
- end.join
78
- end
79
-
80
- <<~HTML
81
- <div class="bluesky-post">
82
- <div class="bluesky-author">
83
- <img src="#{author['avatar']}" alt="#{author_name}" class="bluesky-avatar" />
84
- <div class="bluesky-author-info">
85
- <strong>#{author_name}</strong>
86
- <small>@#{author_handle}</small>
87
- </div>
88
- </div>
89
- <div class="bluesky-content">
90
- <p>#{text}</p>
91
- #{image_html}
92
- </div>
93
- <div class="bluesky-stats">
94
- <span>❤️ #{post_data["likeCount"]}</span>
95
- <span>🔁 #{post_data["repostCount"]}</span>
96
- <span>💬 #{post_data["replyCount"]}</span>
59
+ def self.format_post(data)
60
+ posts = data["feed"]
61
+ posts.map do |post|
62
+ post_data = post["post"]
63
+ author = post_data["author"]
64
+ record = post_data["record"]
65
+ embed = post_data["embed"]
66
+
67
+ text = record["text"]
68
+ author_name = author["displayName"]
69
+ author_handle = author["handle"]
70
+
71
+ image_html = ""
72
+ if embed && embed["$type"] == "app.bsky.embed.images#view"
73
+ image_html = embed["images"].map do |image|
74
+ <<~HTML
75
+ <img src="#{image['thumb']}" alt="#{image['alt']}" class="bluesky-image" />
76
+ HTML
77
+ end.join
78
+ end
79
+
80
+ <<~HTML
81
+ <div class="bluesky-post">
82
+ <div class="bluesky-author">
83
+ <img src="#{author['avatar']}" alt="#{author_name}" class="bluesky-avatar" />
84
+ <div class="bluesky-author-info">
85
+ <strong>#{author_name}</strong>
86
+ <small>@#{author_handle}</small>
97
87
  </div>
98
88
  </div>
99
- HTML
100
- end.join("\n")
101
- end
89
+ <div class="bluesky-content">
90
+ <p>#{text}</p>
91
+ #{image_html}
92
+ </div>
93
+ <div class="bluesky-stats">
94
+ <span>❤️ #{post_data["likeCount"]}</span>
95
+ <span>🔁 #{post_data["repostCount"]}</span>
96
+ <span>💬 #{post_data["replyCount"]}</span>
97
+ </div>
98
+ </div>
99
+ HTML
100
+ end.join("\n")
102
101
  end
103
102
  end
104
103
 
@@ -128,4 +127,5 @@ module Jekyll
128
127
  end
129
128
  end
130
129
 
131
- Liquid::Template.register_tag "bluesky", self
130
+ # Register the Liquid tag
131
+ Liquid::Template.register_tag "bluesky", Jekyll::BlueskyPlugin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-bluesky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Dias