xilo 0.0.1

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.
Files changed (2) hide show
  1. data/xilo.rb +88 -0
  2. metadata +49 -0
data/xilo.rb ADDED
@@ -0,0 +1,88 @@
1
+ =begin
2
+
3
+ Tiu ĉi modjulo strebas disponigi al vi bonan konvertilon
4
+ por surogataj skrib-metodoj.
5
+
6
+ Unua celo estis konverti Esperantan x-skribaĵn al belaj ĉapelitaj literoj.
7
+
8
+ =end
9
+
10
+ module Xilo
11
+
12
+ # Tabelo de konvertindaj x-kribaĵoj por Esperanto
13
+ XKONVERTU = [
14
+ ['Cx', 'Ĉ'], ['CX', 'Ĉ'], ['cx', 'ĉ'],
15
+ ['Gx', 'Ĝ'], ['GX', 'Ĝ'], ['gx', 'ĝ'],
16
+ ['Jx', 'Ĵ'], ['JX', 'Ĵ'], ['jx', 'ĵ'],
17
+ ['Ux', 'Ŭ'], ['UX', 'Ŭ'], ['ux', 'ŭ'],
18
+ ['Sx', 'Ŝ'], ['SX', 'Ŝ'], ['sx', 'ŝ'],
19
+ ]
20
+
21
+ # Tabelo de konvertindaj h-kribaĵoj por Esperanto
22
+ HKONVERTU = [
23
+ ['Ch', 'Ĉ'], ['CH', 'Ĉ'], ['ch', 'ĉ'],
24
+ ['Gh', 'Ĝ'], ['GH', 'Ĝ'], ['gh', 'ĝ'],
25
+ ['Jh', 'Ĵ'], ['JH', 'Ĵ'], ['jh', 'ĵ'],
26
+ ['Uh', 'Ŭ'], ['UH', 'Ŭ'], ['uh', 'ŭ'],
27
+ ['Sh', 'Ŝ'], ['SH', 'Ŝ'], ['sh', 'ŝ'],
28
+ ]
29
+
30
+
31
+ # eo: Metodo konvertas x-skribon de ĉeno al ĉapelitaj literoj.
32
+ # ru: Метод конвертирует суррогатные написания.
33
+ # en: Method converts surrogates contained in string
34
+ #
35
+ # == eo:Uzo ru:Использование en:Usage
36
+ #
37
+ # require 'xilo'
38
+ # cheno = Xilo.konvertu "Cxu vi jxus sxangxis, cxapeligis cxenon? Vaux!"
39
+ # # -> "Ĉu vi ĵus ŝanĝis, ĉapeligis ĉenon? Vaŭ!"
40
+ #
41
+ # "Cxu vi jxus sxangxis, cxapeligis cxenon? Vaux!".xkonvertu
42
+ # # -> "Ĉu vi ĵus ŝanĝis, ĉapeligis ĉenon? Vaŭ!"
43
+ #
44
+ #
45
+ # # Uzu Xilo-n en via propra klaso
46
+ # #
47
+ # require 'xilo'
48
+ #
49
+ # class Konvertilo
50
+ # include Xilo
51
+ # def xigu(chenon)
52
+ # konvertu chenon
53
+ # end
54
+ # end
55
+ #
56
+ # k = Konvertilo.new
57
+ # k.xigu "Cxu vi jxus sxangxis, cxapeligis cxenon? Vaux!"
58
+ # # -> "Ĉu vi ĵus ŝanĝis, ĉapeligis ĉenon? Vaŭ!"
59
+ #
60
+ def konvertu(chenon, mapo = XKONVERTU)
61
+ mapo.chiu do |el,al|
62
+ chenon.gsub! Regexp.compile(el), al
63
+ end
64
+ return chenon
65
+ end
66
+
67
+ module_function :konvertu
68
+
69
+ end
70
+
71
+ class Array
72
+ # Esperantigo de .each
73
+ # Kreis ĝin por plibeligi kodon :)
74
+ #
75
+ alias chiu each
76
+ end
77
+
78
+ class String
79
+ # Konvertas ĉiuj surogatojn de ĉeno al belajn ĉapelitajn literojn.
80
+ #
81
+ # == Uzo:
82
+ # require 'xilo'
83
+ # cheno.xkonvertu
84
+ #
85
+ def xkonvertu
86
+ Xilo.konvertu(self)
87
+ end
88
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: xilo
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2007-01-27 00:00:00 +02:00
8
+ summary: "Converts surrogate letters to Unicode equivalents. (Example for Esperanto: 'Cx' -> '\xC4\x88')"
9
+ require_paths:
10
+ - .
11
+ email: antono.vasiljev@gmail.com
12
+ homepage: http://xilo.rubyforge.org
13
+ rubyforge_project: xilo
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Antono Vasiljev
31
+ files:
32
+ - xilo.rb
33
+ test_files: []
34
+
35
+ rdoc_options:
36
+ - --main=xilo.rb
37
+ - --line-numbers
38
+ - --charset=utf-8
39
+ - --promiscuous
40
+ extra_rdoc_files: []
41
+
42
+ executables: []
43
+
44
+ extensions: []
45
+
46
+ requirements: []
47
+
48
+ dependencies: []
49
+