apacify 0.2.0 → 0.3.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: 0ff691ed803af1a67b7223e0f6c056a00852b57b9ab6030a9fb5fac548bd1a07
4
- data.tar.gz: e6522ee720d3fe658f2b80b45042c8f44e97651cafde412cf7ad9cf1f58a5c5c
3
+ metadata.gz: 1388346971f57a63a007b6e32798716f99dd1b5d2dcc1153624a495d7a6a0146
4
+ data.tar.gz: c58d4589773808ecb7d2af6c44322465ba1bab43f0704e9dbdbe6cb2e7fe6fa4
5
5
  SHA512:
6
- metadata.gz: f485f2c6d7d2a416815b695ff76e264e572c6fc6fc0c2f0c3e8b0957d949869bd01b0365e03a3e34a19aa539d102bc6c9bd791beb68fb094eeb3b4d6ed4ef873
7
- data.tar.gz: '0228bcd7a24f7d27cd84c1108c63897070d132a3d09e2312d0d974ed18602cb3674f0b8e12c5699c02fa5f548e984c248cb84cfbd67c7e7ec7feb1eddf1c1681'
6
+ metadata.gz: aea431081a8ce3ede8f03eb78b7d564f2f86f07cb86e4f695a1b1c14bc1bc44a1efbf91d00105a914dab5e7d31a3b9f0b91b0df5c0805a1978a9546821bcdd45
7
+ data.tar.gz: 3d4b59393c0b60b30ad0d308724fe8769cbfdfb39d3cb8c675ce3004b32419c71099f2891f69f89f2fb9d2b035ab9c41e142e9a090d8d16f31f36552add8dc0a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.3.0] - 2025-08-30
2
+
3
+ - Support Roman numerals
4
+
1
5
  ## [0.2.0] - 2025-08-30
2
6
 
3
7
  - Add ability to specify words to ignore during title case conversion
data/lib/apacify/token.rb CHANGED
@@ -14,7 +14,15 @@ module Apacify
14
14
  end
15
15
 
16
16
  def capitalize_word_parts
17
- string.downcase.gsub(/(^|-)(\w)/) { |match| $1 + $2.upcase }
17
+ string.downcase.gsub(/(^|-)(\w+)/) do |match|
18
+ prefix = $1
19
+ word = $2
20
+ if roman_numeral?(word)
21
+ prefix + word.upcase
22
+ else
23
+ prefix + word.capitalize
24
+ end
25
+ end
18
26
  end
19
27
 
20
28
  def first?
@@ -48,5 +56,16 @@ module Apacify
48
56
  def whitespace_or_punctuation?
49
57
  string.match?(/\s+|[.!?:—()]+\s*/)
50
58
  end
59
+
60
+ private
61
+
62
+ def roman_numeral?(word)
63
+ # Only letters used in roman numerals
64
+ return false unless word.match?(/\A[ivxlcdm]+\z/)
65
+
66
+ # Roman numeral pattern - matches valid combinations
67
+ # This pattern handles: 1-3999 (I-MMMCMXCIX)
68
+ word.match?(/\A(?=[mdclxvi])m{0,4}(cm|cd|d?c{0,3})?(xc|xl|l?x{0,3})?(ix|iv|v?i{0,3})?\z/)
69
+ end
51
70
  end
52
71
  end
@@ -1,3 +1,3 @@
1
1
  module Apacify
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apacify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Rzezak