bluefeather 0.31 → 0.32
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.
- data/doc/author-and-license.html +2 -2
- data/doc/basic-usage.html +1 -1
- data/doc/class-reference.html +1 -1
- data/doc/difference.html +1 -1
- data/doc/en/author-and-license.html +2 -2
- data/doc/en/basic-usage.html +1 -1
- data/doc/en/class-reference.html +1 -1
- data/doc/en/difference.html +1 -1
- data/doc/en/format-extension.html +1 -1
- data/doc/en/index.bfdoc +1 -1
- data/doc/en/index.html +1 -1
- data/doc/en/metadata-reference.html +1 -1
- data/doc/encoding-rule.html +1 -1
- data/doc/format-extension.html +1 -1
- data/doc/index.bfdoc +1 -1
- data/doc/index.html +2 -2
- data/doc/metadata-reference.bfdoc +1 -1
- data/doc/metadata-reference.html +2 -2
- data/lib/bluefeather.rb +34 -19
- data/lib/bluefeather/cui.rb +1 -1
- data/original-tests/some_prob.tests.rb +78 -0
- data/spec/code-block.rb +56 -0
- data/spec/escape.rb +4 -0
- data/spec/win32.rb +31 -0
- metadata +5 -3
data/doc/author-and-license.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>連絡先・ライセンス - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -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="&#
|
|
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>
|
data/doc/basic-usage.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>インストール・基本的な使い方 - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/class-reference.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>クラスリファレンス - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/difference.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>BlueClothとの主な違い - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Author and License - BlueFeather Manual</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -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/basic-usage.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Installing and Basic Usage - BlueFeather Manual</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/en/class-reference.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Class Reference - BlueFeather Manual</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/en/difference.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Difference from BlueCloth - BlueFeather Manual</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Markdown Format Extension - BlueFeather Manual</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
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-10-25: this document based on version 0.32)
|
|
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-10-25: this document based on version 0.32)</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
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Metadata Reference - BlueFeather Manual</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/encoding-rule.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>エンコーディングの取り扱い - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/format-extension.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>Markdown記法の拡張 - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
data/doc/index.bfdoc
CHANGED
data/doc/index.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -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-10-25 バージョン 0.32 準拠)</p>
|
|
17
17
|
|
|
18
18
|
<p>BlueFeather は、拡張 Markdown 記法で書かれたテキストを html に変換するソフトウェアです。
|
|
19
19
|
コマンドラインツールと、Ruby スクリプト内で変換を行うためのライブラリがセットになっています。</p>
|
data/doc/metadata-reference.html
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
4
5
|
<title>メタデータリファレンス - BlueFeather マニュアル</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
6
6
|
<link rel="stylesheet" type="text/css" href="black.css" />
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
@@ -101,7 +101,7 @@ html の head 要素内に出力される Content-Type の値、および変換
|
|
|
101
101
|
|
|
102
102
|
<h3 id="keywords">Keywords:</h3>
|
|
103
103
|
|
|
104
|
-
<pre><code>
|
|
104
|
+
<pre><code>Keyword: にんじん,レシピ,料理
|
|
105
105
|
</code></pre>
|
|
106
106
|
|
|
107
107
|
<p>その文書を表すキーワード。<code><meta name="keywords" content="~"></code> の内容になる。</p>
|
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.32'
|
|
46
|
+
VERSION_NUMBER = 0.32
|
|
47
|
+
RELEASE_DATE = '2009-10-25'
|
|
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 = /^(
|
|
191
|
+
HEADER_PATTERN = /^([a-zA-Z0-9-]+?)\s*\:\s*(.+?)\s*(?:\n|\Z)/
|
|
192
192
|
BLANK_LINE_PATTERN = /^\n/
|
|
193
193
|
HEADER_SEQUEL_PATTERN = /^\s+(.+)$/
|
|
194
194
|
|
|
@@ -382,6 +382,16 @@ module BlueFeather
|
|
|
382
382
|
:md5 => hash,
|
|
383
383
|
:md5re => Regexp::new( hash ),
|
|
384
384
|
:re => Regexp::new( '\\\\' + Regexp::escape(char) ),
|
|
385
|
+
:unescape => char,
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
escaped = "\\#{char}"
|
|
389
|
+
hash = Digest::MD5::hexdigest(escaped)
|
|
390
|
+
EscapeTable[escaped] = {
|
|
391
|
+
:md5 => hash,
|
|
392
|
+
:md5re => Regexp::new( hash ),
|
|
393
|
+
:re => Regexp::new( '\\\\' + Regexp::escape(char) ),
|
|
394
|
+
:unescape => char,
|
|
385
395
|
}
|
|
386
396
|
}
|
|
387
397
|
|
|
@@ -574,19 +584,19 @@ module BlueFeather
|
|
|
574
584
|
# head
|
|
575
585
|
out.puts %Q|<head>|
|
|
576
586
|
|
|
587
|
+
if doc.encoding_type and (charset = EncodingType.type_to_charset(doc.encoding_type)) then
|
|
588
|
+
out.puts %Q|<meta http-equiv="Content-Type" content="text/html; charset=#{charset}" />|
|
|
589
|
+
end
|
|
590
|
+
|
|
577
591
|
h1 = rs.headers.find{|x| x.level == 1}
|
|
578
592
|
h1_content = (h1 ? h1.content : nil)
|
|
579
593
|
title = Util.escape_html(doc.title || h1_content || 'no title (Generated by BlueFeather)')
|
|
580
594
|
out.puts %Q|<title>#{title}</title>|
|
|
581
|
-
|
|
582
|
-
if doc.encoding_type and (charset = EncodingType.type_to_charset(doc.encoding_type)) then
|
|
583
|
-
out.puts %Q|<meta http-equiv="Content-Type" content="text/html; charset=#{charset}">|
|
|
584
|
-
end
|
|
585
595
|
|
|
586
596
|
%w(description keywords).each do |name|
|
|
587
597
|
if doc[name] then
|
|
588
598
|
content = Util.escape_html(doc[name])
|
|
589
|
-
out.puts %Q|<meta name="
|
|
599
|
+
out.puts %Q|<meta name="#{name}" content="#{content}" />|
|
|
590
600
|
end
|
|
591
601
|
end
|
|
592
602
|
|
|
@@ -906,7 +916,7 @@ module BlueFeather
|
|
|
906
916
|
def unescape_special_chars( str )
|
|
907
917
|
EscapeTable.each {|char, hash|
|
|
908
918
|
@log.debug "Unescaping escaped %p with %p" % [ char, hash[:md5re] ]
|
|
909
|
-
str.gsub!( hash[:md5re],
|
|
919
|
+
str.gsub!( hash[:md5re], hash[:unescape] )
|
|
910
920
|
}
|
|
911
921
|
|
|
912
922
|
return str
|
|
@@ -917,10 +927,11 @@ module BlueFeather
|
|
|
917
927
|
### in it replaced with MD5 placeholders.
|
|
918
928
|
def encode_backslash_escapes( str )
|
|
919
929
|
# Make a copy with any double-escaped backslashes encoded
|
|
920
|
-
text = str.gsub( /\\\\/, EscapeTable['
|
|
930
|
+
text = str.gsub( /\\\\/, EscapeTable['\\\\'][:md5] )
|
|
921
931
|
|
|
922
932
|
EscapeTable.each_pair {|char, esc|
|
|
923
|
-
next if char == '
|
|
933
|
+
next if char == '\\\\'
|
|
934
|
+
next unless char =~ /\\./
|
|
924
935
|
text.gsub!( esc[:re], esc[:md5] )
|
|
925
936
|
}
|
|
926
937
|
|
|
@@ -1344,12 +1355,18 @@ module BlueFeather
|
|
|
1344
1355
|
tmpl.force_encoding(str.encoding)
|
|
1345
1356
|
end
|
|
1346
1357
|
args = [ encode_code( outdent(codeblock), rs ).rstrip, remainder ]
|
|
1347
|
-
# Generate the codeblock
|
|
1348
1358
|
|
|
1349
|
-
|
|
1359
|
+
# recover all backslash escaped to original form
|
|
1360
|
+
EscapeTable.each {|char, hash|
|
|
1361
|
+
args[0].gsub!( hash[:md5re]){char}
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
# Generate the codeblock
|
|
1365
|
+
tmpl % args
|
|
1350
1366
|
}
|
|
1351
1367
|
end
|
|
1352
1368
|
|
|
1369
|
+
|
|
1353
1370
|
FencedCodeBlockRegexp = /^(\~{3,})\n((?m:.+?)\n)\1\n/
|
|
1354
1371
|
|
|
1355
1372
|
def pretransform_fenced_code_blocks( str, rs )
|
|
@@ -1788,7 +1805,7 @@ module BlueFeather
|
|
|
1788
1805
|
until @scanner.empty?
|
|
1789
1806
|
|
|
1790
1807
|
# Scan up to an opening backtick
|
|
1791
|
-
if pre = @scanner.scan_until(
|
|
1808
|
+
if pre = @scanner.scan_until( /.??(?=`)/m )
|
|
1792
1809
|
text += pre
|
|
1793
1810
|
@log.debug "Found backtick at %d after '...%s'" % [ @scanner.pos, text[-10, 10] ]
|
|
1794
1811
|
|
|
@@ -1899,7 +1916,7 @@ module BlueFeather
|
|
|
1899
1916
|
result += %{ title="%s"} % escape_md( title )
|
|
1900
1917
|
end
|
|
1901
1918
|
result += EmptyElementSuffix
|
|
1902
|
-
|
|
1919
|
+
|
|
1903
1920
|
@log.debug "Replacing %p with %p" % [ match, result ]
|
|
1904
1921
|
result
|
|
1905
1922
|
}
|
|
@@ -1917,7 +1934,6 @@ module BlueFeather
|
|
|
1917
1934
|
gsub( %r{>}, '>' ).
|
|
1918
1935
|
gsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]}
|
|
1919
1936
|
end
|
|
1920
|
-
|
|
1921
1937
|
|
|
1922
1938
|
|
|
1923
1939
|
#################################################################
|
|
@@ -1928,8 +1944,7 @@ module BlueFeather
|
|
|
1928
1944
|
### it.
|
|
1929
1945
|
def escape_md( str )
|
|
1930
1946
|
str.
|
|
1931
|
-
gsub(
|
|
1932
|
-
gsub( /_/, EscapeTable['_'][:md5] )
|
|
1947
|
+
gsub( /\*|_/ ){|symbol| EscapeTable[symbol][:md5]}
|
|
1933
1948
|
end
|
|
1934
1949
|
|
|
1935
1950
|
|
data/lib/bluefeather/cui.rb
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
# additional test: since BlueFeather 0.32
|
|
3
|
+
|
|
4
|
+
if !defined?( BlueFeather ) || !defined?( BlueFeather::TestCase )
|
|
5
|
+
basedir = File::dirname( __FILE__ )
|
|
6
|
+
require File::join( basedir, 'bftestcase' )
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### This test case tests ...
|
|
11
|
+
class SubfunctionsTestCase < BlueFeather::TestCase
|
|
12
|
+
|
|
13
|
+
def test_termination_of_meta_tag
|
|
14
|
+
result = BlueFeather.parse_document('').split("\n").
|
|
15
|
+
grep(/^<meta/).first
|
|
16
|
+
expected = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'
|
|
17
|
+
assert_equal(expected, result)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_metadata_description
|
|
21
|
+
bfdoc = 'Description: description text.'
|
|
22
|
+
result = BlueFeather.parse_document(bfdoc).split("\n").
|
|
23
|
+
grep(/^<meta name/).first
|
|
24
|
+
expected = '<meta name="description" content="description text." />'
|
|
25
|
+
assert_equal(expected, result)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_metadata_keyword
|
|
29
|
+
bfdoc = 'Keywords: key1, key2'
|
|
30
|
+
result = BlueFeather.parse_document(bfdoc).split("\n").
|
|
31
|
+
grep(/^<meta name/).first
|
|
32
|
+
expected = '<meta name="keywords" content="key1, key2" />'
|
|
33
|
+
assert_equal(expected, result)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# IE �ŁAtitle �^�O�������{��e�L�X�g�̎��A
|
|
37
|
+
# MIME�^�C�v�ƕ����R�[�h�Z�b�g�̎w�肪 title �^�O�̑O�ɖ����ƁA
|
|
38
|
+
# ����y�[�W��\������ۂɉ����\������Ȃ��B
|
|
39
|
+
def test_order_of_charcode_spec_and_title
|
|
40
|
+
bfdoc = '# title'
|
|
41
|
+
result = BlueFeather.parse_document('# title').split("\n").
|
|
42
|
+
grep(/^<title|^<meta/).map {|line| line[0, 5]}
|
|
43
|
+
expected = %w(<meta <titl)
|
|
44
|
+
assert_equal(expected, result)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_code_span_surrounded_by_double_backticks_at_begining_of_line
|
|
48
|
+
result = BlueFeather.parse('``code span``')
|
|
49
|
+
expected = '<p><code>code span</code></p>'
|
|
50
|
+
assert_equal(expected, result)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_backslash_in_code_block
|
|
54
|
+
result = BlueFeather.parse(' 1986\. What a great season.' + "\n")
|
|
55
|
+
expected = <<-'EOS'
|
|
56
|
+
<pre><code>1986\. What a great season.
|
|
57
|
+
</code></pre>
|
|
58
|
+
EOS
|
|
59
|
+
assert_equal(expected.chomp, result)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_header_tag_containing_colon_at_begining_of_doc
|
|
63
|
+
bfdoc = '<h1>hdr:level1</h1>'
|
|
64
|
+
result = BlueFeather.parse_document(bfdoc).split("\n").
|
|
65
|
+
grep(/^<h1/).first
|
|
66
|
+
expected = bfdoc
|
|
67
|
+
assert_equal(expected, result)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_header_containing_colon_at_begining_of_doc
|
|
71
|
+
bfdoc = '# markdown: syntax'
|
|
72
|
+
result = BlueFeather.parse_document(bfdoc).split("\n").
|
|
73
|
+
grep(/^<h1/).first.to_s[0,3]
|
|
74
|
+
expected = '<h1'
|
|
75
|
+
assert_equal(expected, result)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
data/spec/code-block.rb
CHANGED
|
@@ -171,4 +171,60 @@ MARKDOWN
|
|
|
171
171
|
@doc.at('pre code').inner_text.should == "code line a\n\ncode line b\n"
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
describe "0.31 code block bug in list item:" do
|
|
177
|
+
before(:each) do
|
|
178
|
+
@bf = BlueFeather::Parser.new
|
|
179
|
+
@html = @bf.parse_text(@src)
|
|
180
|
+
@doc = Hpricot(@html)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
describe 'simple:' do
|
|
184
|
+
before(:all) do
|
|
185
|
+
@src = <<MARKDOWN
|
|
186
|
+
~~~
|
|
187
|
+
* example list in code block
|
|
188
|
+
|
|
189
|
+
~~~
|
|
190
|
+
code
|
|
191
|
+
~~~
|
|
192
|
+
~~~
|
|
193
|
+
MARKDOWN
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
specify 'overview' do
|
|
197
|
+
@doc.should have_elements(1, 'pre code')
|
|
198
|
+
@doc.should_not have_element('pre code pre')
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
specify 'body' do
|
|
202
|
+
@doc.at('pre code').inner_text.should == "* example list in code block\n\n ~~~\n code\n ~~~\n"
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
describe 'complex:' do
|
|
208
|
+
|
|
209
|
+
before(:all) do
|
|
210
|
+
@src = <<MARKDOWN
|
|
211
|
+
* example list
|
|
212
|
+
|
|
213
|
+
~~~
|
|
214
|
+
* example list in code block
|
|
215
|
+
|
|
216
|
+
code
|
|
217
|
+
~~~
|
|
218
|
+
MARKDOWN
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
specify 'overview' do
|
|
222
|
+
@doc.should have_elements(1, 'ul li pre code')
|
|
223
|
+
@doc.should_not have_element('pre code pre')
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
specify 'body' do
|
|
227
|
+
@doc.at('pre code').inner_text.should == "* example list in code block\n\n ~~~\n code\n ~~~\n"
|
|
228
|
+
end
|
|
229
|
+
end
|
|
174
230
|
end
|
data/spec/escape.rb
CHANGED
data/spec/win32.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'pathname'
|
|
2
|
+
require(Pathname.new(__FILE__).parent + 'lib/common.rb')
|
|
3
|
+
|
|
4
|
+
if RUBY_PLATFORM =~ /win|mingw/ then
|
|
5
|
+
|
|
6
|
+
describe 'DOS Pathname:' do
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
@prefix = File.expand_path(File.dirname(__FILE__))
|
|
10
|
+
@unix_path = "#{@prefix}/text/encoding_sample_default.bfdoc"
|
|
11
|
+
@dos_path = "#{@prefix.gsub('/', '\\')}\\text\\encoding_sample_default.bfdoc"
|
|
12
|
+
@cmd_path = Pathname.new(__FILE__).parent.parent + 'bin/bluefeather'
|
|
13
|
+
@lib_dir = Pathname.new(__FILE__).parent.parent + 'lib'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
specify 'command run' do
|
|
17
|
+
File.exist?(@unix_path).should be_true
|
|
18
|
+
File.exist?(@dos_path).should be_true
|
|
19
|
+
|
|
20
|
+
system("ruby -I #{@lib_dir} #{@cmd_path} --verbose #{@unix_path}").should be_true
|
|
21
|
+
system("ruby -I #{@lib_dir} #{@cmd_path} --verbose #{@dos_path}").should be_true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
after do
|
|
25
|
+
dest = @unix_path.sub(/.bfdoc$/, '.html')
|
|
26
|
+
File.unlink(dest) if File.exist?(dest)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
else
|
|
30
|
+
puts "spec/win32.rb skipped."
|
|
31
|
+
end
|
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.32"
|
|
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-10-25 00:00:00 +09:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -49,6 +49,7 @@ files:
|
|
|
49
49
|
- spec/text/encoding_sample_utf-8n.bfdoc
|
|
50
50
|
- spec/toc.rb
|
|
51
51
|
- spec/warning.rb
|
|
52
|
+
- spec/win32.rb
|
|
52
53
|
- original-tests/00_Class.tests.rb
|
|
53
54
|
- original-tests/05_Markdown.tests.rb
|
|
54
55
|
- original-tests/10_Bug.tests.rb
|
|
@@ -58,6 +59,7 @@ files:
|
|
|
58
59
|
- original-tests/data/ml-announce.txt
|
|
59
60
|
- original-tests/data/re-overflow.txt
|
|
60
61
|
- original-tests/data/re-overflow2.txt
|
|
62
|
+
- original-tests/some_prob.tests.rb
|
|
61
63
|
- doc/author-and-license.bfdoc
|
|
62
64
|
- doc/author-and-license.html
|
|
63
65
|
- doc/base.css
|
|
@@ -118,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
118
120
|
requirements: []
|
|
119
121
|
|
|
120
122
|
rubyforge_project: bluefeather
|
|
121
|
-
rubygems_version: 1.3.
|
|
123
|
+
rubygems_version: 1.3.5
|
|
122
124
|
signing_key:
|
|
123
125
|
specification_version: 3
|
|
124
126
|
summary: Extend Markdown Converter
|