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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/apacify/token.rb +20 -1
- data/lib/apacify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1388346971f57a63a007b6e32798716f99dd1b5d2dcc1153624a495d7a6a0146
|
4
|
+
data.tar.gz: c58d4589773808ecb7d2af6c44322465ba1bab43f0704e9dbdbe6cb2e7fe6fa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aea431081a8ce3ede8f03eb78b7d564f2f86f07cb86e4f695a1b1c14bc1bc44a1efbf91d00105a914dab5e7d31a3b9f0b91b0df5c0805a1978a9546821bcdd45
|
7
|
+
data.tar.gz: 3d4b59393c0b60b30ad0d308724fe8769cbfdfb39d3cb8c675ce3004b32419c71099f2891f69f89f2fb9d2b035ab9c41e142e9a090d8d16f31f36552add8dc0a
|
data/CHANGELOG.md
CHANGED
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)/)
|
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
|
data/lib/apacify/version.rb
CHANGED