jekyll-koziolekweb-deorphanter 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e031583a940a7ac293764758fb2fca7f4d4e6d8d9a19cee200ee82eb1a4e3117
4
+ data.tar.gz: 10636efdc51de7d4f7847def679741d13ea34e98a2450dc136816a5f6cdb9997
5
+ SHA512:
6
+ metadata.gz: 68d51908f864e9ff282644c82ce6f15713be3d1d1a215e6c0fd34fb583a43471cab53c2c70fbd2a979b95097fb84f50a902dbc20d6855f6be018df69a51b6b71
7
+ data.tar.gz: 6f104230b1fea07468749741e1bb820fe14c5f2a78c4b5333da082c6b791eb9f5f6c26cbaa75b5f585118fe5edea6e586b4973169dca2f0d3cc21dfeb676d88d
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Koziolek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Koziolekweb::Deorphanter
2
+
3
+ A Jekyll plugin that replaces spaces after single letters with ` ` to prevent orphaned single letters at the end of lines in your content.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add jekyll-koziolekweb-deorphanter
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install jekyll-koziolekweb-deorphanter
14
+
15
+ ## Usage
16
+
17
+ Add the plugin to your site's `_config.yml`:
data/Rakefile ADDED
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+ require "rubygems/tasks"
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ # Definiowanie zadania testowego z RSpec
7
+ RSpec::Core::RakeTask.new(:spec) do |t|
8
+ t.pattern = "spec/**/*_spec.rb" # Pliki testowe w katalogu spec
9
+ end
10
+
11
+ desc "Uruchom testy RSpec"
12
+ task :test => :spec
13
+
14
+ desc "Stwórz gem, wygeneruj changelog, utwórz tag i wypchnij"
15
+ task :myrelease do
16
+ # Sprawdzenie obecności pliku .gemspec
17
+ gemspec_filename = Dir.glob("*.gemspec").first
18
+ abort("Brak pliku .gemspec!") unless gemspec_filename
19
+
20
+ # Pobierz dane gemspec (np. wersję)
21
+ gemspec = Gem::Specification.load(gemspec_filename)
22
+ gem_name = gemspec.name
23
+ gem_version = gemspec.version.to_s
24
+
25
+ # 1. Wygeneruj gem
26
+ Rake::Task[:build_gem].invoke
27
+
28
+ # 2. Wygeneruj changelog
29
+ Rake::Task[:generate_changelog].invoke
30
+
31
+ # 3. Utwórz tag gita
32
+ Rake::Task[:create_git_tag].invoke
33
+
34
+ # 4. Wypchnij tag na zdalny repozytorium
35
+ Rake::Task[:push_git_tag].invoke
36
+
37
+ # 5. Wypchnij gem na RubyGems
38
+ Rake::Task[:push_gem].invoke
39
+
40
+ # 6. Zwiększ wersję w pliku VERSION
41
+ Rake::Task[:bump_version].invoke
42
+
43
+ puts "Wersja #{gem_name} #{gem_version} została zbudowana i wydana!"
44
+ end
45
+
46
+ desc "Zbuduj gem"
47
+ task :build_gem do
48
+ puts "Tworzenie gema..."
49
+ sh "gem build #{Dir.glob("*.gemspec").first}"
50
+ end
51
+
52
+ desc "Wygeneruj changelog z git log"
53
+ task :generate_changelog do
54
+ puts "Generowanie changelog..."
55
+ changelog_content = `git log --pretty=format:"- %h [%ad] %s (%an)" --date=short`
56
+ File.open("CHANGELOG.md", "a") do |file|
57
+ file.puts "\n## #{Time.now.strftime('%Y-%m-%d')}\n"
58
+ file.puts changelog_content
59
+ end
60
+ puts "Changelog został uaktualniony."
61
+ end
62
+
63
+ desc "Utwórz tag gita z odpowiednią wersją"
64
+ task :create_git_tag do
65
+ gemspec_filename = Dir.glob("*.gemspec").first
66
+ gemspec = Gem::Specification.load(gemspec_filename)
67
+ version = gemspec.version.to_s
68
+
69
+ sh "git tag -a v#{version} -m 'Release v#{version}'"
70
+ puts "Utworzono tag v#{version}."
71
+ end
72
+
73
+ desc "Wypchnij tag na zdalny repozytorium"
74
+ task :push_git_tag do
75
+ sh "git push origin --tags"
76
+ puts "Tagi zostały wypchnięte."
77
+ end
78
+
79
+ desc "Wypchnij gem na RubyGems"
80
+ task :push_gem do
81
+ gem_file = Dir.glob("*.gem").last
82
+ abort("Brak pliku gema!") unless gem_file
83
+
84
+ sh "gem push #{gem_file}"
85
+ puts "#{gem_file} został wypchnięty na RubyGems."
86
+ end
87
+
88
+ desc "Zwiększ wersję w pliku VERSION"
89
+ task :bump_version do
90
+ version_file = "VERSION"
91
+ abort("Brak pliku VERSION!") unless File.exist?(version_file)
92
+
93
+ current_version = File.read(version_file).strip
94
+ major, minor, patch = current_version.split(".").map(&:to_i)
95
+ new_version = "#{major}.#{minor}.#{patch + 1}"
96
+
97
+ # Zapisz nową wersję do pliku
98
+ File.open(version_file, "w") { |file| file.puts new_version }
99
+
100
+ puts "Wersja została podniesiona do: #{new_version}"
101
+
102
+ # Dodaj zmiany do gita
103
+ sh "git add #{version_file}"
104
+ sh "git commit -m 'Podniesiono wersję do #{new_version}'"
105
+ end
106
+
107
+ # Domyślne zadanie: uruchom testy
108
+ task default: :test
109
+
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Koziolekweb
5
+ module Deorphanter
6
+ VERSION = "0.1.0"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "deorphanter/version"
4
+
5
+ module Koziolekweb
6
+ module Deorphanter
7
+ def self.replace_single_letter_spaces(content)
8
+ return content unless content && content.is_a?(String)
9
+ content.gsub(/\b([a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ\-–])\b(?:\s|$)/, '\1 ')
10
+ end
11
+
12
+ def self.apply_hook_to(document)
13
+ document.content = replace_single_letter_spaces(document.content)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require_relative "jekyll/koziolekweb/deorphanter"
5
+
6
+ Jekyll::Hooks.register [:pages, :posts, :documents], :pre_render do |doc|
7
+ Koziolekweb::Deorphanter.apply_hook_to(doc)
8
+ end
@@ -0,0 +1,8 @@
1
+ module Jekyll
2
+ module Koziolekweb
3
+ module Deorphanter
4
+ VERSION: String
5
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-koziolekweb-deorphanter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Koziolek
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.7'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '3.7'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5.0'
32
+ description: Plugin that replaces spaces after single letter with &nbsp; that helps
33
+ to avoid living single letter at the end of a line.
34
+ email:
35
+ - bjkuczynski@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - lib/jekyll-deorphanter.rb
44
+ - lib/jekyll/koziolekweb/deorphanter.rb
45
+ - lib/jekyll/koziolekweb/deorphanter/version.rb
46
+ - sig/jekyll/koziolekweb/deorphanter.rbs
47
+ homepage: https://github.com/Koziolek/jekyll-koziolekweb-deorphanter
48
+ licenses:
49
+ - MIT
50
+ metadata:
51
+ source_code_uri: https://github.com/Koziolek/jekyll-koziolekweb-deorphanter
52
+ changelog_uri: https://github.com/Koziolek/jekyll-koziolekweb-deorphanter/CHANGELOG.md
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 3.1.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.6.9
68
+ specification_version: 4
69
+ summary: Plugin that replaces spaces after single letter with &nbsp;
70
+ test_files: []