agate 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -4
- data/README.md +18 -2
- data/lib/agate/parser.rb +2 -2
- data/lib/agate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9283043e09bdcd1998ea3718ccf784d86d53943e
|
4
|
+
data.tar.gz: 0283e186ae0a76ef6585fa9d4acb5378abbb4bf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28c3cbcf9ed5a705dde577b36b18ebd51fbbdfa36bd5033d326ee7a4e9d370ece0c92068b58052327384c0cfcf411e0f67b37c7540f6430cce3db3af8a3b5d3a
|
7
|
+
data.tar.gz: 008fa85a64a4eac0b5260662a53a6c650d8d1f31b25c2b8c6443ab38bc8801abd884f4961b2a263592587a0ab86de9e5ca215b6d3bb84faec5cc815ab239c7c7
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -6,12 +6,28 @@
|
|
6
6
|
[](https://codeclimate.com/github/jbhannah/agate)
|
7
7
|
[](https://coveralls.io/r/jbhannah/agate)
|
8
8
|
|
9
|
-
Wrap ruby characters (
|
10
|
-
[HTML5 `ruby` element][].
|
9
|
+
Wrap ruby characters (currently only furigana) in text with the
|
10
|
+
[HTML5 `ruby` element][]. **Requires Ruby 1.9 or later (or compabible
|
11
|
+
engine).**
|
11
12
|
|
12
13
|
## Usage
|
13
14
|
|
15
|
+
Install the gem with
|
16
|
+
|
17
|
+
gem install agate
|
18
|
+
|
19
|
+
or add it to your `Gemfile`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem "agate", "~> 0.3.2"
|
23
|
+
```
|
24
|
+
|
25
|
+
To markup a simple string with delimited furigana:
|
26
|
+
|
14
27
|
```ruby
|
28
|
+
require "rubygems"
|
29
|
+
require "agate"
|
30
|
+
|
15
31
|
options = {
|
16
32
|
# can be any single character or pair of characters which surround ruby characters in text to parse
|
17
33
|
:delimiters => "【】" # default delimiters
|
data/lib/agate/parser.rb
CHANGED
@@ -23,8 +23,8 @@ module Agate
|
|
23
23
|
|
24
24
|
# Parse `text` and return it with ruby character markup
|
25
25
|
def parse(text)
|
26
|
-
first = @options[:delimiters]
|
27
|
-
last = @options[:delimiters]
|
26
|
+
first = @options[:delimiters][0]
|
27
|
+
last = @options[:delimiters][-1]
|
28
28
|
|
29
29
|
first = /#{'\\' + first}/ if RESERVED.include? first
|
30
30
|
last = /#{'\\' + last}/ if RESERVED.include? last
|
data/lib/agate/version.rb
CHANGED