diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a108cc8..475da9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.1 + ruby-version: 3.3 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Generate document diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f629bba..16b2f3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.1 + ruby-version: 3.3 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Generate document diff --git a/Gemfile b/Gemfile index d20f020..55d0529 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ group :jekyll_plugins do gem 'jekyll-paginate-v2' end -gem 'image_size', '~> 3.0' +gem 'fastimage', '~> 2.3' group :lsi do gem 'numo-narray' diff --git a/Gemfile.lock b/Gemfile.lock index 5433b17..9a8b7f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,27 +1,53 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - bigdecimal (3.1.7) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + bigdecimal (3.1.8) classifier-reborn (2.3.0) fast-stemmer (~> 1.0) matrix (~> 0.4) colorator (1.1.0) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.4) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) eventmachine (1.2.7) fast-stemmer (1.0.2) - ffi (1.16.3) + fastimage (2.3.1) + ffi (1.17.0) + ffi (1.17.0-aarch64-linux-gnu) + ffi (1.17.0-aarch64-linux-musl) + ffi (1.17.0-arm-linux-gnu) + ffi (1.17.0-arm-linux-musl) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86-linux-gnu) + ffi (1.17.0-x86-linux-musl) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.0-x86_64-linux-musl) forwardable-extended (2.6.0) - google-protobuf (4.26.1-x86_64-linux) + google-protobuf (4.27.3) + bigdecimal + rake (>= 13) + google-protobuf (4.27.3-aarch64-linux) + bigdecimal + rake (>= 13) + google-protobuf (4.27.3-arm64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.27.3-x86-linux) + bigdecimal + rake (>= 13) + google-protobuf (4.27.3-x86_64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.27.3-x86_64-linux) + bigdecimal rake (>= 13) http_parser.rb (0.8.0) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) - image_size (3.4.0) jekyll (4.3.3) addressable (~> 2.4) colorator (~> 1.0) @@ -61,20 +87,63 @@ GEM numo-narray (0.9.2.1) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (5.0.5) + public_suffix (6.0.1) rake (13.2.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.3.3) + rexml (3.3.5) strscan - rouge (4.2.1) + rouge (4.3.0) safe_yaml (1.0.5) - sass-embedded (1.76.0-x86_64-linux-gnu) - google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.77.8) + google-protobuf (~> 4.26) + rake (>= 13) + sass-embedded (1.77.8-aarch64-linux-android) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-aarch64-linux-gnu) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-aarch64-linux-musl) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-aarch64-mingw-ucrt) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-arm-linux-androideabi) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-arm-linux-gnueabihf) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-arm-linux-musleabihf) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-arm64-darwin) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-riscv64-linux-android) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-riscv64-linux-gnu) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-riscv64-linux-musl) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86-cygwin) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86-linux-android) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86-linux-gnu) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86-linux-musl) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86-mingw-ucrt) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86_64-cygwin) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86_64-darwin) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86_64-linux-android) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86_64-linux-gnu) + google-protobuf (~> 4.26) + sass-embedded (1.77.8-x86_64-linux-musl) + google-protobuf (~> 4.26) strscan (3.1.0) sync (0.5.0) - term-ansicolor (1.8.0) + term-ansicolor (1.11.2) tins (~> 1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -85,12 +154,37 @@ GEM webrick (1.8.1) PLATFORMS - x86_64-linux + aarch64-linux + aarch64-linux-android + aarch64-linux-gnu + aarch64-linux-musl + aarch64-mingw-ucrt + arm-linux-androideabi + arm-linux-gnu + arm-linux-gnueabihf + arm-linux-musl + arm-linux-musleabihf + arm64-darwin + riscv64-linux-android + riscv64-linux-gnu + riscv64-linux-musl + ruby + x86-cygwin + x86-linux + x86-linux-android + x86-linux-gnu + x86-linux-musl + x86-mingw-ucrt + x86_64-cygwin + x86_64-darwin + x86_64-linux-android + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES classifier-reborn + fastimage (~> 2.3) http_parser.rb (~> 0.6.0) - image_size (~> 3.0) jekyll (~> 4.3) jekyll-archives jekyll-paginate-v2 @@ -104,7 +198,7 @@ DEPENDENCIES webrick RUBY VERSION - ruby 3.3.1p55 + ruby 3.3.4p94 BUNDLED WITH - 2.4.10 + 2.5.11 diff --git a/_plugins/asset_image_path.rb b/_plugins/asset_image_path.rb index 993397d..bd3969d 100644 --- a/_plugins/asset_image_path.rb +++ b/_plugins/asset_image_path.rb @@ -2,13 +2,12 @@ # Title: Simple Image Path URL expansion tag # Author: @cat_in_136 # -# Copyright (C) 2014 @cat_in_136 +# Copyright (C) 2014-2024 @cat_in_136 # # Avarilable under MIT License # -require 'image_size' -require 'rexml/document' +require 'fastimage' module Jekyll class AssetImagePathTag < Liquid::Tag @@ -47,24 +46,8 @@ def render(context) end def self.get_size(filename) - width = height = nil path = File.expand_path("../images/#{filename}", File.basename(__FILE__)) - raise "File not found: '#{filename}'" unless File.exist?(path) - if (File.extname(path).downcase == '.svg') - File.open(path, 'r') do |f| - f.flock(File::LOCK_SH) - doc = REXML::Document.new(f) - width = doc.root.attribute(:width).value.to_f.round # "/*/@width" - height = doc.root.attribute(:height).value.to_f.round # "/*/@height" - end - else - File.open(path, 'r') do |f| - f.flock(File::LOCK_SH) - imgsize = ImageSize.new(f) - width = imgsize.width - height = imgsize.height - end - end + width, height = FastImage.size(path) [width, height] end