aboutsummaryrefslogtreecommitdiffstats
path: root/enc/unicode/case-folding.rb
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 12:08:30 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 12:08:30 +0000
commit2f455ceca40dcddb0f92c2918796673187cd8ed4 (patch)
tree6e31d87870fbcc51b37b3fab3d9d20aed504ea74 /enc/unicode/case-folding.rb
parentbf99f859419437c9f5826ada08cd7cdca03c7d7f (diff)
downloadruby-2f455ceca40dcddb0f92c2918796673187cd8ed4.tar.gz
* include/ruby/oniguruma.h: Additional flag for characters that are titlecase.
* enc/unicode/case-folding.rb, casefold.h: Using above flag in data. * enc/unicode.c: Marking capitalized character as unmodified if it is already titlecase. * test/ruby/enc/test_case_mapping.rb: Tests for above functionality. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode/case-folding.rb')
-rwxr-xr-xenc/unicode/case-folding.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb
index d309dd6d15..00258cde6a 100755
--- a/enc/unicode/case-folding.rb
+++ b/enc/unicode/case-folding.rb
@@ -190,7 +190,7 @@ class CaseFolding
end
class MapItem
- attr_accessor :upper, :lower, :title
+ attr_accessor :upper, :lower, :title, :code
def initialize(code, upper, lower, title)
@code = code
@@ -242,15 +242,19 @@ class CaseMapping
specials = []
unless item.upper == item.title
specials << item.title
- flags += "|ST"
+ flags += '|ST'
+ if item.code == item.title
+ flags += '|IT'
+ end
+
end
unless item.lower.nil? or item.lower==from or item.lower==to
specials << item.lower
- flags += "|SL"
+ flags += '|SL'
end
unless item.upper.nil? or item.upper==from or item.upper==to
specials << item.upper
- flags += "|SU"
+ flags += '|SU'
end
if specials.first
flags += "|I(#{@specials_length})"