tdiary 4.0.1 → 4.0.1.20130903
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/misc/plugin/title_tag.rb +15 -13
- data/misc/style/emptdiary/emptdiary_style.rb +95 -93
- data/misc/style/etdiary/etdiary_style.rb +364 -362
- data/misc/style/gfm/gfm_style.rb +129 -127
- data/misc/style/rd/rd_style.rb +158 -157
- data/spec/acceptance_helper.rb +2 -2
- data/spec/core/configuration_spec.rb +32 -0
- data/spec/core/style/emptdiary_style_spec.rb +2 -2
- data/spec/core/style/etdiary_style_spec.rb +2 -2
- data/spec/core/style/gfm_style_spec.rb +2 -2
- data/spec/core/style/rd_style_spec.rb +2 -2
- data/spec/core/style/tdiary_style_spec.rb +2 -2
- data/spec/core/style/wiki_style_spec.rb +2 -2
- data/tdiary.rb +7 -5
- data/tdiary/{config.rb → configuration.rb} +71 -69
- data/tdiary/io/base.rb +1 -1
- data/tdiary/io/pstore.rb +1 -1
- data/tdiary/style.rb +142 -148
- data/tdiary/style/tdiary_style.rb +149 -147
- data/tdiary/style/wiki_style.rb +167 -165
- data/tdiary/tasks/release.rake +40 -27
- data/tdiary/version.rb +1 -1
- metadata +5 -3
data/misc/style/gfm/gfm_style.rb
CHANGED
@@ -28,159 +28,161 @@ class HTMLwithPygments < Redcarpet::Render::HTML
|
|
28
28
|
end
|
29
29
|
|
30
30
|
module TDiary
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
def subtitle=(subtitle)
|
50
|
-
@subtitle = (subtitle || '').sub(/^# /,"\##{categories_to_string} ")
|
51
|
-
@strip_subtitle = strip_subtitle
|
52
|
-
end
|
31
|
+
module Style
|
32
|
+
class GfmSection
|
33
|
+
include BaseSection
|
34
|
+
include Twitter::Autolink
|
35
|
+
|
36
|
+
def initialize(fragment, author = nil)
|
37
|
+
@author = author
|
38
|
+
@subtitle, @body = fragment.split(/\n/, 2)
|
39
|
+
@subtitle.sub!(/^\#\s*/,'')
|
40
|
+
@body ||= ''
|
41
|
+
|
42
|
+
@categories = get_categories
|
43
|
+
@stripped_subtitle = strip_subtitle
|
44
|
+
|
45
|
+
@subtitle_to_html = @subtitle ? to_html('# ' + @subtitle).gsub(/\A<h\d>|<\/h\d>\z/io, '') : nil
|
46
|
+
@stripped_subtitle_to_html = @stripped_subtitle ? to_html('# ' + @stripped_subtitle).gsub(/\A<h\d>|<\/h\d>\z/io, '') : nil
|
47
|
+
@body_to_html = to_html(@body)
|
48
|
+
end
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
def subtitle=(subtitle)
|
51
|
+
@subtitle = (subtitle || '').sub(/^# /,"\##{categories_to_string} ")
|
52
|
+
@strip_subtitle = strip_subtitle
|
53
|
+
end
|
58
54
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
55
|
+
def categories=(categories)
|
56
|
+
@subtitle = "#{categories_to_string} " + (strip_subtitle || '')
|
57
|
+
@strip_subtitle = strip_subtitle
|
58
|
+
end
|
64
59
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
def to_src
|
61
|
+
r = ''
|
62
|
+
r << "\# #{@subtitle}\n" if @subtitle
|
63
|
+
r << @body
|
69
64
|
end
|
70
|
-
|
71
|
-
|
65
|
+
|
66
|
+
def do_html4(date, idx, opt)
|
67
|
+
subtitle = to_html('# ' + @subtitle)
|
68
|
+
subtitle.sub!( %r!<h3>(.+?)</h3>!m ) do
|
69
|
+
"<h3><%= subtitle_proc( Time.at( #{date.to_i} ), #{$1.dump.gsub( /%/, '\\\\045' )} ) %></h3>"
|
70
|
+
end
|
71
|
+
if opt['multi_user'] and @author then
|
72
|
+
subtitle.sub!(/<\/h3>/,%Q|[#{@author}]</h3>|)
|
73
|
+
end
|
74
|
+
r = subtitle
|
75
|
+
r << @body_to_html
|
72
76
|
end
|
73
|
-
r = subtitle
|
74
|
-
r << @body_to_html
|
75
|
-
end
|
76
77
|
|
77
|
-
|
78
|
+
private
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
def to_html(string)
|
81
|
+
renderer = HTMLwithPygments.new(:hard_wrap => true)
|
82
|
+
extensions = {:fenced_code_blocks => true, :tables => true, :no_intra_emphasis => true}
|
83
|
+
r = Redcarpet::Markdown.new(renderer, extensions).render(string)
|
83
84
|
|
84
|
-
|
85
|
-
|
85
|
+
# Twitter Autolink
|
86
|
+
r = auto_link(r)
|
86
87
|
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
if r =~ /(<pre>|<code>)/
|
89
|
+
r.gsub!(/<a class=\"tweet-url username\" href=\".*?\">(.*?)<\/a>/){ $1 }
|
90
|
+
end
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
# except url autolink in plugin block
|
93
|
+
if r =~ /\{\{.+?\}\}/
|
94
|
+
r.gsub!(/<a href=\"(.*?)\" rel=\"nofollow\">.*?<\/a>/){ $1 }
|
95
|
+
r.gsub!(/\{\{(.+?)\}\}/) { "<%=#{CGI.unescapeHTML($1).gsub(/'/, "'").gsub(/"/, '"')}%>" }
|
96
|
+
end
|
96
97
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
98
|
+
# ignore duplicate autolink
|
99
|
+
if r =~ /<a href="<a href="/
|
100
|
+
r.gsub!(/<a href="<a href=".*?" rel="nofollow">(.*?)<\/a>"(.*?)>(.*?)<\/a>/) do
|
101
|
+
"<a href=\"#{$1}\" rel=\"nofollow\"#{$2}>#{$3}</a>"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
# ignore auto imagelink
|
105
|
+
if r =~ /<img src="<a href="/
|
106
|
+
r.gsub!(/<img src="<a href=".*?" rel="nofollow">(.*?)<\/a>"(?: alt="(.*?)")?>/){ "<img src=\"#{$1}\" alt=\"#{$2}\">" }
|
107
|
+
end
|
107
108
|
|
108
|
-
|
109
|
-
|
109
|
+
# emoji
|
110
|
+
r = r.emojify
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
# diary anchor
|
113
|
+
r.gsub!(/<h(\d)/) { "<h#{$1.to_i + 2}" }
|
114
|
+
r.gsub!(/<\/h(\d)/) { "</h#{$1.to_i + 2}" }
|
114
115
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
116
|
+
# my syntax
|
117
|
+
r.gsub!(/\((.*?)\)\[(\d{4}|\d{6}|\d{8}|\d{8}-\d+)[^\d]*?#?([pct]\d+)?\]/) {
|
118
|
+
unless $1.empty?
|
119
|
+
%Q|<%=my "#{$2}#{$3}", "#{$1}" %>|
|
120
|
+
else
|
121
|
+
%Q|<%=my "#{$2}#{$3}", "#{$2}#{$3}" %>|
|
122
|
+
end
|
123
|
+
}
|
123
124
|
|
124
|
-
|
125
|
-
|
125
|
+
r
|
126
|
+
end
|
126
127
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
128
|
+
def get_categories
|
129
|
+
return [] unless @subtitle
|
130
|
+
cat = /(\\?\[([^\[]+?)\\?\])+/.match(@subtitle).to_a[0]
|
131
|
+
return [] unless cat
|
132
|
+
cat.scan(/\\?\[(.*?)\\?\]/).collect do |c|
|
133
|
+
c[0].split(/,/)
|
134
|
+
end.flatten
|
135
|
+
end
|
135
136
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
137
|
+
def strip_subtitle
|
138
|
+
return nil unless @subtitle
|
139
|
+
r = @subtitle.sub(/^((\\?\[[^\[]+?\]\\?)+\s+)?/, '')
|
140
|
+
if r.empty?
|
141
|
+
nil
|
142
|
+
else
|
143
|
+
r
|
144
|
+
end
|
143
145
|
end
|
144
146
|
end
|
145
|
-
end
|
146
147
|
|
147
|
-
|
148
|
-
|
149
|
-
|
148
|
+
class GfmDiary
|
149
|
+
include BaseDiary
|
150
|
+
include CategorizableDiary
|
150
151
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
152
|
+
def initialize(date, title, body, modified = Time.now)
|
153
|
+
init_diary
|
154
|
+
replace( date, title, body )
|
155
|
+
@last_modified = modified
|
156
|
+
end
|
156
157
|
|
157
|
-
|
158
|
-
|
159
|
-
|
158
|
+
def style
|
159
|
+
'GFM'
|
160
|
+
end
|
160
161
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
162
|
+
def append(body, author = nil)
|
163
|
+
section = nil
|
164
|
+
body.each_line do |l|
|
165
|
+
case l
|
166
|
+
when /^\#[^\#]/
|
167
|
+
@sections << GfmSection.new(section, author) if section
|
168
|
+
section = l
|
169
|
+
else
|
170
|
+
section = '' unless section
|
171
|
+
section << l
|
172
|
+
end
|
171
173
|
end
|
174
|
+
if section
|
175
|
+
section << "\n" unless section =~ /\n\n\z/
|
176
|
+
@sections << GfmSection.new(section, author)
|
177
|
+
end
|
178
|
+
@last_modified = Time.now
|
179
|
+
self
|
172
180
|
end
|
173
|
-
if section
|
174
|
-
section << "\n" unless section =~ /\n\n\z/
|
175
|
-
@sections << GfmSection.new(section, author)
|
176
|
-
end
|
177
|
-
@last_modified = Time.now
|
178
|
-
self
|
179
|
-
end
|
180
181
|
|
181
|
-
|
182
|
-
|
183
|
-
|
182
|
+
def add_section(subtitle, body)
|
183
|
+
@sections = GfmSection.new("\# #{subtitle}\n\n#{body}")
|
184
|
+
@sections.size
|
185
|
+
end
|
184
186
|
end
|
185
187
|
end
|
186
188
|
end
|
data/misc/style/rd/rd_style.rb
CHANGED
@@ -55,11 +55,11 @@ module RD
|
|
55
55
|
|
56
56
|
def apply_to_DescListItem(element, term, description)
|
57
57
|
%Q[<dt>#{term.join}</dt>] +
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
if description.empty? then
|
59
|
+
"\n"
|
60
|
+
else
|
61
|
+
%Q[\n<dd>\n#{description.join("\n").chomp}\n</dd>]
|
62
|
+
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def apply_to_MethodList(element, items)
|
@@ -129,7 +129,7 @@ module RD
|
|
129
129
|
|
130
130
|
if cat
|
131
131
|
r =
|
132
|
-
|
132
|
+
cat.scan(/\[(.*?)\]/).collect do |c|
|
133
133
|
%Q|<%= category_anchor("#{c[0]}") %>|
|
134
134
|
end.join + subtitle
|
135
135
|
else
|
@@ -187,173 +187,175 @@ MSG
|
|
187
187
|
end
|
188
188
|
|
189
189
|
module TDiary
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
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
|
204
245
|
end
|
205
|
-
@body = @body || ''
|
206
|
-
@body.sub!( /[\n\r]+\Z/, '' )
|
207
|
-
@body << "\n\n"
|
208
246
|
|
209
|
-
|
210
|
-
|
247
|
+
def to_src
|
248
|
+
r = ''
|
249
|
+
r << "= #{@subtitle}\n" if @subtitle
|
250
|
+
r << @body
|
251
|
+
end
|
211
252
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
cat_str << " " unless cat_str.empty?
|
223
|
-
@subtitle = subtitle ? (cat_str + subtitle) : nil
|
224
|
-
@stripped_subtitle = strip_subtitle
|
225
|
-
end
|
226
|
-
|
227
|
-
def body=(str)
|
228
|
-
@body = str
|
229
|
-
end
|
230
|
-
|
231
|
-
def body
|
232
|
-
@body.dup
|
233
|
-
end
|
234
|
-
|
235
|
-
def categories=(categories)
|
236
|
-
@categories = categories
|
237
|
-
cat_str = ""
|
238
|
-
categories.each {|cat|
|
239
|
-
cat_str << "[#{cat}]"
|
240
|
-
}
|
241
|
-
cat_str << " " unless cat_str.empty?
|
242
|
-
@subtitle = @subtitle ? (cat_str + @stripped_subtitle) : nil
|
243
|
-
@stripped_subtitle = strip_subtitle
|
244
|
-
end
|
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
|
245
263
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
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
|
251
272
|
|
252
|
-
|
253
|
-
if mode == :CHTML
|
254
|
-
visitor = RD2tDiaryCHTMLVistor.new( date, idx, opt, @author)
|
255
|
-
section_open = "<%=section_enter_proc( Time::at( #{date.to_i} ))%>\n"
|
256
|
-
section_close = "<%=section_leave_proc( Time::at( #{date.to_i} ))%>\n"
|
257
|
-
else
|
258
|
-
visitor = RD2tDiaryVisitor.new( date, idx, opt, @author )
|
259
|
-
section_open = %Q[<div class="section">\n<%=section_enter_proc( Time::at( #{date.to_i} ))%>\n]
|
260
|
-
section_close = "<%=section_leave_proc( Time::at( #{date.to_i} ))%>\n</div>\n"
|
273
|
+
r = "#{section_open}#{visitor.visit( tree )}#{section_close}"
|
261
274
|
end
|
262
275
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
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
|
270
289
|
end
|
271
290
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
visitor = RD2tDiaryVisitor.new
|
280
|
-
tree = RDTree.new(src, nil, nil)
|
281
|
-
begin
|
282
|
-
r = visitor.visit( tree.parse )
|
283
|
-
r.gsub!(/<\/?p>/, '') if subtitle
|
284
|
-
r
|
285
|
-
rescue ParseError
|
286
|
-
str
|
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
|
287
298
|
end
|
288
|
-
end
|
289
|
-
|
290
|
-
def get_categories
|
291
|
-
return [] unless @subtitle
|
292
|
-
cat = /^(\[(.*?)\])+/.match(@subtitle).to_a[0]
|
293
|
-
return [] unless cat
|
294
|
-
cat.scan(/\[(.*?)\]/).collect do |c|
|
295
|
-
c[0].split(/,/)
|
296
|
-
end.flatten
|
297
|
-
end
|
298
299
|
|
299
|
-
|
300
|
-
|
301
|
-
|
300
|
+
def strip_subtitle
|
301
|
+
return nil unless @subtitle
|
302
|
+
@subtitle.sub(/^(\[(.*?)\])+/,'')
|
303
|
+
end
|
302
304
|
end
|
303
|
-
end
|
304
305
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
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
|
331
333
|
end
|
334
|
+
@sections << RDSection::new( section, author ) if section
|
335
|
+
@last_modified = Time::now
|
336
|
+
self
|
332
337
|
end
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
r << section.html( date, idx, opt, mode )
|
351
|
-
idx += 1
|
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
|
352
355
|
end
|
353
|
-
return r
|
354
|
-
end
|
355
356
|
|
356
|
-
|
357
|
+
undef :to_html4, :to_chtml
|
358
|
+
end
|
357
359
|
end
|
358
360
|
end
|
359
361
|
|
@@ -363,4 +365,3 @@ end
|
|
363
365
|
# tab-width: 3
|
364
366
|
# ruby-indent-level: 3
|
365
367
|
# End:
|
366
|
-
|