bluefeather 0.22 → 0.30
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/author-and-license.html +1 -1
- data/doc/en/author-and-license.html +1 -1
- data/doc/en/index.bfdoc +1 -1
- data/doc/en/index.html +1 -1
- data/doc/index.bfdoc +1 -1
- data/doc/index.html +1 -1
- data/doc/metadata-reference.bfdoc +42 -1
- data/doc/metadata-reference.html +47 -1
- data/lib/bluefeather.rb +68 -6
- data/spec/numbering.rb +58 -0
- data/spec/toc.rb +111 -62
- metadata +3 -2
data/doc/author-and-license.html
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
<li><a href="http://ja.wikipedia.org/wiki/GNU_General_Public_License">Wikipedia - GNU General Public License</a></li>
|
19
19
|
</ul>
|
20
20
|
|
21
|
-
<p>BlueFeather への要望、ご意見、バグ報告などがありましたら、<a href="http://ruby.morphball.net/bluefeather/">BlueFeather 配布サイト</a>よりメッセージを送信していただくか、もしくは Dice(<a href="m&#
|
21
|
+
<p>BlueFeather への要望、ご意見、バグ報告などがありましたら、<a href="http://ruby.morphball.net/bluefeather/">BlueFeather 配布サイト</a>よりメッセージを送信していただくか、もしくは Dice(<a href="mailto:tetradice@gmail.com">tetradice@gmail.com</a>)までメールでご連絡していただけるよう、よろしくお願いします。</p>
|
22
22
|
|
23
23
|
</body>
|
24
24
|
</html>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<p>If you want to send requests, comments, or bug reports to BlueFeather, please
|
25
25
|
feel free to post messages from
|
26
26
|
<a href="http://ruby.morphball.net/bluefeather/index_en.html">http://ruby.morphball.net/bluefeather/index_en.html</a> or to send mail to Dice.
|
27
|
-
(<a href="
|
27
|
+
(<a href="mailto:tetradice@gmail.com">tetradice@gmail.com</a>)</p>
|
28
28
|
|
29
29
|
</body>
|
30
30
|
</html>
|
data/doc/en/index.bfdoc
CHANGED
@@ -10,7 +10,7 @@ BlueFeather Manual
|
|
10
10
|
|
11
11
|
-> [Japanese version (original)](../index.html)
|
12
12
|
|
13
|
-
(2009-
|
13
|
+
(2009-08-01: this document based on version 0.30)
|
14
14
|
|
15
15
|
BlueFeather is software for converting text written by extended Markdown like
|
16
16
|
[PHP Markdown Extra][] to html. It is pair of command-line tool and pure Ruby
|
data/doc/en/index.html
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
<p>-> <a href="../index.html">Japanese version (original)</a></p>
|
14
14
|
|
15
|
-
<p>(2009-
|
15
|
+
<p>(2009-08-01: this document based on version 0.30)</p>
|
16
16
|
|
17
17
|
<p>BlueFeather is software for converting text written by extended Markdown like
|
18
18
|
<a href="http://michelf.com/projects/php-markdown/extra/">PHP Markdown Extra</a> to html. It is pair of command-line tool and pure Ruby
|
data/doc/index.bfdoc
CHANGED
data/doc/index.html
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
<p>→ <a href="en/index.html">English version</a></p>
|
15
15
|
|
16
|
-
<p>(2009-
|
16
|
+
<p>(2009-08-01 バージョン 0.30 準拠)</p>
|
17
17
|
|
18
18
|
<p>BlueFeather は、拡張 Markdown 記法で書かれたテキストを html に変換するソフトウェアです。
|
19
19
|
コマンドラインツールと、Ruby スクリプト内で変換を行うためのライブラリがセットになっています。</p>
|
@@ -64,7 +64,7 @@ html の head 要素内に出力される Content-Type の値、および変換
|
|
64
64
|
Atom-Feed: example.xml
|
65
65
|
|
66
66
|
|
67
|
-
ニュースフィードの URL。生成される html 文書の head 要素内に、以下のようなリンクが付け加えられ、RSS
|
67
|
+
ニュースフィードの URL。生成される html 文書の head 要素内に、以下のようなリンクが付け加えられ、RSS リーダーなどでそのページを簡単に登録できるようになる(オートディスカバリー)。
|
68
68
|
|
69
69
|
<link rel="alternate" type="application/atom+xml" href="example.xml" />
|
70
70
|
|
@@ -84,3 +84,44 @@ html の head 要素内に出力される Content-Type の値、および変換
|
|
84
84
|
Description: にんじん,レシピ,料理
|
85
85
|
|
86
86
|
その文書を表すキーワード。`<meta name="keywords" content="~">` の内容になる。
|
87
|
+
|
88
|
+
|
89
|
+
### Numbering: {#numbering}
|
90
|
+
|
91
|
+
Numbering: yes
|
92
|
+
|
93
|
+
*BlueFeather 0.30以降*でのみ有効。
|
94
|
+
|
95
|
+
yes, true, on, 1のいずれかを指定すると、レベル2以降の見出し(h2~h6)に、自動で番号が振られるようになる。
|
96
|
+
|
97
|
+
使用例:
|
98
|
+
|
99
|
+
Numbering: yes
|
100
|
+
|
101
|
+
# 見出し1
|
102
|
+
## 見出し2a
|
103
|
+
## 見出し2b
|
104
|
+
### 見出し3a
|
105
|
+
### 見出し3b
|
106
|
+
## 見出し2c
|
107
|
+
|
108
|
+
~
|
109
|
+
|
110
|
+
<h1>見出し1</h1>
|
111
|
+
<h2>1. 見出し2a</h2>
|
112
|
+
<h2>2. 見出し2b</h2>
|
113
|
+
<h3>2.1. 見出し3a</h3>
|
114
|
+
<h3>2.2. 見出し3b</h3>
|
115
|
+
<h2>3. 見出し2c</h2>
|
116
|
+
|
117
|
+
### Numbering-Start-Level: {#numbering-start-level}
|
118
|
+
|
119
|
+
Numbering: yes
|
120
|
+
Numbering-Start-Level: 3
|
121
|
+
|
122
|
+
*BlueFeather 0.30以降*でのみ有効。
|
123
|
+
|
124
|
+
見出しへの番号付けを行うとき、どのレベルの見出しから番号付けの対象とするのかを指定する。
|
125
|
+
[Numbering:](#numbering)ヘッダーと同時に使われているときのみ有効。
|
126
|
+
|
127
|
+
省略した場合、レベル2以降の見出し(h2~h6)が番号付けの対象になる。
|
data/doc/metadata-reference.html
CHANGED
@@ -38,6 +38,8 @@ Atom-Feed: info/atom.xml
|
|
38
38
|
<li><a href="#rss-feed" rel="toc">RSS-Feed:</a></li>
|
39
39
|
<li><a href="#description" rel="toc">Description:</a></li>
|
40
40
|
<li><a href="#keywords" rel="toc">Keywords:</a></li>
|
41
|
+
<li><a href="#numbering" rel="toc">Numbering:</a></li>
|
42
|
+
<li><a href="#numbering-start-level" rel="toc">Numbering-Start-Level:</a></li>
|
41
43
|
</ul></li>
|
42
44
|
</ul>
|
43
45
|
|
@@ -82,7 +84,7 @@ html の head 要素内に出力される Content-Type の値、および変換
|
|
82
84
|
<pre><code>Atom-Feed: example.xml
|
83
85
|
</code></pre>
|
84
86
|
|
85
|
-
<p>ニュースフィードの URL。生成される html 文書の head 要素内に、以下のようなリンクが付け加えられ、RSS
|
87
|
+
<p>ニュースフィードの URL。生成される html 文書の head 要素内に、以下のようなリンクが付け加えられ、RSS リーダーなどでそのページを簡単に登録できるようになる(オートディスカバリー)。</p>
|
86
88
|
|
87
89
|
<pre><code><link rel="alternate" type="application/atom+xml" href="example.xml" />
|
88
90
|
</code></pre>
|
@@ -104,5 +106,49 @@ html の head 要素内に出力される Content-Type の値、および変換
|
|
104
106
|
|
105
107
|
<p>その文書を表すキーワード。<code><meta name="keywords" content="~"></code> の内容になる。</p>
|
106
108
|
|
109
|
+
<h3 id="numbering">Numbering:</h3>
|
110
|
+
|
111
|
+
<pre><code>Numbering: yes
|
112
|
+
</code></pre>
|
113
|
+
|
114
|
+
<p><em>BlueFeather 0.30以降</em>でのみ有効。</p>
|
115
|
+
|
116
|
+
<p>yes, true, on, 1のいずれかを指定すると、レベル2以降の見出し(h2~h6)に、自動で番号が振られるようになる。</p>
|
117
|
+
|
118
|
+
<p>使用例:</p>
|
119
|
+
|
120
|
+
<pre><code>Numbering: yes
|
121
|
+
|
122
|
+
# 見出し1
|
123
|
+
## 見出し2a
|
124
|
+
## 見出し2b
|
125
|
+
### 見出し3a
|
126
|
+
### 見出し3b
|
127
|
+
## 見出し2c
|
128
|
+
</code></pre>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<pre><code><h1>見出し1</h1>
|
133
|
+
<h2>1. 見出し2a</h2>
|
134
|
+
<h2>2. 見出し2b</h2>
|
135
|
+
<h3>2.1. 見出し3a</h3>
|
136
|
+
<h3>2.2. 見出し3b</h3>
|
137
|
+
<h2>3. 見出し2c</h2>
|
138
|
+
</code></pre>
|
139
|
+
|
140
|
+
<h3 id="numbering-start-level">Numbering-Start-Level:</h3>
|
141
|
+
|
142
|
+
<pre><code>Numbering: yes
|
143
|
+
Numbering-Start-Level: 3
|
144
|
+
</code></pre>
|
145
|
+
|
146
|
+
<p><em>BlueFeather 0.30以降</em>でのみ有効。</p>
|
147
|
+
|
148
|
+
<p>見出しへの番号付けを行うとき、どのレベルの見出しから番号付けの対象とするのかを指定する。
|
149
|
+
<a href="#numbering">Numbering:</a>ヘッダーと同時に使われているときのみ有効。</p>
|
150
|
+
|
151
|
+
<p>省略した場合、レベル2以降の見出し(h2~h6)が番号付けの対象になる。</p>
|
152
|
+
|
107
153
|
</body>
|
108
154
|
</html>
|
data/lib/bluefeather.rb
CHANGED
@@ -42,9 +42,9 @@ require 'uri'
|
|
42
42
|
|
43
43
|
|
44
44
|
module BlueFeather
|
45
|
-
VERSION = '0.
|
46
|
-
VERSION_NUMBER = 0.
|
47
|
-
RELEASE_DATE = '2009-
|
45
|
+
VERSION = '0.30'
|
46
|
+
VERSION_NUMBER = 0.30
|
47
|
+
RELEASE_DATE = '2009-08-01'
|
48
48
|
VERSION_LABEL = "#{VERSION} (#{RELEASE_DATE})"
|
49
49
|
|
50
50
|
UTF8_BOM = "\xef\xbb\xbf"
|
@@ -188,7 +188,7 @@ module BlueFeather
|
|
188
188
|
end
|
189
189
|
|
190
190
|
class Document
|
191
|
-
HEADER_PATTERN = /^(.+?)\s*\:\s*(
|
191
|
+
HEADER_PATTERN = /^(.+?)\s*\:\s*(.+?)\s*(?:\n|\Z)/
|
192
192
|
BLANK_LINE_PATTERN = /^\n/
|
193
193
|
HEADER_SEQUEL_PATTERN = /^\s+(.+)$/
|
194
194
|
|
@@ -304,6 +304,26 @@ module BlueFeather
|
|
304
304
|
@headers['css']
|
305
305
|
end
|
306
306
|
|
307
|
+
def numbering
|
308
|
+
case @headers['numbering']
|
309
|
+
when 'yes', '1', 'true', 'on'
|
310
|
+
true
|
311
|
+
else
|
312
|
+
false
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
alias numbering? numbering
|
317
|
+
|
318
|
+
def numbering_start_level
|
319
|
+
level = (@headers['numbering-start-level'] || 2).to_i
|
320
|
+
if level >= 1 and level <= 6 then
|
321
|
+
return level
|
322
|
+
else
|
323
|
+
return 2
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
307
327
|
def encoding_type
|
308
328
|
(@headers['encoding'] ? @headers['encoding'].downcase : 'utf-8')
|
309
329
|
end
|
@@ -332,6 +352,8 @@ module BlueFeather
|
|
332
352
|
# BlueFeather Extension
|
333
353
|
attr_accessor :footnotes, :found_footnote_ids, :warnings
|
334
354
|
attr_accessor :headers, :block_transform_depth
|
355
|
+
attr_accessor :numbering, :numbering_start_level # option switch
|
356
|
+
alias numbering? numbering
|
335
357
|
|
336
358
|
def initialize
|
337
359
|
@urls, @titles, @html_blocks = {}, {}, {}
|
@@ -339,6 +361,8 @@ module BlueFeather
|
|
339
361
|
@footnotes, @found_footnote_ids, @warnings = {}, [], []
|
340
362
|
@headers = []
|
341
363
|
@block_transform_depth = 0
|
364
|
+
@numbering = false
|
365
|
+
@numbering_start_level = 2
|
342
366
|
end
|
343
367
|
|
344
368
|
end
|
@@ -524,6 +548,10 @@ module BlueFeather
|
|
524
548
|
|
525
549
|
def document_to_html(doc)
|
526
550
|
rs = RenderState.new
|
551
|
+
if doc.numbering? then
|
552
|
+
rs.numbering = true
|
553
|
+
end
|
554
|
+
rs.numbering_start_level = doc.numbering_start_level
|
527
555
|
|
528
556
|
body_html = nil
|
529
557
|
|
@@ -964,7 +992,12 @@ module BlueFeather
|
|
964
992
|
rs.warnings << "illegal TOC parameter - #{param} (valid example: 'h2..h4')"
|
965
993
|
end
|
966
994
|
end
|
967
|
-
|
995
|
+
|
996
|
+
if rs.headers.first and rs.headers.first.level >= (start_level + 1) then
|
997
|
+
rs.warnings << "illegal structure of headers - h#{start_level} should be set before h#{rs.headers.first.level}"
|
998
|
+
end
|
999
|
+
|
1000
|
+
|
968
1001
|
ul_text = "\n\n"
|
969
1002
|
rs.headers.each do |header|
|
970
1003
|
if header.level >= start_level and header.level <= end_level then
|
@@ -976,7 +1009,8 @@ module BlueFeather
|
|
976
1009
|
end
|
977
1010
|
ul_text << "\n"
|
978
1011
|
|
979
|
-
ul_text
|
1012
|
+
ul_text # output
|
1013
|
+
|
980
1014
|
}
|
981
1015
|
end
|
982
1016
|
|
@@ -1474,6 +1508,9 @@ module BlueFeather
|
|
1474
1508
|
# Header 2
|
1475
1509
|
# --------
|
1476
1510
|
#
|
1511
|
+
|
1512
|
+
section_numbers = [nil, nil, nil, nil, nil]
|
1513
|
+
|
1477
1514
|
str.
|
1478
1515
|
gsub( HeaderRegexp ) {|m|
|
1479
1516
|
if $1 then
|
@@ -1496,6 +1533,31 @@ module BlueFeather
|
|
1496
1533
|
end
|
1497
1534
|
end
|
1498
1535
|
|
1536
|
+
if rs.numbering? then
|
1537
|
+
if level >= rs.numbering_start_level and level <= 6 then
|
1538
|
+
depth = level - rs.numbering_start_level
|
1539
|
+
|
1540
|
+
section_numbers.each_index do |i|
|
1541
|
+
if i == depth and section_numbers[depth] then
|
1542
|
+
# increment a deepest number if current header's level equals last header's
|
1543
|
+
section_numbers[i] += 1
|
1544
|
+
elsif i <= depth then
|
1545
|
+
# set default number if nil
|
1546
|
+
section_numbers[i] ||= 1
|
1547
|
+
else
|
1548
|
+
# clear discardeds
|
1549
|
+
section_numbers[i] = nil
|
1550
|
+
end
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
no = ''
|
1554
|
+
(0..depth).each do |i|
|
1555
|
+
no << "#{section_numbers[i]}."
|
1556
|
+
end
|
1557
|
+
|
1558
|
+
title = "#{no} #{title}"
|
1559
|
+
end
|
1560
|
+
end
|
1499
1561
|
|
1500
1562
|
title_html = apply_span_transforms( title, rs )
|
1501
1563
|
id ||= "bfheader-#{Digest::MD5.hexdigest(title)}"
|
data/spec/numbering.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require(Pathname.new(__FILE__).parent + 'lib/common.rb')
|
3
|
+
|
4
|
+
|
5
|
+
describe 'Numbering:' do
|
6
|
+
before(:each) do
|
7
|
+
@src = <<MARKDOWN
|
8
|
+
Numbering: #{@numbering}
|
9
|
+
Numbering-Start-Level: #{@start_level}
|
10
|
+
|
11
|
+
# h1
|
12
|
+
## h2a
|
13
|
+
## h2b
|
14
|
+
### h3a
|
15
|
+
### h3b
|
16
|
+
## h2c
|
17
|
+
MARKDOWN
|
18
|
+
|
19
|
+
@html = BlueFeather.parse_document(@src)
|
20
|
+
@doc = Hpricot(@html)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
describe "yes:" do
|
25
|
+
before(:all) do
|
26
|
+
@numbering, @start_level = 'yes ', ''
|
27
|
+
end
|
28
|
+
|
29
|
+
specify "numbering" do
|
30
|
+
@doc.at('h1').inner_text.should == 'h1'
|
31
|
+
|
32
|
+
elems = @doc.search('h2')
|
33
|
+
elems.map{|x| x.inner_text}.should == ['1. h2a', '2. h2b', '3. h2c']
|
34
|
+
|
35
|
+
elems = @doc.search('h3')
|
36
|
+
elems.map{|x| x.inner_text}.should == ['2.1. h3a', '2.2. h3b']
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "yes (start=3):" do
|
42
|
+
before(:all) do
|
43
|
+
@numbering, @start_level = 'yes ', '3 '
|
44
|
+
end
|
45
|
+
|
46
|
+
specify "numbering" do
|
47
|
+
@doc.at('h1').inner_text.should == 'h1'
|
48
|
+
|
49
|
+
elems = @doc.search('h2')
|
50
|
+
elems.map{|x| x.inner_text}.should == ['h2a', 'h2b', 'h2c']
|
51
|
+
|
52
|
+
elems = @doc.search('h3')
|
53
|
+
elems.map{|x| x.inner_text}.should == ['1. h3a', '2. h3b']
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
data/spec/toc.rb
CHANGED
@@ -3,8 +3,19 @@ require(Pathname.new(__FILE__).parent + 'lib/common.rb')
|
|
3
3
|
|
4
4
|
|
5
5
|
describe 'TOC:' do
|
6
|
-
before(:
|
7
|
-
@
|
6
|
+
before(:each) do
|
7
|
+
@bf = BlueFeather::Parser.new
|
8
|
+
if @doc_src then
|
9
|
+
@html = @bf.parse_document(@doc_src)
|
10
|
+
else
|
11
|
+
@html, @rs = @bf.parse_text_with_render_state(@src)
|
12
|
+
end
|
13
|
+
@doc = Hpricot(@html)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'Standard:' do
|
17
|
+
before(:all) do
|
18
|
+
@header_part = <<MARKDOWN
|
8
19
|
# h1 #
|
9
20
|
## h2a ##
|
10
21
|
## h2b ##
|
@@ -13,84 +24,122 @@ describe 'TOC:' do
|
|
13
24
|
### h3c ###
|
14
25
|
## h2c ##
|
15
26
|
MARKDOWN
|
16
|
-
|
27
|
+
end
|
17
28
|
|
18
|
-
before(:each) do
|
19
|
-
@bf = BlueFeather::Parser.new
|
20
|
-
@html = @bf.parse_text(@src)
|
21
|
-
@doc = Hpricot(@html)
|
22
|
-
end
|
23
29
|
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
share_as :ContentOverview do
|
32
|
+
specify 'overview' do
|
33
|
+
@doc.should have_element('ul')
|
34
|
+
@doc.should have_elements(1, 'h1')
|
35
|
+
@doc.should have_elements(3, 'h2')
|
36
|
+
@doc.should have_elements(3, 'h3')
|
37
|
+
end
|
31
38
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
|
40
|
+
|
41
|
+
describe 'basic:' do
|
42
|
+
include ContentOverview
|
43
|
+
before(:all) do
|
44
|
+
@src = "{toc}\n\n" + @header_part
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
specify 'list structure' do
|
49
|
+
toc = @doc.at('ul')
|
50
|
+
toc['class'] = 'toc'
|
51
|
+
|
52
|
+
@doc.should have_elements(3, 'ul.toc > li')
|
53
|
+
@doc.should have_elements(1, 'ul.toc > li > ul')
|
54
|
+
@doc.should have_elements(3, 'ul.toc > li > ul > li')
|
55
|
+
end
|
56
|
+
|
57
|
+
specify 'list content' do
|
58
|
+
toc = @doc.at('ul')
|
59
|
+
toc['class'] = 'toc'
|
60
|
+
|
61
|
+
items1 = @doc.search('ul.toc > li')
|
62
|
+
items1[0].inner_text.should == 'h2a'
|
63
|
+
items1[2].inner_text.should == 'h2c'
|
64
|
+
|
65
|
+
items2 = @doc.search('ul.toc > li > ul > li')
|
66
|
+
items2[0].inner_text.should == 'h3a'
|
67
|
+
items2[1].inner_text.should == 'h3b'
|
68
|
+
items2[2].inner_text.should == 'h3c'
|
69
|
+
end
|
70
|
+
|
39
71
|
end
|
40
72
|
|
41
73
|
|
42
|
-
|
43
|
-
|
44
|
-
|
74
|
+
describe 'range:' do
|
75
|
+
include ContentOverview
|
76
|
+
before(:all) do
|
77
|
+
@src = "{toc:h1..h2}\n\n" + @header_part
|
78
|
+
end
|
45
79
|
|
46
|
-
|
47
|
-
|
48
|
-
|
80
|
+
specify 'list structure' do
|
81
|
+
toc = @doc.at('ul')
|
82
|
+
toc['class'] = 'toc'
|
83
|
+
|
84
|
+
@doc.should have_elements(1, 'ul.toc > li')
|
85
|
+
@doc.should have_elements(1, 'ul.toc > li > ul')
|
86
|
+
@doc.should have_elements(3, 'ul.toc > li > ul > li')
|
87
|
+
end
|
88
|
+
|
89
|
+
specify 'list content' do
|
90
|
+
toc = @doc.at('ul')
|
91
|
+
toc['class'] = 'toc'
|
92
|
+
|
93
|
+
items2 = @doc.search('ul.toc > li > ul > li')
|
94
|
+
items2[0].inner_text.should == 'h2a'
|
95
|
+
items2[1].inner_text.should == 'h2b'
|
96
|
+
items2[2].inner_text.should == 'h2c'
|
97
|
+
end
|
98
|
+
|
49
99
|
end
|
50
100
|
|
51
|
-
|
52
|
-
|
53
|
-
|
101
|
+
|
102
|
+
describe 'numbering:' do
|
103
|
+
before(:all) do
|
104
|
+
@doc_src = "Numbering: yes\n\n{toc}\n" + @header_part
|
105
|
+
end
|
54
106
|
|
55
|
-
|
56
|
-
|
57
|
-
|
107
|
+
specify 'list content' do
|
108
|
+
toc = @doc.at('ul')
|
109
|
+
toc['class'] = 'toc'
|
110
|
+
|
111
|
+
items1 = @doc.search('ul.toc > li')
|
112
|
+
items1[0].inner_text.should == '1. h2a'
|
113
|
+
items1[2].inner_text.should == '3. h2c'
|
114
|
+
|
115
|
+
items2 = @doc.search('ul.toc > li > ul > li')
|
116
|
+
items2[0].inner_text.should == '2.1. h3a'
|
117
|
+
items2[1].inner_text.should == '2.2. h3b'
|
118
|
+
items2[2].inner_text.should == '2.3. h3c'
|
58
119
|
|
59
|
-
|
60
|
-
items2[0].inner_text.should == 'h3a'
|
61
|
-
items2[1].inner_text.should == 'h3b'
|
62
|
-
items2[2].inner_text.should == 'h3c'
|
120
|
+
end
|
63
121
|
end
|
64
122
|
|
65
|
-
end
|
66
|
-
|
67
|
-
describe 'range:' do
|
68
|
-
include ContentOverview
|
69
|
-
before(:all) do
|
70
|
-
@src = "{toc:h1..h2}\n\n" + @header_part
|
71
|
-
end
|
72
123
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
describe 'Illegal:' do
|
128
|
+
describe 'Standard:' do
|
129
|
+
before(:all) do
|
130
|
+
@src = <<MARKDOWN
|
131
|
+
{toc}
|
132
|
+
|
133
|
+
### h3
|
134
|
+
MARKDOWN
|
135
|
+
end
|
85
136
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
items2[2].inner_text.should == 'h2c'
|
137
|
+
specify '1 warning' do
|
138
|
+
@rs.warnings.size.should == 1
|
139
|
+
end
|
90
140
|
end
|
91
|
-
|
92
141
|
end
|
93
|
-
|
142
|
+
|
94
143
|
|
95
144
|
|
96
145
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluefeather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.30"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dice
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-01 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- spec/footnote.rb
|
41
41
|
- spec/header-id.rb
|
42
42
|
- spec/lib/common.rb
|
43
|
+
- spec/numbering.rb
|
43
44
|
- spec/table.rb
|
44
45
|
- spec/text/encoding_sample_default.bfdoc
|
45
46
|
- spec/text/encoding_sample_euc-jp.bfdoc
|