tdiary-style-rd 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 26005407987328a5aece608dc4b553d91f0060ea
4
+ data.tar.gz: ecc5cc264c199379908e1e860a9be3ab4613d517
5
+ SHA512:
6
+ metadata.gz: 05ce051fab516cc39eaa9af1c51ac43fc516261c8e526bd59da37048046e7ac0668e612b41f7f88fbc293c2ada9e46994111c22ea42ea921e450bc263659ab9f
7
+ data.tar.gz: 99fcb14750e8134bed5b0424487f490e6dd9ce010ad4ff4e1664ca47b3e0810aa846136237b95d334bcbf0993c0f5587c2d9b791951a7835ce896d40f135d60a
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tdiary-style-rd.gemspec
4
+ gemspec
5
+
6
+ gem 'tdiary', github: 'tdiary/tdiary-core'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 SHIBATA Hiroshi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Tdiary::Style::Rd
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'tdiary-style-rd'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install tdiary-style-rd
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,367 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # rd_style.rb: RD style for tDiary 2.x format. $Revision: 1.32 $
4
+ # based on Wiki style which Copyright belongs to TADA Tadashi.
5
+ #
6
+ # if you want to use this style, install RDtool
7
+ # and add @style into tdiary.conf below:
8
+ #
9
+ # @style = 'RD'
10
+ #
11
+ # about RDtool: http://raa.ruby-lang.org/list.rhtml?name=rdtool
12
+ #
13
+ # ref_extension codes come from rd2html-ext
14
+ # http://raa.ruby-lang.org/list.rhtml?name=rd2html-ext
15
+ #
16
+ # Copyright (C) 2003, UECHI Yasumasa <uechi@potaway.net>
17
+ # You can distribute this under GPL.
18
+ #
19
+ require 'rd/rdfmt'
20
+ require 'rd/rd2html-lib'
21
+
22
+ module RD
23
+ TDIARY_BASE_LEVEL = 2
24
+
25
+ class RD2tDiaryVisitor < RD2HTMLVisitor
26
+ def initialize( date=nil, idx=nil, opt=nil, author=nil )
27
+ @td_date = date
28
+ @td_idx = idx
29
+ @td_opt = opt
30
+ @td_author = author
31
+ super()
32
+ end
33
+
34
+ def apply_to_DocumentElement(element, content)
35
+ ret = ""
36
+ ret << html_body(content) + "\n"
37
+ ret
38
+ end
39
+
40
+ def html_body(contents)
41
+ content = contents.join("\n")
42
+ end
43
+ private :html_body
44
+
45
+ def apply_to_Headline(element, title)
46
+ level = element.level + TDIARY_BASE_LEVEL
47
+ title = title.join
48
+ if level == 3
49
+ r = %Q[<h#{level}><%= subtitle_proc( Time::at( #{@td_date.to_i} ), #{title.to_s.dump.gsub( /%/, '\\\\045' )} ) %></h#{level}>]
50
+ else
51
+ r = %Q[<h#{level}>#{title}</h#{level}>]
52
+ end
53
+ r
54
+ end
55
+
56
+ def apply_to_DescListItem(element, term, description)
57
+ %Q[<dt>#{term.join}</dt>] +
58
+ if description.empty? then
59
+ "\n"
60
+ else
61
+ %Q[\n<dd>\n#{description.join("\n").chomp}\n</dd>]
62
+ end
63
+ end
64
+
65
+ def apply_to_MethodList(element, items)
66
+ if /^(<.+>)?$/ =~ element.items[0].term.to_label
67
+ %Q[#{items.join("\n").chomp}\n]
68
+ else
69
+ %Q[<dl>\n#{items.join("\n").chomp}\n</dl>]
70
+ end
71
+ end
72
+
73
+ def apply_to_MethodListItem(element, term, description)
74
+ case term
75
+ when /^&lt;([^\s]+)\s*.*&gt;/
76
+ closetag = "</#{CGI.unescapeHTML($1)}>"
77
+ r = CGI.unescapeHTML(term)
78
+ if description.size > 0
79
+ r << %Q[\n#{description.join("\n")}\n]
80
+ r << closetag
81
+ end
82
+ r
83
+ when ''
84
+ "<hr>"
85
+ else
86
+ super
87
+ end
88
+ end
89
+
90
+ # use for tDiary plugin :-p
91
+ def apply_to_Keyboard(element, content)
92
+ plugin, args = CGI.unescapeHTML(content.join("")).split(/\s+/, 2)
93
+ %Q[<%=#{plugin} #{args}%>]
94
+ end
95
+
96
+ # use for native html
97
+ def apply_to_Index(element, content)
98
+ CGI.unescapeHTML(content.join)
99
+ end
100
+
101
+ def apply_to_Footnote(element, content)
102
+ escaped_content = content.join.gsub( /%>/, "%%>" )
103
+ %Q|<%=fn apply_plugin( #{escaped_content.dump} ) %>|
104
+ end
105
+
106
+ def apply_to_RefToElement(element, content)
107
+ label = element.to_label
108
+ key, opt = label.split(/:/, 2)
109
+
110
+ case key
111
+ when "IMG"
112
+ ref_ext_IMG(label, content.join, opt)
113
+ when "RAA"
114
+ ref_ext_RAA(label, content.join, opt)
115
+ when /^ruby-(talk|list|dev|math|ext|core)$/
116
+ ref_ext_RubyML(label, content.join, key, opt)
117
+ when /^(\d{4}|\d{6}|\d{8}|\d{8}-\d+)[^\d]*?#?([pct]\d+)?$/
118
+ %Q[<%=my "#{key}","#{content.join}"%>]
119
+ else
120
+ opt = "" unless opt # case of no ":"
121
+ %Q[<%=a "#{key}","#{opt}","#{content.join}"%>]
122
+ end
123
+ end
124
+
125
+ private
126
+ def categorized_subtitle( title )
127
+ cat = /^(\[(.*?)\])+/.match(title.to_s).to_a[0]
128
+ subtitle = $'
129
+
130
+ if cat
131
+ r =
132
+ cat.scan(/\[(.*?)\]/).collect do |c|
133
+ %Q|<%= category_anchor("#{c[0]}") %>|
134
+ end.join + subtitle
135
+ else
136
+ r = title.to_s
137
+ end
138
+ r
139
+ end
140
+
141
+ def ref_ext_RubyML(label, content, ml, article)
142
+ article.sub!(/^0+/, '')
143
+ content = "[#{label}]" if label == content
144
+
145
+ %Q[<a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/#{ ml }/#{ article }">#{ content }</a>]
146
+ end
147
+
148
+ def ref_ext_RAA(label, content, name)
149
+ name = CGI.escape(name)
150
+ content = "[#{label}]" if label == content
151
+ %Q[<a href="http://raa.ruby-lang.org/list.rhtml?name=#{ name }">#{ content }</a>]
152
+ end
153
+
154
+ def ref_ext_IMG(label, content, src)
155
+ label.to_s == content.to_s and content = src
156
+ %Q[<img src="#{src}" alt="#{content}">]
157
+ end
158
+ end
159
+
160
+ class RD2tDiaryCHTMLVistor < RD2tDiaryVisitor
161
+ def apply_to_Headline(element, title)
162
+ level = element.level + TDIARY_BASE_LEVEL
163
+ title = title.join
164
+ if level == 3
165
+ r = %Q[<H#{level}><%= subtitle_proc( Time::at( #{@td_date.to_i} ), #{title.to_s.dump.gsub( /%/, '\\\\045' )} ) %></H#{level}>]
166
+ else
167
+ r = %Q[<H#{level}>#{title}</H#{level}>]
168
+ end
169
+ r
170
+ end
171
+ end
172
+
173
+ class RDInlineParser
174
+ def on_error(et, ev, values)
175
+ lines_of_rest = @src.rest.lines.to_a.length
176
+ prev_words = prev_words_on_error(ev)
177
+ at = 4 + prev_words.length
178
+ message = <<-MSG
179
+ RD syntax error: line #{@blockp.line_index - lines_of_rest - 1}:
180
+ ...#{prev_words} #{(ev||'')} #{next_words_on_error()} ...
181
+ MSG
182
+ message << " " * at + "^" * (ev ? ev.length : 0) + "\n"
183
+ raise ParseError, message
184
+ end
185
+ end
186
+
187
+ end
188
+
189
+ module TDiary
190
+ module Style
191
+ class RDSection
192
+ include RD
193
+
194
+ attr_reader :author, :categories, :subtitle, :stripped_subtitle
195
+ attr_reader :body_to_html, :subtitle_to_html, :stripped_subtitle_to_html
196
+
197
+ def initialize( fragment, author = nil )
198
+ @author = author
199
+ if /\A=(?!=)/ =~ fragment then
200
+ @subtitle, @body = fragment.split( /\n/, 2 )
201
+ @subtitle.sub!( /^\=\s*/, '' )
202
+ else
203
+ @subtitle = nil
204
+ @body = fragment.dup
205
+ end
206
+ @body = @body || ''
207
+ @body.sub!( /[\n\r]+\Z/, '' )
208
+ @body << "\n\n"
209
+
210
+ @categories = get_categories
211
+ @stripped_subtitle = strip_subtitle
212
+
213
+ @subtitle_to_html = manufacture(@subtitle, true)
214
+ @stripped_subtitle_to_html = manufacture(@stripped_subtitle, true)
215
+ @body_to_html = manufacture(@body, false)
216
+ end
217
+
218
+ def subtitle=(subtitle)
219
+ cat_str = ""
220
+ @categories.each {|cat|
221
+ cat_str << "[#{cat}]"
222
+ }
223
+ cat_str << " " unless cat_str.empty?
224
+ @subtitle = subtitle ? (cat_str + subtitle) : nil
225
+ @stripped_subtitle = strip_subtitle
226
+ end
227
+
228
+ def body=(str)
229
+ @body = str
230
+ end
231
+
232
+ def body
233
+ @body.dup
234
+ end
235
+
236
+ def categories=(categories)
237
+ @categories = categories
238
+ cat_str = ""
239
+ categories.each {|cat|
240
+ cat_str << "[#{cat}]"
241
+ }
242
+ cat_str << " " unless cat_str.empty?
243
+ @subtitle = @subtitle ? (cat_str + @stripped_subtitle) : nil
244
+ @stripped_subtitle = strip_subtitle
245
+ end
246
+
247
+ def to_src
248
+ r = ''
249
+ r << "= #{@subtitle}\n" if @subtitle
250
+ r << @body
251
+ end
252
+
253
+ def html( date, idx, opt, mode = :HTML)
254
+ if mode == :CHTML
255
+ visitor = RD2tDiaryCHTMLVistor.new( date, idx, opt, @author)
256
+ section_open = "<%=section_enter_proc( Time::at( #{date.to_i} ))%>\n"
257
+ section_close = "<%=section_leave_proc( Time::at( #{date.to_i} ))%>\n"
258
+ else
259
+ visitor = RD2tDiaryVisitor.new( date, idx, opt, @author )
260
+ section_open = %Q[<div class="section">\n<%=section_enter_proc( Time::at( #{date.to_i} ))%>\n]
261
+ section_close = "<%=section_leave_proc( Time::at( #{date.to_i} ))%>\n</div>\n"
262
+ end
263
+
264
+ src = to_src.split(/^/)
265
+ src.unshift("=begin\n").push("=end\n")
266
+ tree = RDTree.new( src, nil, nil)
267
+ begin
268
+ tree.parse
269
+ rescue ParseError
270
+ raise SyntaxError, $!.message
271
+ end
272
+
273
+ r = "#{section_open}#{visitor.visit( tree )}#{section_close}"
274
+ end
275
+
276
+ private
277
+ def manufacture(str, subtitle = false)
278
+ return nil unless str
279
+ src = str.strip.split(/^/).unshift("=begin\n").push("=end\n")
280
+ visitor = RD2tDiaryVisitor.new
281
+ tree = RDTree.new(src, nil, nil)
282
+ begin
283
+ r = visitor.visit( tree.parse )
284
+ r.gsub!(/<\/?p>/, '') if subtitle
285
+ r
286
+ rescue ParseError
287
+ str
288
+ end
289
+ end
290
+
291
+ def get_categories
292
+ return [] unless @subtitle
293
+ cat = /^(\[(.*?)\])+/.match(@subtitle).to_a[0]
294
+ return [] unless cat
295
+ cat.scan(/\[(.*?)\]/).collect do |c|
296
+ c[0].split(/,/)
297
+ end.flatten
298
+ end
299
+
300
+ def strip_subtitle
301
+ return nil unless @subtitle
302
+ @subtitle.sub(/^(\[(.*?)\])+/,'')
303
+ end
304
+ end
305
+
306
+ class RdDiary
307
+ include BaseDiary
308
+ include CategorizableDiary
309
+
310
+ def initialize( date, title, body, modified = Time::now )
311
+ init_diary
312
+ replace( date, title, body )
313
+ @last_modified = modified
314
+ end
315
+
316
+ def style
317
+ 'RD'
318
+ end
319
+
320
+ def append( body, author = nil )
321
+ section = nil
322
+ body.lines.each do |l|
323
+ case l
324
+ when /^=(begin|end)\b/
325
+ # do nothing
326
+ when /^=[^=]/
327
+ @sections << RDSection::new( section, author ) if section
328
+ section = l
329
+ else
330
+ section = '' unless section
331
+ section << l
332
+ end
333
+ end
334
+ @sections << RDSection::new( section, author ) if section
335
+ @last_modified = Time::now
336
+ self
337
+ end
338
+
339
+ def add_section(subtitle, body)
340
+ sec = RDSection::new("\n")
341
+ sec.subtitle = subtitle
342
+ sec.body = body
343
+ @sections << sec
344
+ @sections.size
345
+ end
346
+
347
+ def to_html( opt = {}, mode = :HTML )
348
+ r = ''
349
+ idx = 1
350
+ each_section do |section|
351
+ r << section.html( date, idx, opt, mode )
352
+ idx += 1
353
+ end
354
+ return r
355
+ end
356
+
357
+ undef :to_html4, :to_chtml
358
+ end
359
+ end
360
+ end
361
+
362
+ # Local Variables:
363
+ # mode: ruby
364
+ # indent-tabs-mode: t
365
+ # tab-width: 3
366
+ # ruby-indent-level: 3
367
+ # End:
@@ -0,0 +1,7 @@
1
+ module Tdiary
2
+ module Style
3
+ module Rd
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'tdiary/comment_manager'
3
+ require 'tdiary/referer_manager'
4
+ require 'tdiary/style'
5
+ require 'tdiary/style/rd'
@@ -0,0 +1,221 @@
1
+ # -*- coding: utf-8; -*-
2
+ require 'spec_helper'
3
+
4
+ describe TDiary::Style::RdDiary do
5
+ before do
6
+ @diary = TDiary::Style::RdDiary.new(Time::at( 1041346800 ), "TITLE", "")
7
+ end
8
+
9
+ describe '#append' do
10
+ before do
11
+ source = <<-'EOF'
12
+ = subTitle
13
+ honbun
14
+
15
+ == subTitleH4
16
+ honbun
17
+
18
+ EOF
19
+ @diary.append(source)
20
+ end
21
+
22
+ context 'HTML' do
23
+ before do
24
+ @html = <<-'EOF'
25
+ <div class="section">
26
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
27
+ <h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle" ) %></h3>
28
+ <p>honbun</p>
29
+ <h4>subTitleH4</h4>
30
+ <p>honbun</p>
31
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
32
+ </div>
33
+ EOF
34
+ end
35
+ it { @diary.to_html.should eq @html }
36
+ end
37
+ end
38
+
39
+ describe '#replace' do
40
+ before do
41
+ source = <<-'EOF'
42
+ = subTitle
43
+ honbun
44
+
45
+ == subTitleH4
46
+ honbun
47
+
48
+ EOF
49
+ @diary.append(source)
50
+
51
+ replaced = <<-'EOF'
52
+ = replaceTitle
53
+ replace
54
+
55
+ == replaceTitleH4
56
+ replace
57
+
58
+ EOF
59
+ @diary.replace(Time::at( 1041346800 ), "TITLE", replaced)
60
+
61
+ @html = <<-'EOF'
62
+ <div class="section">
63
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
64
+ <h3><%= subtitle_proc( Time::at( 1041346800 ), "replaceTitle" ) %></h3>
65
+ <p>replace</p>
66
+ <h4>replaceTitleH4</h4>
67
+ <p>replace</p>
68
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
69
+ </div>
70
+ EOF
71
+ end
72
+ it { @diary.to_html.should eq @html }
73
+ end
74
+
75
+ describe '#add_section' do
76
+ before do
77
+ source = <<-'EOF'
78
+ = subTitle
79
+ honbun
80
+
81
+ == subTitleH4
82
+ honbun
83
+
84
+ EOF
85
+ @diary.append(source)
86
+ @diary.add_section('subTitle2', 'honbun')
87
+
88
+ @html = <<-'EOF'
89
+ <div class="section">
90
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
91
+ <h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle" ) %></h3>
92
+ <p>honbun</p>
93
+ <h4>subTitleH4</h4>
94
+ <p>honbun</p>
95
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
96
+ </div>
97
+ <div class="section">
98
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
99
+ <h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle2" ) %></h3>
100
+ <p>honbun</p>
101
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
102
+ </div>
103
+ EOF
104
+ end
105
+ it { @diary.to_html.should eq @html }
106
+ end
107
+
108
+ describe '#delete_section' do
109
+ before do
110
+ source = <<-'EOF'
111
+ = subTitle
112
+ honbun
113
+
114
+ = subTitle2
115
+ honbun
116
+
117
+ EOF
118
+ @diary.append(source)
119
+ @diary.delete_section(1)
120
+
121
+ @html = <<-'EOF'
122
+ <div class="section">
123
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
124
+ <h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle2" ) %></h3>
125
+ <p>honbun</p>
126
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
127
+ </div>
128
+ EOF
129
+ end
130
+ it { @diary.to_html.should eq @html }
131
+ end
132
+
133
+ describe 'test_rd_style_plugin' do
134
+ before do
135
+ source = <<-'EOF'
136
+ = subTitle
137
+ ((%plugin%))
138
+ ((%plugin%))
139
+ aaa
140
+
141
+ ((%plugin%))
142
+
143
+ a((%ho
144
+ ge%))b
145
+
146
+ ((%ho
147
+ ge%))
148
+ EOF
149
+ @diary.append(source)
150
+ end
151
+
152
+ context 'HTML' do
153
+ before do
154
+ @html = <<-'EOF'
155
+ <div class="section">
156
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
157
+ <h3><%= subtitle_proc( Time::at( 1041346800 ), "subTitle" ) %></h3>
158
+ <p><%=plugin %>
159
+ <%=plugin %>
160
+ aaa</p>
161
+ <p><%=plugin %></p>
162
+ <p>a<%=ho ge%>b</p>
163
+ <p><%=ho ge%></p>
164
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
165
+ </div>
166
+ EOF
167
+ end
168
+ it { @diary.to_html.should eq @html }
169
+ end
170
+ end
171
+
172
+ describe 'fn' do
173
+ context 'my' do
174
+ before do
175
+ source = <<-'EOF'
176
+ ((-((<20130714>))-))
177
+ EOF
178
+ @diary.append(source)
179
+ end
180
+
181
+ before do
182
+ @html = <<-'EOF'
183
+ <div class="section">
184
+ <%=section_enter_proc( Time::at( 1041346800 ))%>
185
+ <p><%=fn apply_plugin( "<%=my \"20130714\",\"20130714\"%%>" ) %></p>
186
+ <%=section_leave_proc( Time::at( 1041346800 ))%>
187
+ </div>
188
+ EOF
189
+ end
190
+ it { @diary.to_html.should eq @html }
191
+ end
192
+ end
193
+
194
+ describe 'test_rd_on_error' do
195
+ context 'link' do
196
+ before do
197
+ source = <<-'EOF'
198
+ ((<tdiary|http://www.tdiary.org/>))
199
+ EOF
200
+ @diary.append(source)
201
+ @exception_message = <<-'EOF'
202
+ RD syntax error: line 1:
203
+ ...((<tdiary|http:/ / www.tdiary.org/>)) ...
204
+ ^
205
+ EOF
206
+ end
207
+ it {
208
+ lambda{ @diary.to_html }.should raise_error(SyntaxError){ |e|
209
+ e.message.should eq @exception_message
210
+ }
211
+ }
212
+ end
213
+ end
214
+ end
215
+
216
+ # Local Variables:
217
+ # mode: ruby
218
+ # indent-tabs-mode: t
219
+ # tab-width: 3
220
+ # ruby-indent-level: 3
221
+ # End:
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tdiary/style/rd/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tdiary-style-rd"
8
+ spec.version = Tdiary::Style::Rd::VERSION
9
+ spec.authors = ["SHIBATA Hiroshi"]
10
+ spec.email = ["shibata.hiroshi@gmail.com"]
11
+ spec.description = %q{RD Style for tDiary}
12
+ spec.summary = %q{RD Style for tDiary}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rdtool"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tdiary-style-rd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - SHIBATA Hiroshi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rdtool
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: RD Style for tDiary
70
+ email:
71
+ - shibata.hiroshi@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - lib/tdiary/style/rd.rb
84
+ - lib/tdiary/style/rd/version.rb
85
+ - spec/spec_helper.rb
86
+ - spec/tdiary/style/rd_spec.rb
87
+ - tdiary-style-rd.gemspec
88
+ homepage: ''
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.1.3
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: RD Style for tDiary
112
+ test_files:
113
+ - spec/spec_helper.rb
114
+ - spec/tdiary/style/rd_spec.rb
115
+ has_rdoc: