agate 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/agate.gemspec +2 -2
- data/lib/agate/formatter/html.rb +1 -1
- data/lib/agate/parser.rb +4 -9
- data/lib/agate/version.rb +1 -1
- metadata +76 -41
- checksums.yaml +0 -7
data/.gitignore
CHANGED
data/README.md
CHANGED
data/agate.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Agate::VERSION
|
9
9
|
spec.authors = ["Jesse B. Hannah"]
|
10
10
|
spec.email = ["jesse@jbhannah.net"]
|
11
|
-
spec.description = %q{Wrap ruby characters (
|
12
|
-
spec.summary = %q{Wrap ruby characters (
|
11
|
+
spec.description = %q{Wrap ruby characters (currently only furigana) in text with the HTML5 ruby element.}
|
12
|
+
spec.summary = %q{Wrap ruby characters (currently only furigana) in text with the HTML5 ruby element.}
|
13
13
|
spec.homepage = "https://github.com/jbhannah/agate"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/lib/agate/formatter/html.rb
CHANGED
data/lib/agate/parser.rb
CHANGED
@@ -7,9 +7,6 @@ module Agate
|
|
7
7
|
:formatter => :html
|
8
8
|
}
|
9
9
|
|
10
|
-
# Regexp reserved characters to escape when matching
|
11
|
-
RESERVED = ["(", ")", "[", "]", "{", "}", ".", ",", "+", "*"]
|
12
|
-
|
13
10
|
def initialize(options = {})
|
14
11
|
@options = DEFAULTS.merge(options)
|
15
12
|
|
@@ -23,13 +20,11 @@ module Agate
|
|
23
20
|
|
24
21
|
# Parse `text` and return it with ruby character markup
|
25
22
|
def parse(text)
|
26
|
-
first = @options[:delimiters][0]
|
27
|
-
last = @options[:delimiters][-1]
|
28
|
-
|
29
|
-
first = /#{'\\' + first}/ if RESERVED.include? first
|
30
|
-
last = /#{'\\' + last}/ if RESERVED.include? last
|
23
|
+
first = Regexp.escape(@options[:delimiters][0])
|
24
|
+
last = Regexp.escape(@options[:delimiters][-1])
|
31
25
|
|
32
|
-
|
26
|
+
expr = /(\p{Han}+)(#{first})([\p{Hiragana}\p{Katakana}]+)(#{last})/u
|
27
|
+
text.gsub(expr) { |match| @formatter.format($~) }
|
33
28
|
end
|
34
29
|
end
|
35
30
|
end
|
data/lib/agate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.4
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jesse B. Hannah
|
@@ -11,111 +12,145 @@ cert_chain: []
|
|
11
12
|
date: 2013-03-05 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
prerelease: false
|
16
|
+
type: :development
|
14
17
|
name: bundler
|
15
18
|
requirement: !ruby/object:Gem::Requirement
|
16
19
|
requirements:
|
17
20
|
- - ~>
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: '1.2'
|
20
|
-
|
21
|
-
prerelease: false
|
23
|
+
none: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
26
|
- - ~>
|
25
27
|
- !ruby/object:Gem::Version
|
26
28
|
version: '1.2'
|
29
|
+
none: false
|
27
30
|
- !ruby/object:Gem::Dependency
|
31
|
+
prerelease: false
|
32
|
+
type: :development
|
28
33
|
name: rake
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- - '>='
|
36
|
+
- - ! '>='
|
32
37
|
- !ruby/object:Gem::Version
|
33
38
|
version: '0'
|
34
|
-
|
35
|
-
prerelease: false
|
39
|
+
none: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
37
41
|
requirements:
|
38
|
-
- - '>='
|
42
|
+
- - ! '>='
|
39
43
|
- !ruby/object:Gem::Version
|
40
44
|
version: '0'
|
45
|
+
none: false
|
41
46
|
- !ruby/object:Gem::Dependency
|
47
|
+
prerelease: false
|
48
|
+
type: :development
|
42
49
|
name: rspec
|
43
50
|
requirement: !ruby/object:Gem::Requirement
|
44
51
|
requirements:
|
45
52
|
- - ~>
|
46
53
|
- !ruby/object:Gem::Version
|
47
54
|
version: 2.13.0
|
48
|
-
|
49
|
-
prerelease: false
|
55
|
+
none: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - ~>
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: 2.13.0
|
61
|
+
none: false
|
55
62
|
- !ruby/object:Gem::Dependency
|
63
|
+
prerelease: false
|
64
|
+
type: :development
|
56
65
|
name: coveralls
|
57
66
|
requirement: !ruby/object:Gem::Requirement
|
58
67
|
requirements:
|
59
|
-
- - '>='
|
68
|
+
- - ! '>='
|
60
69
|
- !ruby/object:Gem::Version
|
61
70
|
version: '0'
|
62
|
-
|
63
|
-
prerelease: false
|
71
|
+
none: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
65
73
|
requirements:
|
66
|
-
- - '>='
|
74
|
+
- - ! '>='
|
67
75
|
- !ruby/object:Gem::Version
|
68
76
|
version: '0'
|
69
|
-
|
70
|
-
|
77
|
+
none: false
|
78
|
+
description: Wrap ruby characters (currently only furigana) in text with the HTML5
|
79
|
+
ruby element.
|
71
80
|
email:
|
72
81
|
- jesse@jbhannah.net
|
73
82
|
executables:
|
74
|
-
-
|
83
|
+
- !binary |-
|
84
|
+
YWdhdGU=
|
75
85
|
extensions: []
|
76
86
|
extra_rdoc_files: []
|
77
87
|
files:
|
78
|
-
-
|
79
|
-
|
80
|
-
-
|
81
|
-
|
82
|
-
-
|
83
|
-
|
84
|
-
-
|
85
|
-
|
86
|
-
-
|
87
|
-
|
88
|
-
-
|
89
|
-
|
90
|
-
-
|
91
|
-
|
92
|
-
-
|
93
|
-
|
88
|
+
- !binary |-
|
89
|
+
LmdpdGlnbm9yZQ==
|
90
|
+
- !binary |-
|
91
|
+
LnJzcGVj
|
92
|
+
- !binary |-
|
93
|
+
LnRyYXZpcy55bWw=
|
94
|
+
- !binary |-
|
95
|
+
Q0hBTkdFTE9HLm1k
|
96
|
+
- !binary |-
|
97
|
+
R2VtZmlsZQ==
|
98
|
+
- !binary |-
|
99
|
+
TElDRU5TRS50eHQ=
|
100
|
+
- !binary |-
|
101
|
+
UkVBRE1FLm1k
|
102
|
+
- !binary |-
|
103
|
+
UmFrZWZpbGU=
|
104
|
+
- !binary |-
|
105
|
+
YWdhdGUuZ2Vtc3BlYw==
|
106
|
+
- !binary |-
|
107
|
+
YmluL2FnYXRl
|
108
|
+
- !binary |-
|
109
|
+
bGliL2FnYXRlLnJi
|
110
|
+
- !binary |-
|
111
|
+
bGliL2FnYXRlL2Zvcm1hdHRlci9odG1sLnJi
|
112
|
+
- !binary |-
|
113
|
+
bGliL2FnYXRlL3BhcnNlci5yYg==
|
114
|
+
- !binary |-
|
115
|
+
bGliL2FnYXRlL3ZlcnNpb24ucmI=
|
116
|
+
- !binary |-
|
117
|
+
c3BlYy9saWIvcGFyc2VyX3NwZWMucmI=
|
118
|
+
- !binary |-
|
119
|
+
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
94
120
|
homepage: https://github.com/jbhannah/agate
|
95
121
|
licenses:
|
96
122
|
- MIT
|
97
|
-
metadata: {}
|
98
123
|
post_install_message:
|
99
124
|
rdoc_options: []
|
100
125
|
require_paths:
|
101
126
|
- lib
|
102
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
128
|
requirements:
|
104
|
-
- - '>='
|
129
|
+
- - ! '>='
|
105
130
|
- !ruby/object:Gem::Version
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
hash: 2002549777813010636
|
106
134
|
version: '0'
|
135
|
+
none: false
|
107
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
137
|
requirements:
|
109
|
-
- - '>='
|
138
|
+
- - ! '>='
|
110
139
|
- !ruby/object:Gem::Version
|
140
|
+
segments:
|
141
|
+
- 0
|
142
|
+
hash: 2002549777813010636
|
111
143
|
version: '0'
|
144
|
+
none: false
|
112
145
|
requirements: []
|
113
146
|
rubyforge_project:
|
114
|
-
rubygems_version:
|
147
|
+
rubygems_version: 1.8.24
|
115
148
|
signing_key:
|
116
|
-
specification_version:
|
117
|
-
summary: Wrap ruby characters (
|
118
|
-
|
149
|
+
specification_version: 3
|
150
|
+
summary: Wrap ruby characters (currently only furigana) in text with the HTML5 ruby
|
151
|
+
element.
|
119
152
|
test_files:
|
120
|
-
-
|
121
|
-
|
153
|
+
- !binary |-
|
154
|
+
c3BlYy9saWIvcGFyc2VyX3NwZWMucmI=
|
155
|
+
- !binary |-
|
156
|
+
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 9283043e09bdcd1998ea3718ccf784d86d53943e
|
4
|
-
data.tar.gz: 0283e186ae0a76ef6585fa9d4acb5378abbb4bf7
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 28c3cbcf9ed5a705dde577b36b18ebd51fbbdfa36bd5033d326ee7a4e9d370ece0c92068b58052327384c0cfcf411e0f67b37c7540f6430cce3db3af8a3b5d3a
|
7
|
-
data.tar.gz: 008fa85a64a4eac0b5260662a53a6c650d8d1f31b25c2b8c6443ab38bc8801abd884f4961b2a263592587a0ab86de9e5ca215b6d3bb84faec5cc815ab239c7c7
|