jekyll-github-code 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1528b23a3cae07ee662558e4f84c366fa30a586c9abc3c51692871ed91cf498c
4
- data.tar.gz: 9a859be4d4bae3d2bf1f0b41e1d9e8176e031898d1c583f04ebb5a01cafd0050
3
+ metadata.gz: a8371ea2bd07b6ffc3db43573843179b8bf420c02c59e252771cfa27c1df38b1
4
+ data.tar.gz: a0e590925ed33002b75815b6018e015fa6291baa1f6d93af4e4e57bbbea94dff
5
5
  SHA512:
6
- metadata.gz: ef44a7f951c544fe674018a9ed9f83fdc30d45a01d969663d8603a47a87ad165f50e146ed0c4ae8c1669a84c0b673e5fdfaf553ac659a4182e2f780ea3e2d1fc
7
- data.tar.gz: bd8e2f4d06614fd5e9353ebaa382e9bdf21f33efe7ea910d17e028a5ac6204e4eb7826ca56a38d8e69206044589274655791cc43eafd6c1ca773a3694b4051c9
6
+ metadata.gz: 750b8c33c7c1cc37fc556ec7d12aad267bc13dcc28bae4263362af57724b8d8ad58697e09e7eec40db4f1c8b49eea0b85ba7de2606fb449e740806c05a981dfd
7
+ data.tar.gz: 4463d6f073ada40c343da33d28571d4ae0bcaa8863c24889e2057003b03f25902a3d531e74ca80aab2146a19e15da859546dd4472b60df3dd4556e2311e1bca2
data/CHANGELOG.md CHANGED
@@ -5,12 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.2.0] - 2025-12-12
8
+ ## [0.2.2] - 2025-12-12
9
+
10
+ ### Fixed
11
+ - Fix override with jekyll-github-card
12
+
13
+ ## [0.2.1] - 2025-12-12
9
14
 
10
15
  ### Fixed
11
- - Automatic asset generation (CSS and JS copied to `_site/assets/github-code/`)
16
+ - Location for automatic asset generation (css and js copied to `_site/assets/github-code/`)
12
17
 
18
+ ## [0.2.0] - 2025-12-12
13
19
 
20
+ ### Added
21
+ - Automatic asset generation (css and js copied to `_site/assets/github-code/`)
14
22
 
15
23
  ## [0.1.0] - 2025-12-12
16
24
 
@@ -1,72 +1,80 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jekyll
4
- module GitHubCode
5
- # Generator that copies the CSS and JS assets to the site
6
- class Generator < Jekyll::Generator
4
+ module GithubCode
5
+ class CodeStyleGenerator < Jekyll::Generator
7
6
  safe true
8
- priority :lowest
7
+ priority :low
9
8
 
10
9
  def generate(site)
11
- # Find the gem's root directory (where assets/ is located)
12
- gem_root = File.expand_path('../../..', __dir__)
13
- assets_source = File.join(gem_root, 'assets')
10
+ content = File.read(File.join(File.dirname(__FILE__), "..", "..", "assets", "css", "github-code.css"))
14
11
 
15
- # Copy CSS file
16
- css_source = File.join(assets_source, 'css', 'github-code.css')
17
- if File.exist?(css_source)
18
- site.static_files << AssetFile.new(
19
- site,
20
- assets_source,
21
- 'css',
22
- 'github-code.css'
23
- )
24
- end
12
+ # Create a static file for the CSS
13
+ site.static_files << CodeStyleFile.new(site, content)
14
+ end
15
+ end
16
+
17
+ class JavaScriptGenerator < Jekyll::Generator
18
+ safe true
19
+ priority :low
20
+
21
+ def generate(site)
22
+ content = File.read(File.join(File.dirname(__FILE__), "..", "..", "assets", "js", "github-code.js"))
25
23
 
26
- # Copy JS file
27
- js_source = File.join(assets_source, 'js', 'github-code.js')
28
- if File.exist?(js_source)
29
- site.static_files << AssetFile.new(
30
- site,
31
- assets_source,
32
- 'js',
33
- 'github-code.js'
34
- )
35
- end
24
+ # Create a static file for the CSS
25
+ site.static_files << JavaScriptFile.new(site, content)
36
26
  end
37
27
  end
38
28
 
39
- # Custom static file class for gem assets
40
- class AssetFile < Jekyll::StaticFile
41
- def initialize(site, base, dir, name)
29
+ class CodeStyleFile < Jekyll::StaticFile
30
+ def initialize(site, content)
42
31
  @site = site
43
- @base = base
44
- @dir = dir
45
- @name = name
46
- @relative_path = File.join(dir, name)
47
- @extname = File.extname(name)
48
- @collection = nil
32
+ @content = content
33
+ @relative_path = "/assets/css/github-code.css"
34
+ @extname = ".css"
35
+ @name = "github-code.css"
36
+ @dir = "/assets/css"
37
+ end
38
+
39
+ def write(dest)
40
+ dest_path = File.join(dest, @relative_path)
41
+ FileUtils.mkdir_p(File.dirname(dest_path))
42
+ File.write(dest_path, @content)
43
+ true
49
44
  end
50
45
 
51
46
  def path
52
- File.join(@base, @dir, @name)
47
+ @relative_path
53
48
  end
54
49
 
55
- def destination(dest)
56
- File.join(dest, 'assets', 'github-code', @dir, @name)
50
+ def relative_path
51
+ @relative_path
57
52
  end
53
+ end
58
54
 
59
- def write(dest)
60
- dest_path = destination(dest)
61
- return false unless File.exist?(path)
55
+ class JavaScriptFile < Jekyll::StaticFile
56
+ def initialize(site, content)
57
+ @site = site
58
+ @content = content
59
+ @relative_path = "/assets/js/github-code.js"
60
+ @extname = ".js"
61
+ @name = "github-code.js"
62
+ @dir = "/assets/js"
63
+ end
62
64
 
65
+ def write(dest)
66
+ dest_path = File.join(dest, @relative_path)
63
67
  FileUtils.mkdir_p(File.dirname(dest_path))
64
- FileUtils.cp(path, dest_path)
68
+ File.write(dest_path, @content)
65
69
  true
66
70
  end
67
71
 
68
- def modified?
69
- true
72
+ def path
73
+ @relative_path
74
+ end
75
+
76
+ def relative_path
77
+ @relative_path
70
78
  end
71
79
  end
72
80
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module GitHubCode
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
8
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-github-code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodolfo Olivieri