lofis 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ README.markdown
2
+ lofis.yml
3
+ lib/**/*.rb
@@ -0,0 +1,28 @@
1
+ Lofis
2
+ =====
3
+ Lofis is a small helper to fix lexicographical order for international sorting.
4
+
5
+ Syntax
6
+ ------
7
+ umlaut:
8
+ replacement_string:
9
+ - string_to_replace
10
+
11
+ Example
12
+ -------
13
+
14
+ Store and Generate
15
+ ------------------
16
+ The replacement files are stored in the directory "source". There is one YML file per language.
17
+ The language files are generated to the lofis.yml with the command "rake".
18
+
19
+ Bugs
20
+ ----
21
+ Report bugs at http://github.com/wingfire/lofis/issues
22
+
23
+
24
+ License
25
+ -------
26
+ Creative Commons Attribution 3.0 License
27
+
28
+ http://creativecommons.org/licenses/by/3.0/
@@ -0,0 +1,59 @@
1
+ require 'yaml'
2
+ require 'pathname'
3
+ require 'yaml_waml'
4
+ $KCODE = 'UTF8'
5
+ root = Pathname.new(__FILE__).dirname
6
+
7
+ load root.join('Rakefile.jeweler')
8
+
9
+ task :default => :compile
10
+
11
+ desc 'compile multiple lofis files into one'
12
+ task :compile, :files do |t, args|
13
+ files = if args.files
14
+ Dir[args.files]
15
+ else
16
+ Dir[root.join('source', '*.yml').to_s]
17
+ end.map { |p| Pathname.new(p) }
18
+
19
+ result = Hash.new { |h,k| h[k] = [] }
20
+
21
+ files.each do |file|
22
+ print "including #{file}"
23
+
24
+ data = YAML.load_file(file.to_s)
25
+
26
+ if !data || !data.is_a?(Hash) || !data['umlaut']
27
+ puts ' - no lofis data found'
28
+ next
29
+ end
30
+
31
+ data['umlaut'].each do |k,v|
32
+ result[k].concat(v)
33
+ end
34
+
35
+ puts
36
+
37
+ end
38
+
39
+ result.each do |k,v|
40
+ result[k] = v.uniq
41
+ end
42
+
43
+ puts "writing lofis.yml"
44
+ root.join('lofis.yml').open('w') do |f|
45
+ f.puts "# Lofis version #{File.read('VERSION')} "
46
+ f.puts "# compiled at #{Time.now.utc}"
47
+ f.puts "# "
48
+ f.puts "# included files:"
49
+
50
+ files.each do |file|
51
+ f.puts "# #{file.relative_path_from(root)}"
52
+ end
53
+
54
+ f.puts
55
+
56
+ { 'umlaut' => result }.to_yaml(f)
57
+ end
58
+
59
+ end
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "lofis"
8
+ gem.summary = %Q{Lexicographical order for international sorting}
9
+ gem.description = %Q{Lofis is a small helper to fix lexicographical order for international sorting.}
10
+ gem.email = "moritz.heidkamp@bevuta.com"
11
+ gem.homepage = "http://github.com/wingfire/lofis"
12
+ gem.authors = ["Christof Spies", "Moritz Heidkamp"]
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ gem.add_development_dependency :yaml_waml
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
@@ -0,0 +1,27 @@
1
+ require 'yaml'
2
+
3
+ module Lofis
4
+
5
+ class Error < StandardError
6
+ end
7
+
8
+ def self.mapping
9
+ @mapping ||= load_file(File.join(File.dirname(__FILE__), '..', 'lofis.yml'))
10
+ @mapping || raise(Error, 'no lofis file loaded')
11
+ end
12
+
13
+ def self.load_file(file)
14
+ @mapping = YAML.load_file(file)['umlaut'].map { |r,s| [Regexp.new(s.map { |c| Regexp.escape(c) }.join('|')), r] }
15
+ end
16
+
17
+ def self.to_sortable(s)
18
+ mapping.inject(s) do |g,(s,r)|
19
+ g.gsub(s, r)
20
+ end
21
+ end
22
+
23
+ def to_sortable
24
+ @_lofis_sortable ||= Lofis.to_sortable(self)
25
+ end
26
+
27
+ end
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{lofis}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Christof Spies", "Moritz Heidkamp"]
12
+ s.date = %q{2010-11-18}
13
+ s.description = %q{Lofis is a small helper to fix lexicographical order for international sorting.}
14
+ s.email = %q{moritz.heidkamp@bevuta.com}
15
+ s.extra_rdoc_files = [
16
+ "README.markdown"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ "README.markdown",
21
+ "Rakefile",
22
+ "Rakefile.jeweler",
23
+ "VERSION",
24
+ "lib/lofis.rb",
25
+ "lofis.gemspec",
26
+ "lofis.yml",
27
+ "source/czech_slovak_slovenian.yml",
28
+ "source/french.yml",
29
+ "source/german.yml",
30
+ "source/greek.yml",
31
+ "source/hawaiian.yml",
32
+ "source/italian.yml",
33
+ "source/polish.yml",
34
+ "source/romanian.yml",
35
+ "source/russian.yml",
36
+ "source/spanish.yml",
37
+ "source/turkish.yml"
38
+ ]
39
+ s.homepage = %q{http://github.com/wingfire/lofis}
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.7}
42
+ s.summary = %q{Lexicographical order for international sorting}
43
+
44
+ if s.respond_to? :specification_version then
45
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_development_dependency(%q<yaml_waml>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<yaml_waml>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<yaml_waml>, [">= 0"])
55
+ end
56
+ end
57
+
@@ -0,0 +1,166 @@
1
+ # Lofis version 0.0.1
2
+ # compiled at Thu Nov 18 11:56:22 UTC 2010
3
+ #
4
+ # included files:
5
+ # source/hawaiian.yml
6
+ # source/polish.yml
7
+ # source/russian.yml
8
+ # source/german.yml
9
+ # source/czech_slovak_slovenian.yml
10
+ # source/spanish.yml
11
+ # source/greek.yml
12
+ # source/turkish.yml
13
+ # source/french.yml
14
+ # source/romanian.yml
15
+ # source/italian.yml
16
+
17
+ ---
18
+ umlaut:
19
+ ss:
20
+ - "ß"
21
+ "":
22
+ - "«"
23
+ - "»"
24
+ - "„"
25
+ - "“"
26
+ - "”"
27
+ - "¿"
28
+ - "¡"
29
+ L:
30
+ - "Ł"
31
+ - "Ĺ"
32
+ l:
33
+ - "ł"
34
+ - "ĺ"
35
+ A:
36
+ - "Ä"
37
+ - "Ą"
38
+ - "Á"
39
+ - "À"
40
+ - "Â"
41
+ - "Æ"
42
+ - "Ă"
43
+ a:
44
+ - "ä"
45
+ - "ą"
46
+ - "á"
47
+ - "à"
48
+ - "â"
49
+ - "æ"
50
+ - "ă"
51
+ Y:
52
+ - "Ý"
53
+ C:
54
+ - "Ć"
55
+ - "Č"
56
+ - "Ç"
57
+ N:
58
+ - "Ń"
59
+ - "Ň"
60
+ - "Ñ"
61
+ c:
62
+ - "ć"
63
+ - "č"
64
+ - "ç"
65
+ n:
66
+ - "ń"
67
+ - "ň"
68
+ - "ñ"
69
+ y:
70
+ - "ʻ"
71
+ - "ý"
72
+ d:
73
+ - "ď"
74
+ Z:
75
+ - "Ź"
76
+ - "Ż"
77
+ - "Ž"
78
+ z:
79
+ - "ź"
80
+ - "ż"
81
+ - "ž"
82
+ O:
83
+ - "Ō"
84
+ - "Ó"
85
+ - "Ö"
86
+ - "Ô"
87
+ - "Œ"
88
+ - "Ò"
89
+ o:
90
+ - "ō"
91
+ - "ó"
92
+ - "ö"
93
+ - "ô"
94
+ - "œ"
95
+ - "ò"
96
+ E:
97
+ - "Ē"
98
+ - "Ę"
99
+ - "É"
100
+ - "Ě"
101
+ - "È"
102
+ - "Ê"
103
+ - "Ë"
104
+ e:
105
+ - "ē"
106
+ - "ę"
107
+ - "é"
108
+ - "ě"
109
+ - "è"
110
+ - "ê"
111
+ - "ë"
112
+ G:
113
+ - "Ğ"
114
+ g:
115
+ - "ğ"
116
+ R:
117
+ - "Ŕ"
118
+ - "Ř"
119
+ r:
120
+ - "ŕ"
121
+ - "ř"
122
+ S:
123
+ - "Ś"
124
+ - "Š"
125
+ - "Ş"
126
+ - "Ș"
127
+ s:
128
+ - "ś"
129
+ - "š"
130
+ - "ş"
131
+ - "ș"
132
+ T:
133
+ - "Ț"
134
+ - "Ţ"
135
+ t:
136
+ - "ť"
137
+ - "ț"
138
+ - "ţ"
139
+ I:
140
+ - "Ī"
141
+ - "Í"
142
+ - "İ"
143
+ - "Î"
144
+ - "Ï"
145
+ - "Ì"
146
+ i:
147
+ - "ī"
148
+ - "í"
149
+ - "ı"
150
+ - "î"
151
+ - "ï"
152
+ - "ì"
153
+ U:
154
+ - "Ū"
155
+ - "Ü"
156
+ - "Ú"
157
+ - "Ů"
158
+ - "Ù"
159
+ - "Û"
160
+ u:
161
+ - "ū"
162
+ - "ü"
163
+ - "ú"
164
+ - "ů"
165
+ - "ù"
166
+ - "û"
@@ -0,0 +1,74 @@
1
+ # lofis
2
+ # czech, slovak and slovenian
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-cz.htm
4
+
5
+ # Á Ą Ä É Ę Ě Í Ó Ô Ú Ů Ý Č Ĺ Ň Ŕ Ř Š Ž
6
+ # á ą ä é ę ě í ó ô ú ů ý č ď ť ĺ ň ŕ ř š ž
7
+
8
+ umlaut:
9
+ A:
10
+ - Á
11
+ - Ą
12
+ - Ä
13
+ C:
14
+ - Č
15
+ E:
16
+ - É
17
+ - Ę
18
+ - Ě
19
+ I:
20
+ - Í
21
+ L:
22
+ - Ĺ
23
+ N:
24
+ - Ň
25
+ O:
26
+ - Ó
27
+ - Ô
28
+ R:
29
+ - Ŕ
30
+ - Ř
31
+ S:
32
+ - Š
33
+ U:
34
+ - Ú
35
+ - Ů
36
+ Y:
37
+ - Ý
38
+ Z:
39
+ - Ž
40
+ a:
41
+ - á
42
+ - ą
43
+ - ä
44
+ c:
45
+ - č
46
+ d:
47
+ - ď
48
+ e:
49
+ - é
50
+ - ę
51
+ - ě
52
+ i:
53
+ - í
54
+ l:
55
+ - ĺ
56
+ n:
57
+ - ň
58
+ o:
59
+ - ó
60
+ - ô
61
+ r:
62
+ - ŕ
63
+ - ř
64
+ s:
65
+ - š
66
+ t:
67
+ - ť
68
+ u:
69
+ - ú
70
+ - ů
71
+ y:
72
+ - ý
73
+ z:
74
+ - ž
@@ -0,0 +1,54 @@
1
+ # lofis
2
+ # french
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-fr.htm
4
+
5
+ # À Â Æ Ç È É Ê Ë Î Ï Ô Œ Ù Û Ü
6
+ # à â æ ç è é ê ë î ï ô œ ù û ü
7
+ # « »
8
+
9
+ umlaut:
10
+ A:
11
+ - À
12
+ - Â
13
+ - Æ
14
+ C:
15
+ - Ç
16
+ E:
17
+ - È
18
+ - É
19
+ - Ê
20
+ - Ë
21
+ I:
22
+ - Î
23
+ - Ï
24
+ O:
25
+ - Ô
26
+ - Œ
27
+ U:
28
+ - Ù
29
+ - Û
30
+ - Ü
31
+ a:
32
+ - à
33
+ - â
34
+ - æ
35
+ c:
36
+ - ç
37
+ e:
38
+ - è
39
+ - é
40
+ - ê
41
+ - ë
42
+ i:
43
+ - î
44
+ - ï
45
+ o:
46
+ - ô
47
+ - œ
48
+ u:
49
+ - ù
50
+ - û
51
+ - ü
52
+ '':
53
+ - «
54
+ - »
@@ -0,0 +1,34 @@
1
+ # lofis
2
+ # german
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-de.htm
4
+
5
+ # Ä É Ö Ü
6
+ # ä é ö ü ß
7
+ # « » „ “ ”
8
+ # °
9
+
10
+ umlaut:
11
+ A:
12
+ - Ä
13
+ E:
14
+ - É
15
+ O:
16
+ - Ö
17
+ U:
18
+ - Ü
19
+ a:
20
+ - ä
21
+ e:
22
+ - é
23
+ o:
24
+ - ö
25
+ ss:
26
+ - ß
27
+ u:
28
+ - ü
29
+ '':
30
+ - «
31
+ - »
32
+ - „
33
+ - “
34
+ - ”
@@ -0,0 +1,10 @@
1
+ # lofis
2
+ # greek
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-gr.htm
4
+
5
+ # Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω
6
+ # α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω
7
+
8
+ # TODO
9
+
10
+ umlaut:
@@ -0,0 +1,30 @@
1
+ # lofis
2
+ # hawaiian
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-hi.htm
4
+
5
+ # Ä Ē Ī Ō Ū
6
+ # ä ē ī ō ū ʻ
7
+
8
+ umlaut:
9
+ A:
10
+ - Ä
11
+ E:
12
+ - Ē
13
+ I:
14
+ - Ī
15
+ O:
16
+ - Ō
17
+ U:
18
+ - Ū
19
+ a:
20
+ - ä
21
+ e:
22
+ - ē
23
+ i:
24
+ - ī
25
+ o:
26
+ - ō
27
+ u:
28
+ - ū
29
+ y:
30
+ - ʻ
@@ -0,0 +1,42 @@
1
+ # lofis
2
+ # italian
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-it.htm
4
+
5
+ # À Á È É Ì Í Ò Ó Ù Ú
6
+ # à á è é ì í ò ó ù ú
7
+ # « »
8
+
9
+ umlaut:
10
+ A:
11
+ - À
12
+ - Á
13
+ E:
14
+ - È
15
+ - É
16
+ I:
17
+ - Ì
18
+ - Í
19
+ O:
20
+ - Ò
21
+ - Ó
22
+ U:
23
+ - Ù
24
+ - Ú
25
+ a:
26
+ - à
27
+ - á
28
+ e:
29
+ - è
30
+ - é
31
+ i:
32
+ - ì
33
+ - í
34
+ o:
35
+ - ò
36
+ - ó
37
+ u:
38
+ - ù
39
+ - ú
40
+ '':
41
+ - «
42
+ - »
@@ -0,0 +1,42 @@
1
+ # lofis
2
+ # polish
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-pl.htm
4
+
5
+ # Ą Ę Ó Ć Ł Ń Ś Ź Ż
6
+ # ą ę ó ć ł ń ś ź ż
7
+
8
+ umlaut:
9
+ A:
10
+ - Ą
11
+ C:
12
+ - Ć
13
+ E:
14
+ - Ę
15
+ L:
16
+ - Ł
17
+ N:
18
+ - Ń
19
+ O:
20
+ - Ó
21
+ S:
22
+ - Ś
23
+ Z:
24
+ - Ź
25
+ - Ż
26
+ a:
27
+ - ą
28
+ c:
29
+ - ć
30
+ e:
31
+ - ę
32
+ l:
33
+ - ł
34
+ n:
35
+ - ń
36
+ o:
37
+ - ó
38
+ s:
39
+ - ś
40
+ z:
41
+ - ź
42
+ - ż
@@ -0,0 +1,30 @@
1
+ # lofis
2
+ # romanian
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-ro.htm
4
+
5
+ # Ă Â Î Ș Ş Ț Ţ
6
+ # ă â î ș ş ț ţ
7
+
8
+ umlaut:
9
+ A:
10
+ - Ă
11
+ - Â
12
+ I:
13
+ - Î
14
+ S:
15
+ - Ș
16
+ - Ş
17
+ T:
18
+ - Ț
19
+ - Ţ
20
+ a:
21
+ - ă
22
+ - â
23
+ i:
24
+ - î
25
+ s:
26
+ - ș
27
+ - ş
28
+ t:
29
+ - ț
30
+ - ţ
@@ -0,0 +1,10 @@
1
+ # lofis
2
+ # russian
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-ru.htm
4
+
5
+ # А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я
6
+ # а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я
7
+
8
+ # TODO
9
+
10
+ umlaut:
@@ -0,0 +1,41 @@
1
+ # lofis
2
+ # spanish
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-sp.htm
4
+
5
+ # Á É Í Ñ Ó Ú Ü
6
+ # á é í ñ ó ú ü
7
+ # « » ¿ ¡
8
+
9
+ umlaut:
10
+ A:
11
+ - Á
12
+ E:
13
+ - É
14
+ I:
15
+ - Í
16
+ N:
17
+ - Ñ
18
+ O:
19
+ - Ó
20
+ U:
21
+ - Ú
22
+ - Ü
23
+ a:
24
+ - á
25
+ e:
26
+ - é
27
+ i:
28
+ - í
29
+ n:
30
+ - ñ
31
+ o:
32
+ - ó
33
+ u:
34
+ - ú
35
+ - ü
36
+ '':
37
+ - «
38
+ - »
39
+ - ¿
40
+ - ¡
41
+
@@ -0,0 +1,36 @@
1
+ # lofis
2
+ # turkish
3
+ # http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm
4
+
5
+ # İ Ö Ü Ç Ğ Ş
6
+ # ı ö ü ç ğ ş
7
+
8
+ umlaut:
9
+ C:
10
+ - Ç
11
+ G:
12
+ - Ğ
13
+ I:
14
+ - İ
15
+ N:
16
+ - Ñ
17
+ O:
18
+ - Ö
19
+ S:
20
+ - Ş
21
+ U:
22
+ - Ü
23
+ c:
24
+ - ç
25
+ g:
26
+ - ğ
27
+ i:
28
+ - ı
29
+ n:
30
+ - ñ
31
+ o:
32
+ - ö
33
+ s:
34
+ - ş
35
+ u:
36
+ - ü
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lofis
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Christof Spies
14
+ - Moritz Heidkamp
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-11-18 00:00:00 +01:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: yaml_waml
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :development
35
+ version_requirements: *id001
36
+ description: Lofis is a small helper to fix lexicographical order for international sorting.
37
+ email: moritz.heidkamp@bevuta.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - README.markdown
44
+ files:
45
+ - .document
46
+ - README.markdown
47
+ - Rakefile
48
+ - Rakefile.jeweler
49
+ - VERSION
50
+ - lib/lofis.rb
51
+ - lofis.gemspec
52
+ - lofis.yml
53
+ - source/czech_slovak_slovenian.yml
54
+ - source/french.yml
55
+ - source/german.yml
56
+ - source/greek.yml
57
+ - source/hawaiian.yml
58
+ - source/italian.yml
59
+ - source/polish.yml
60
+ - source/romanian.yml
61
+ - source/russian.yml
62
+ - source/spanish.yml
63
+ - source/turkish.yml
64
+ has_rdoc: true
65
+ homepage: http://github.com/wingfire/lofis
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.3.7
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Lexicographical order for international sorting
98
+ test_files: []
99
+