gottani 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/Gemfile +4 -4
- data/README.md +42 -2
- data/Rakefile +7 -0
- data/gottani.gemspec +4 -4
- data/lib/gottani/version.rb +1 -1
- data/lib/gottani_core.rb +2 -0
- data/lib/indents/hatena.rb +21 -0
- data/spec/gottani_core_spec.rb +20 -0
- metadata +22 -20
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Gottani
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/tbpgr/gottani.png?branch=master)](https://travis-ci.org/tbpgr/gottani)
|
4
|
+
|
3
5
|
Gottani is coverter for indent-style text.
|
4
6
|
|
5
7
|
## Support type
|
@@ -8,6 +10,7 @@ Gottani is coverter for indent-style text.
|
|
8
10
|
* Space2 indent
|
9
11
|
* Space4 indent
|
10
12
|
* Markdown indent
|
13
|
+
* Hatena indent
|
11
14
|
|
12
15
|
## Installation
|
13
16
|
|
@@ -27,10 +30,11 @@ Or install it yourself as:
|
|
27
30
|
### Convert List
|
28
31
|
| type | convert_type key | convert_method_name |
|
29
32
|
|:----------- |:------------ |:------------ |
|
30
|
-
|
|
33
|
+
|hatena |Gottani::Core.new :hatena, text |to_hatena |
|
34
|
+
|markdown |Gottani::Core.new :markdown, text|to_markdown |
|
31
35
|
|space2-indent |Gottani::Core.new :space2, text |to_space2 |
|
32
36
|
|space4-indent |Gottani::Core.new :space4, text |to_space4 |
|
33
|
-
|
|
37
|
+
|tab-indent |Gottani::Core.new :tab, text |to_tab |
|
34
38
|
|
35
39
|
### tab-indent to space2 indent
|
36
40
|
|
@@ -134,7 +138,43 @@ output
|
|
134
138
|
## child3
|
135
139
|
~~~
|
136
140
|
|
141
|
+
|
142
|
+
### space4 to Hatena indent
|
143
|
+
|
144
|
+
~~~ruby
|
145
|
+
require 'gottani_core'
|
146
|
+
|
147
|
+
text =<<-EOS
|
148
|
+
root
|
149
|
+
child1
|
150
|
+
child1_1
|
151
|
+
child1_1_1
|
152
|
+
child1_1_2
|
153
|
+
child1_2
|
154
|
+
child2
|
155
|
+
child2_1
|
156
|
+
child3
|
157
|
+
EOS
|
158
|
+
|
159
|
+
gottani_core = Gottani::Core.new :space4, text
|
160
|
+
gottani_core.to_hatena
|
161
|
+
~~~
|
162
|
+
|
163
|
+
output
|
164
|
+
~~~
|
165
|
+
*root
|
166
|
+
**child1
|
167
|
+
***child1_1
|
168
|
+
****child1_1_1
|
169
|
+
****child1_1_2
|
170
|
+
***child1_2
|
171
|
+
**child2
|
172
|
+
***child2_1
|
173
|
+
**child3
|
174
|
+
~~~
|
175
|
+
|
137
176
|
## History
|
177
|
+
* version 0.0.2 : add Hatena Format.
|
138
178
|
* version 0.0.1 : first release.
|
139
179
|
|
140
180
|
## Contributing
|
data/Rakefile
CHANGED
data/gottani.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "activesupport"
|
21
|
+
spec.add_runtime_dependency "activesupport"
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rspec"
|
26
|
-
spec.add_development_dependency "simplecov"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "simplecov"
|
27
27
|
end
|
data/lib/gottani/version.rb
CHANGED
data/lib/gottani_core.rb
CHANGED
@@ -4,6 +4,7 @@ require 'indents/tab'
|
|
4
4
|
require 'indents/space2'
|
5
5
|
require 'indents/space4'
|
6
6
|
require 'indents/markdown'
|
7
|
+
require 'indents/hatena'
|
7
8
|
|
8
9
|
module Gottani
|
9
10
|
class Core
|
@@ -13,6 +14,7 @@ module Gottani
|
|
13
14
|
space2: Gottani::Space2,
|
14
15
|
space4: Gottani::Space4,
|
15
16
|
markdown: Gottani::Markdown,
|
17
|
+
hatena: Gottani::Hatena,
|
16
18
|
}
|
17
19
|
|
18
20
|
def initialize(type, base)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'indents/base'
|
3
|
+
|
4
|
+
module Gottani
|
5
|
+
class Hatena
|
6
|
+
include Base
|
7
|
+
define_to_common :hatena
|
8
|
+
|
9
|
+
def get_indent_char
|
10
|
+
'*'
|
11
|
+
end
|
12
|
+
|
13
|
+
def zero_start?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_separator
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/gottani_core_spec.rb
CHANGED
@@ -52,6 +52,18 @@ root
|
|
52
52
|
## child3
|
53
53
|
EOS
|
54
54
|
|
55
|
+
HATENA = <<-EOS
|
56
|
+
*root
|
57
|
+
**child1
|
58
|
+
***child1_1
|
59
|
+
****child1_1_1
|
60
|
+
****child1_1_2
|
61
|
+
***child1_2
|
62
|
+
**child2
|
63
|
+
***child2_1
|
64
|
+
**child3
|
65
|
+
EOS
|
66
|
+
|
55
67
|
cases = [
|
56
68
|
{
|
57
69
|
case_no: 1,
|
@@ -93,6 +105,14 @@ root
|
|
93
105
|
method_name: :to_tab,
|
94
106
|
expected: TAB
|
95
107
|
},
|
108
|
+
{
|
109
|
+
case_no: 6,
|
110
|
+
case_title: 'markdown to hatena case',
|
111
|
+
type: :markdown,
|
112
|
+
input: MARKDOWN,
|
113
|
+
method_name: :to_hatena,
|
114
|
+
expected: HATENA
|
115
|
+
},
|
96
116
|
]
|
97
117
|
|
98
118
|
cases.each do |c|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gottani
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,33 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &22118220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22118220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &22117944 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *22117944
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &22117680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,29 +43,29 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *22117680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &22117368 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *22117368
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &22117056 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0
|
65
|
+
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *22117056
|
69
69
|
description: Gottani is coverter for indent-style text.
|
70
70
|
email:
|
71
71
|
- tbpgr@tbpgr.jp
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- .gitignore
|
77
77
|
- .rspec
|
78
|
+
- .travis.yml
|
78
79
|
- Gemfile
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|
@@ -83,6 +84,7 @@ files:
|
|
83
84
|
- lib/gottani/version.rb
|
84
85
|
- lib/gottani_core.rb
|
85
86
|
- lib/indents/base.rb
|
87
|
+
- lib/indents/hatena.rb
|
86
88
|
- lib/indents/markdown.rb
|
87
89
|
- lib/indents/space2.rb
|
88
90
|
- lib/indents/space4.rb
|