text-hyphen 1.0.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.
- data/ChangeLog +4 -0
- data/Changelog +4 -0
- data/INSTALL +6 -0
- data/LICENCE +47 -0
- data/README +56 -0
- data/Rakefile +116 -0
- data/bin/hyphen +107 -0
- data/lib/text/hyphen.rb +289 -0
- data/lib/text/hyphen/language.rb +112 -0
- data/lib/text/hyphen/language/ca.rb +174 -0
- data/lib/text/hyphen/language/cs.rb +363 -0
- data/lib/text/hyphen/language/da.rb +118 -0
- data/lib/text/hyphen/language/de1.rb +723 -0
- data/lib/text/hyphen/language/de2.rb +685 -0
- data/lib/text/hyphen/language/en_uk.rb +791 -0
- data/lib/text/hyphen/language/en_us.rb +493 -0
- data/lib/text/hyphen/language/es.rb +289 -0
- data/lib/text/hyphen/language/et.rb +337 -0
- data/lib/text/hyphen/language/eu.rb +115 -0
- data/lib/text/hyphen/language/fi.rb +113 -0
- data/lib/text/hyphen/language/fr.rb +392 -0
- data/lib/text/hyphen/language/ga.rb +608 -0
- data/lib/text/hyphen/language/hr.rb +124 -0
- data/lib/text/hyphen/language/hsb.rb +180 -0
- data/lib/text/hyphen/language/hu1.rb +385 -0
- data/lib/text/hyphen/language/hu2.rb +1283 -0
- data/lib/text/hyphen/language/ia.rb +73 -0
- data/lib/text/hyphen/language/id.rb +97 -0
- data/lib/text/hyphen/language/is.rb +390 -0
- data/lib/text/hyphen/language/it.rb +135 -0
- data/lib/text/hyphen/language/la.rb +134 -0
- data/lib/text/hyphen/language/mn.rb +103 -0
- data/lib/text/hyphen/language/nl.rb +1253 -0
- data/lib/text/hyphen/language/no1.rb +303 -0
- data/lib/text/hyphen/language/no2.rb +138 -0
- data/lib/text/hyphen/language/pl.rb +480 -0
- data/lib/text/hyphen/language/pt.rb +56 -0
- data/lib/text/hyphen/language/sv.rb +449 -0
- data/tests/tc_text_hyphen.rb +62 -0
- metadata +90 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: tc_text_hyphen.rb,v 1.1 2004/12/20 07:27:24 austin Exp $
|
3
|
+
#++
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'text/hyphen'
|
9
|
+
|
10
|
+
class Test__Text__Hyphen < Test::Unit::TestCase
|
11
|
+
WORDS = %w(additional declination going leaving maximizes multiple peter
|
12
|
+
playback presents programmable representation)
|
13
|
+
POINTS = [
|
14
|
+
[2, 4, 8], # additional
|
15
|
+
[], # declination
|
16
|
+
[2], # going
|
17
|
+
[4], # leaving
|
18
|
+
[3, 4], # maximize
|
19
|
+
[3, 5], # multiple
|
20
|
+
[2], # peter
|
21
|
+
[4], # playback
|
22
|
+
[], # presents
|
23
|
+
[3, 7], # programmable -- 20041220 New hyphenation directives.
|
24
|
+
[3, 5, 8, 10] # representation
|
25
|
+
]
|
26
|
+
|
27
|
+
VISUAL = %w(ad-di-tion-al declination go-ing leav-ing max-i-mizes
|
28
|
+
mul-ti-ple pe-ter play-back presents pro-gram-mable
|
29
|
+
rep-re-sen-ta-tion)
|
30
|
+
|
31
|
+
HY_TO = [ %w(addi- tional), [nil, 'declination'], %w(go- ing),
|
32
|
+
%w(leav- ing), %w(maxi- mizes), %w(mul- tiple), %w(pe- ter),
|
33
|
+
%w(play- back), [nil, 'presents'], %w(pro- grammable),
|
34
|
+
%w(rep- resentation)]
|
35
|
+
|
36
|
+
def test_hyphenate
|
37
|
+
@r = []
|
38
|
+
a = Text::Hyphen.new do |xx|
|
39
|
+
xx.left = 0
|
40
|
+
xx.right = 0
|
41
|
+
end
|
42
|
+
assert_nothing_raised { WORDS.each { |w| @r << a.hyphenate(w) } }
|
43
|
+
assert_equal(POINTS, @r)
|
44
|
+
WORDS.each { |w| assert_not_nil(a.instance_eval { @cache[w] }) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_visualise
|
48
|
+
@r = []
|
49
|
+
a = Text::Hyphen.new(:left => 0, :right => 0)
|
50
|
+
assert_nothing_raised { WORDS.each { |w| @r << a.visualise(w) } }
|
51
|
+
assert_equal(VISUAL, @r)
|
52
|
+
WORDS.each { |w| assert_not_nil(a.instance_eval { @vcache[w] }) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_hyphenate_to
|
56
|
+
@r = []
|
57
|
+
a = Text::Hyphen.new(:left => 0, :right => 0)
|
58
|
+
assert_nothing_raised { WORDS.each { |w| @r << a.hyphenate_to(w, 5) } }
|
59
|
+
assert_equal(HY_TO, @r)
|
60
|
+
WORDS.each { |w| assert_not_nil(a.instance_eval { @cache[w] }) }
|
61
|
+
end
|
62
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.1
|
3
|
+
specification_version: 1
|
4
|
+
name: text-hyphen
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2004-12-20
|
8
|
+
summary: Multilingual word hyphenation according to modified TeX hyphenation pattern files.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
author: Austin Ziegler
|
12
|
+
email: text-hyphen@halostatue.ca
|
13
|
+
homepage: http://rubyforge.org/projects/text-format/
|
14
|
+
rubyforge_project: text-format
|
15
|
+
description: ''
|
16
|
+
autorequire: text/hyphen
|
17
|
+
default_executable:
|
18
|
+
bindir: bin
|
19
|
+
has_rdoc: true
|
20
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
+
requirements:
|
22
|
+
-
|
23
|
+
- ">"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 0.0.0
|
26
|
+
version:
|
27
|
+
platform: ruby
|
28
|
+
files:
|
29
|
+
- bin
|
30
|
+
- Changelog
|
31
|
+
- INSTALL
|
32
|
+
- lib
|
33
|
+
- LICENCE
|
34
|
+
- Rakefile
|
35
|
+
- README
|
36
|
+
- tests
|
37
|
+
- bin/hyphen
|
38
|
+
- lib/text
|
39
|
+
- lib/text/hyphen
|
40
|
+
- lib/text/hyphen.rb
|
41
|
+
- lib/text/hyphen/language
|
42
|
+
- lib/text/hyphen/language.rb
|
43
|
+
- lib/text/hyphen/language/ca.rb
|
44
|
+
- lib/text/hyphen/language/cs.rb
|
45
|
+
- lib/text/hyphen/language/da.rb
|
46
|
+
- lib/text/hyphen/language/de1.rb
|
47
|
+
- lib/text/hyphen/language/de2.rb
|
48
|
+
- lib/text/hyphen/language/en_uk.rb
|
49
|
+
- lib/text/hyphen/language/en_us.rb
|
50
|
+
- lib/text/hyphen/language/es.rb
|
51
|
+
- lib/text/hyphen/language/et.rb
|
52
|
+
- lib/text/hyphen/language/eu.rb
|
53
|
+
- lib/text/hyphen/language/fi.rb
|
54
|
+
- lib/text/hyphen/language/fr.rb
|
55
|
+
- lib/text/hyphen/language/ga.rb
|
56
|
+
- lib/text/hyphen/language/hr.rb
|
57
|
+
- lib/text/hyphen/language/hsb.rb
|
58
|
+
- lib/text/hyphen/language/hu1.rb
|
59
|
+
- lib/text/hyphen/language/hu2.rb
|
60
|
+
- lib/text/hyphen/language/ia.rb
|
61
|
+
- lib/text/hyphen/language/id.rb
|
62
|
+
- lib/text/hyphen/language/is.rb
|
63
|
+
- lib/text/hyphen/language/it.rb
|
64
|
+
- lib/text/hyphen/language/la.rb
|
65
|
+
- lib/text/hyphen/language/mn.rb
|
66
|
+
- lib/text/hyphen/language/nl.rb
|
67
|
+
- lib/text/hyphen/language/no1.rb
|
68
|
+
- lib/text/hyphen/language/no2.rb
|
69
|
+
- lib/text/hyphen/language/pl.rb
|
70
|
+
- lib/text/hyphen/language/pt.rb
|
71
|
+
- lib/text/hyphen/language/sv.rb
|
72
|
+
- tests/tc_text_hyphen.rb
|
73
|
+
- ChangeLog
|
74
|
+
test_files:
|
75
|
+
- tests/tc_text_hyphen.rb
|
76
|
+
rdoc_options:
|
77
|
+
- "--title"
|
78
|
+
- Text::Hyphen
|
79
|
+
- "--main"
|
80
|
+
- README
|
81
|
+
- "--line-numbers"
|
82
|
+
extra_rdoc_files:
|
83
|
+
- README
|
84
|
+
- LICENCE
|
85
|
+
- INSTALL
|
86
|
+
- ChangeLog
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
requirements: []
|
90
|
+
dependencies: []
|