middleman-ya_lorem_ja 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc24b3fba7ae575aea5f5bd676730f1eadba19cb
4
- data.tar.gz: 6e10933c024dc696b9bf22a25ded771a78d0d6da
3
+ metadata.gz: 3d98eef68c1d13f0e6b77bf0b562350f80c3c5dd
4
+ data.tar.gz: a321eb59f37f5fca918d9d94acf74cd2cd082838
5
5
  SHA512:
6
- metadata.gz: f3f10ef94327ae8fa57f3e5d8f47c66de3d08934034e64111a969f03e31faa860a9b9469029ab5b453b4bd49bd5133e0c8bcdf8463cd0d4cdafefa8f8e6bbad9
7
- data.tar.gz: 4d3466fc13266d841a830fac40738b6e28ad436de6a45037a8ddd2e6aed1235bd6311ea000034232e1c68f519913417c309f34c17b18a888f6794b236267df19
6
+ metadata.gz: e12af62faa5f3ad66ac969a441c65a6d243bd203abf6516230764af4168644ec59943e58cb0c1d19e7ee19594b1bc0c77614030538bcf2921123278cd5de1cbd
7
+ data.tar.gz: b59b604b4a17d296b414eccd44e66b4a80b696a5301b7cd973dde21ba5cffd6e292ed9b8edfd8544e3dbdaba98b81c1b75fa69045a488031a613edf790f05915
data/README.md CHANGED
@@ -42,10 +42,8 @@ erb に以下を記載した場合は、
42
42
  <h2><%= lorem_ja.words(5) %></h2>
43
43
  <p><%= lorem_ja.sentence %></p>
44
44
  <p><%= lorem_ja.sentences(3) %></p>
45
- <p>
46
45
  <%= lorem_ja.paragraph %>
47
46
  <%= lorem_ja.paragraphs(3) %>
48
- </p>
49
47
  ```
50
48
 
51
49
  以下のように出力されます。
@@ -60,29 +58,23 @@ erb に以下を記載した場合は、
60
58
  高尚なること檞の木の如き諸君よ、諸君は何故彼如き陋劣漢を地上より埋没せしめんと願わざる乎。
61
59
  しかるに諸君、ああ諸君、おお諸君、余は敗北したのである。
62
60
  </p>
63
- <p>
64
- そのために、余は空気の如く彼の寝室に侵入することが出来たのである。
61
+ <p>そのために、余は空気の如く彼の寝室に侵入することが出来たのである。
65
62
  この珍奇なる部落は、人種、風俗、言語に於て西欧の全人種に隔絶し、実に地球の半廻転を試みてのち、極東じゃぽん国にいたって初めて著しき類似を見出すのである。
66
63
  ああ三度冷静なること扇風機の如き諸君よ、かの憎むべき蛸博士は何等の愛なくして余の妻を奪ったのである。
67
64
  偉大なる博士はシルクハットを被り直したのである。
68
- 僕は階段の途中に凝縮して、まだ響き残っているその慌しい跫音を耳にしながら、ただ一陣の突風が階段の下に舞い狂うのを見たのみであった。
69
- </p>
70
- <p>
71
- 諸君よ、翌日の夜明けを期して、かの憎むべき蛸はついに蛸自体の正体を遺憾なく暴露するに至るであろう!
65
+ 僕は階段の途中に凝縮して、まだ響き残っているその慌しい跫音を耳にしながら、ただ一陣の突風が階段の下に舞い狂うのを見たのみであった。</p>
66
+ <p>諸君よ、翌日の夜明けを期して、かの憎むべき蛸はついに蛸自体の正体を遺憾なく暴露するに至るであろう!
72
67
  諸氏よ、誰人かよく蛸を懲す勇士なきや。
73
68
  余の力を以てして、彼の悪略に及ばざることすでに明白なり矣。
74
69
  全てこれらの狼狽は極めて直線的な突風を描いて交錯する為に、部屋の中には何本もの飛ぶ矢に似た真空が閃光を散らして騒いでいる習慣であった。
75
- そして、今、東北端の肱掛椅子から移転したばかりに相違ない証拠には、一陣の突風が東北から西南にかけて目に沁み渡る多くの矢を描きながら走っていたのである。
76
-
77
- 偉大なる博士が彼の女に目をつけたのは流石に偉大なる見識といわねばならない。
70
+ そして、今、東北端の肱掛椅子から移転したばかりに相違ない証拠には、一陣の突風が東北から西南にかけて目に沁み渡る多くの矢を描きながら走っていたのである。</p>
71
+ <p>偉大なる博士が彼の女に目をつけたのは流石に偉大なる見識といわねばならない。
78
72
  たとえば、時計はいそがしく十三時を打ち、礼節正しい来客がもじもじして腰を下そうとしない時に椅子は劇しい癇癪を鳴らし、物体の描く陰影は突如太陽に向って走り出すのである。
79
- たとえば諸君、頃日余の戸口に Banana の皮を撒布し余の殺害を企てたのも彼の方寸に相違ない。
80
-
81
- 実に諸君、彼は秘かに別の鬘を貯蔵していたのである。
73
+ たとえば諸君、頃日余の戸口に Banana の皮を撒布し余の殺害を企てたのも彼の方寸に相違ない。</p>
74
+ <p>実に諸君、彼は秘かに別の鬘を貯蔵していたのである。
82
75
  成吉思汗は欧州を侵略し、西班牙に至ってその消息を失うたのである。
83
76
  そして其筋の計算に由れば、偉大なる風博士は僕と共謀のうえ遺書を捏造して自殺を装い、かくてかの憎むべき蛸博士の名誉毀損をたくらんだに相違あるまいと睨んだのである。
84
- 諸君はその時、実にあわただしい後悔と一緒に黄昏に似た沈黙がこの書斎に閉じ籠もるのを認められるに相違ない。
85
- </p>
77
+ 諸君はその時、実にあわただしい後悔と一緒に黄昏に似た沈黙がこの書斎に閉じ籠もるのを認められるに相違ない。</p>
86
78
  ```
87
79
 
88
80
  ## Interface ##
@@ -93,17 +85,20 @@ erb に以下を記載した場合は、
93
85
  - words(num_of_words)
94
86
  - sentence
95
87
  - sentences(num_of_words)
96
- - paragraph
97
- - paragraphs(num_of_sentces)
88
+ - paragraph(opts={})
89
+ - paragraphs(num_of_sentces, opts={})
98
90
  - date(fmt='%Y年%m月%d日')
99
91
  - image(size, options={})
100
92
 
93
+ paragraph と paragraphs で指定可能な段落の前後に設定するセパレータのデフォルト値は、開始セパレータ(:start_sep)が"<p>", 終了セパレータ(:end_sep)が"</p>"となっています。
101
94
 
102
- ## 参考 ##
103
95
 
104
- * [ya_lorem_ja](https://github.com/tanalab2/ya_lorem_ja)
96
+ ## 参考 ##
105
97
 
106
- * [lorem.rb](https://github.com/middleman/middleman/middleman-core/lib/middleman-more/extensions/lorem.rb )
98
+ * [tanalab2/ya_lorem_ja](https://github.com/tanalab2/ya_lorem_ja)
99
+ * [middleman-ya_lorem_jaの使い方](http://discountinnovations.com/articles/middleman/03.html)
100
+ * [日本語 Lorem サンプル(風博士 版)](http://discountinnovations.com/articles/middleman/lorem_ja.html)
101
+ * [日本語 Lorem サンプル(注文の多い料理店 版)](http://discountinnovations.com/articles/middleman/lorem_ja_chuumon_no_ooi_ryouriten.html)
107
102
 
108
103
  ## License
109
104
  * MIT
@@ -10,7 +10,9 @@ Feature: Lorem generating helper
10
10
  Then I should see "#sentences3" contents have over "6" chars
11
11
  Then I should see "#sentences3" contents have "3" sentences
12
12
  Then I should see "#paragraph" contents have "1" paragraphs
13
+ Then I should see "#paragraph" contents match "</p>"
13
14
  Then I should see "#paragraphs3" contents have "3" paragraphs
15
+ Then I should see "#paragraphs3" contents match "</p>"
14
16
  Then I should see "#date" contents match "\d{4}年\d{2}月\d{2}日"
15
17
  Then I should see "#image" contents match "^http://placehold.it/20x20"
16
18
  Then I should see "#resource_name" contents match "kazehakase"
@@ -57,6 +57,16 @@ module Middleman
57
57
  @@singleton__instance__ = nil if @@singleton__instance__
58
58
  }
59
59
  end
60
+
61
+ def paragraph
62
+ self.paragraphs(1)
63
+ end
64
+
65
+ def paragraphs(total, opts={ })
66
+ default_options = { start_sep: "<p>", end_sep: "</p>" }
67
+ merged_opts = default_options.merge(opts)
68
+ super(total, merged_opts)
69
+ end
60
70
 
61
71
  private
62
72
  def initialize(resource_name, char_count_range, word_count_range, sentence_count_range)
@@ -48,7 +48,7 @@ Given /^the Server is running$/ do
48
48
  set :show_exceptions, false
49
49
  }
50
50
 
51
- in_current_dir do
51
+ cd('.') do
52
52
  @server_inst = Middleman::Application.server.inst do
53
53
  initialize_commands.each do |p|
54
54
  instance_exec(&p)
@@ -69,85 +69,85 @@ Given /^a template named "([^\"]*)" with:$/ do |name, string|
69
69
  end
70
70
 
71
71
  When /^I go to "([^\"]*)"$/ do |url|
72
- in_current_dir do
72
+ cd('.') do
73
73
  visit(URI.encode(url).to_s)
74
74
  end
75
75
  end
76
76
 
77
77
  Then /^going to "([^\"]*)" should not raise an exception$/ do |url|
78
- in_current_dir do
78
+ cd('.') do
79
79
 
80
80
  expect{ visit(URI.encode(url).to_s) }.to_not raise_exception
81
81
  end
82
82
  end
83
83
 
84
84
  Then /^the content type should be "([^\"]*)"$/ do |expected|
85
- in_current_dir do
85
+ cd('.') do
86
86
  expect(page.response_headers['Content-Type']).to start_with expected
87
87
  end
88
88
  end
89
89
 
90
90
  Then /^I should see "([^\"]*)"$/ do |expected|
91
- in_current_dir do
91
+ cd('.') do
92
92
  expect(page.body).to include expected
93
93
  end
94
94
  end
95
95
 
96
96
  Then /^I should see '([^\']*)'$/ do |expected|
97
- in_current_dir do
97
+ cd('.') do
98
98
  expect(page.body).to include expected
99
99
  end
100
100
  end
101
101
 
102
102
  Then /^I should see:$/ do |expected|
103
- in_current_dir do
103
+ cd('.') do
104
104
  expect(page.body).to include expected
105
105
  end
106
106
  end
107
107
 
108
108
  Then /^I should not see "([^\"]*)"$/ do |expected|
109
- in_current_dir do
109
+ cd('.') do
110
110
  expect(page.body).not_to include expected
111
111
  end
112
112
  end
113
113
 
114
114
  Then /^I should not see:$/ do |expected|
115
- in_current_dir do
115
+ cd('.') do
116
116
  expect(page.body).not_to include expected
117
117
  end
118
118
  end
119
119
 
120
120
  Then /^the status code should be "([^\"]*)"$/ do |expected|
121
- in_current_dir do
121
+ cd('.') do
122
122
  expect(page.status_code).to eq expected.to_i
123
123
  end
124
124
  end
125
125
 
126
126
  Then /^I should see "([^\"]*)" lines$/ do |lines|
127
- in_current_dir do
127
+ cd('.') do
128
128
  expect(page.body.chomp.split($/).length).to eq lines.to_i
129
129
  end
130
130
  end
131
131
 
132
132
  Then /^I should see over "([^\"]*)" chars$/ do |lines|
133
- in_current_dir do
133
+ cd('.') do
134
134
  expect(page.body.chomp.length).to be >= lines.to_i
135
135
  end
136
136
  end
137
137
 
138
138
  Then /^I should see "([^\"]*)" contents have over "([^\"]*)" chars$/ do |id, chars|
139
- in_current_dir do
139
+ cd('.') do
140
140
  elm = page.find_by_id(id)
141
- content = elm.text
141
+ content = elm.native.inner_html
142
142
  puts "content: #{content} expect length: #{chars} exact length: #{content.length}"
143
143
  expect(content.length).to be >= chars.to_i
144
144
  end
145
145
  end
146
146
 
147
147
  Then /^I should see "([^\"]*)" contents have "([^\"]*)" sentences$/ do |id, lines|
148
- in_current_dir do
148
+ cd('.') do
149
149
  elm = page.find_by_id(id)
150
- content = elm.native.text
150
+ content = elm.native.inner_html
151
151
  line_ary = content.chomp.split("\n")
152
152
  puts "content: #{content} expect lines: #{lines} exact sentences: #{line_ary.length}"
153
153
  expect(line_ary.size).to be >= lines.to_i
@@ -155,20 +155,20 @@ Then /^I should see "([^\"]*)" contents have "([^\"]*)" sentences$/ do |id, line
155
155
  end
156
156
 
157
157
  Then /^I should see "([^\"]*)" contents have "([^\"]*)" paragraphs$/ do |id, lines|
158
- in_current_dir do
158
+ cd('.') do
159
159
  elm = page.find_by_id(id)
160
- content = elm.native.text
161
- line_ary = content.chomp.split("\n\n")
160
+ content = elm.native.inner_html
161
+ line_ary = content.chomp.split("</p>")
162
162
  puts "content: #{content} expect lines: #{lines} exact paragraphs: #{line_ary.length}"
163
163
  expect(line_ary.size).to be >= lines.to_i
164
164
  end
165
165
  end
166
166
 
167
167
  Then /^I should see "([^\"]*)" contents match "(.*)"$/ do |id, regex|
168
- in_current_dir do
168
+ cd('.') do
169
169
  elm = page.find_by_id(id)
170
- content = elm.native.text
171
- expect(content).to match(/#{ regex }/)
170
+ content = elm.native.inner_html
171
+ expect(content).to match(/#{ regex }/m)
172
172
  end
173
173
  end
174
174
 
@@ -1,6 +1,6 @@
1
1
  module Middleman
2
2
  # GeoPattern
3
3
  module YaLoremJa
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
6
6
  end
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.add_runtime_dependency("middleman-core", [">= 3.3.12"])
21
21
 
22
22
  # Additional dependencies
23
- s.add_runtime_dependency("ya_lorem_ja", ">= 0.0.3")
23
+ s.add_runtime_dependency("ya_lorem_ja", ">= 0.0.4")
24
24
  end
metadata CHANGED
@@ -1,50 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-ya_lorem_ja
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kenji tanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-09 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.3.12
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.3.12
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ya_lorem_ja
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.3
33
+ version: 0.0.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.3
40
+ version: 0.0.4
41
41
  description: Yet Another Japanese Lorem Ipsum generator For Middleman
42
42
  email:
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - ".gitignore"
47
+ - .gitignore
48
48
  - Gemfile
49
49
  - README.md
50
50
  - Rakefile
@@ -73,17 +73,17 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.4.5
86
+ rubygems_version: 2.2.2
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Yet Another Japanese Lorem Ipsum generator For Middleman