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.
@@ -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="&#109;&#097;&#105;&#108;&#116;&#x6F;:&#x74;&#x65;&#116;&#x72;&#097;&#100;&#x69;&#099;&#101;&#x40;&#103;&#x6D;&#x61;&#x69;&#x6C;&#x2E;&#099;&#x6F;m">&#x74;&#x65;&#116;&#x72;&#097;&#100;&#x69;&#099;&#101;&#x40;&#103;&#x6D;&#x61;&#x69;&#x6C;&#x2E;&#099;&#x6F;m</a>)までメールでご連絡していただけるよう、よろしくお願いします。</p>
21
+ <p>BlueFeather への要望、ご意見、バグ報告などがありましたら、<a href="http://ruby.morphball.net/bluefeather/">BlueFeather 配布サイト</a>よりメッセージを送信していただくか、もしくは Dice(<a href="&#x6D;&#097;&#x69;l&#116;&#x6F;:&#x74;&#101;&#116;&#x72;a&#x64;&#x69;&#099;&#x65;&#064;&#103;&#109;a&#105;&#x6C;&#x2E;&#x63;&#x6F;&#109;">&#x74;&#101;&#116;&#x72;a&#x64;&#x69;&#099;&#x65;&#064;&#103;&#109;a&#105;&#x6C;&#x2E;&#x63;&#x6F;&#109;</a>)までメールでご連絡していただけるよう、よろしくお願いします。</p>
22
22
 
23
23
  </body>
24
24
  </html>
@@ -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>
@@ -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>
@@ -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="&#109;&#097;i&#x6C;&#116;&#x6F;:t&#x65;&#116;&#x72;&#097;&#100;&#x69;&#x63;&#x65;&#064;&#103;&#109;&#097;&#x69;l&#x2E;&#099;&#x6F;&#109;">t&#x65;&#116;&#x72;&#097;&#100;&#x69;&#x63;&#x65;&#064;&#103;&#109;&#097;&#x69;l&#x2E;&#099;&#x6F;&#109;</a>)</p>
27
+ (<a href="&#x6D;&#097;&#x69;&#x6C;&#x74;&#111;:&#116;&#x65;&#116;&#114;&#x61;d&#x69;&#x63;&#x65;&#x40;&#x67;&#x6D;&#097;&#x69;l.c&#111;&#x6D;">&#116;&#x65;&#116;&#114;&#x61;d&#x69;&#x63;&#x65;&#x40;&#x67;&#x6D;&#097;&#x69;l.c&#111;&#x6D;</a>)</p>
28
28
 
29
29
  </body>
30
30
  </html>
@@ -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>
@@ -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>
@@ -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>
@@ -10,7 +10,7 @@ BlueFeather Manual
10
10
 
11
11
  -> [Japanese version (original)](../index.html)
12
12
 
13
- (2009-09-26: this document based on version 0.31)
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
@@ -12,7 +12,7 @@
12
12
 
13
13
  <p>-> <a href="../index.html">Japanese version (original)</a></p>
14
14
 
15
- <p>(2009-09-26: this document based on version 0.31)</p>
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>
@@ -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>
@@ -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>
@@ -9,7 +9,7 @@ BlueFeather マニュアル
9
9
  → [English version](en/index.html)
10
10
 
11
11
 
12
- (2009-09-26 バージョン 0.31 準拠)
12
+ (2009-10-25 バージョン 0.32 準拠)
13
13
 
14
14
  BlueFeather は、拡張 Markdown 記法で書かれたテキストを html に変換するソフトウェアです。
15
15
  コマンドラインツールと、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>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-09-26 バージョン 0.31 準拠)</p>
16
+ <p>(2009-10-25 バージョン 0.32 準拠)</p>
17
17
 
18
18
  <p>BlueFeather は、拡張 Markdown 記法で書かれたテキストを html に変換するソフトウェアです。
19
19
  コマンドラインツールと、Ruby スクリプト内で変換を行うためのライブラリがセットになっています。</p>
@@ -81,7 +81,7 @@ html の head 要素内に出力される Content-Type の値、および変換
81
81
 
82
82
  ### Keywords: {#keywords}
83
83
 
84
- Description: にんじん,レシピ,料理
84
+ Keyword: にんじん,レシピ,料理
85
85
 
86
86
  その文書を表すキーワード。`<meta name="keywords" content="~">` の内容になる。
87
87
 
@@ -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>Description: にんじん,レシピ,料理
104
+ <pre><code>Keyword: にんじん,レシピ,料理
105
105
  </code></pre>
106
106
 
107
107
  <p>その文書を表すキーワード。<code>&lt;meta name="keywords" content="~"&gt;</code> の内容になる。</p>
@@ -42,9 +42,9 @@ require 'uri'
42
42
 
43
43
 
44
44
  module BlueFeather
45
- VERSION = '0.31'
46
- VERSION_NUMBER = 0.31
47
- RELEASE_DATE = '2009-09-26'
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 = /^(.+?)\s*\:\s*(.+?)\s*(?:\n|\Z)/
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="Content-Type" content="#{content}">|
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], char )
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['\\'][:md5] )
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
- tmpl % args
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( /.?(?=`)/m )
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{>}, '&gt;' ).
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( /\*/, EscapeTable['*'][:md5] ).
1932
- gsub( /_/, EscapeTable['_'][:md5] )
1947
+ gsub( /\*|_/ ){|symbol| EscapeTable[symbol][:md5]}
1933
1948
  end
1934
1949
 
1935
1950
 
@@ -140,7 +140,7 @@ More info:
140
140
  targets = []
141
141
 
142
142
  args.each do |pattern|
143
- targets.concat(Pathname.glob(pattern))
143
+ targets.concat(Pathname.glob(pattern.gsub('\\', '/')))
144
144
  end
145
145
 
146
146
  if targets.empty? then
@@ -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
@@ -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
@@ -11,6 +11,10 @@ describe 'Escape Characters:' do
11
11
  specify "'#{c}'" do
12
12
  @bf.parse_text("\\#{c}").should == "<p>#{c}</p>"
13
13
  end
14
+
15
+ specify "'#{c}' (in code block)" do
16
+ @bf.parse_text(" \\#{c}").should == "<pre><code>\\#{c}\n</code></pre>"
17
+ end
14
18
  end
15
19
  end
16
20
 
@@ -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.31"
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-09-26 00:00:00 +09:00
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.3
123
+ rubygems_version: 1.3.5
122
124
  signing_key:
123
125
  specification_version: 3
124
126
  summary: Extend Markdown Converter