bluefeather 0.10
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/Rakefile.rb +168 -0
- data/bin/bluefeather +4 -0
- data/doc/author-and-license.bfdoc +16 -0
- data/doc/base.css +135 -0
- data/doc/basic-usage.bfdoc +265 -0
- data/doc/black.css +130 -0
- data/doc/class-reference.bfdoc +105 -0
- data/doc/difference.bfdoc +63 -0
- data/doc/en/author-and-license.bfdoc +20 -0
- data/doc/en/base.css +136 -0
- data/doc/en/basic-usage.bfdoc +266 -0
- data/doc/en/black.css +130 -0
- data/doc/en/class-reference.bfdoc +6 -0
- data/doc/en/difference.bfdoc +72 -0
- data/doc/en/format-extension.bfdoc +324 -0
- data/doc/en/index.bfdoc +41 -0
- data/doc/en/metadata-reference.bfdoc +7 -0
- data/doc/format-extension.bfdoc +325 -0
- data/doc/index.bfdoc +36 -0
- data/doc/metadata-reference.bfdoc +86 -0
- data/lib/bluefeather.rb +1872 -0
- data/lib/bluefeather/cui.rb +207 -0
- data/license/gpl-2.0.txt +339 -0
- data/license/gpl.ja.txt +416 -0
- data/original-tests/00_Class.tests.rb +42 -0
- data/original-tests/05_Markdown.tests.rb +1530 -0
- data/original-tests/10_Bug.tests.rb +44 -0
- data/original-tests/15_Contrib.tests.rb +130 -0
- data/original-tests/bftestcase.rb +278 -0
- data/original-tests/data/antsugar.txt +34 -0
- data/original-tests/data/ml-announce.txt +17 -0
- data/original-tests/data/re-overflow.txt +67 -0
- data/original-tests/data/re-overflow2.txt +281 -0
- data/readme_en.txt +37 -0
- data/readme_ja.txt +33 -0
- data/spec/auto-link.rb +100 -0
- data/spec/code-block.rb +91 -0
- data/spec/dl.rb +182 -0
- data/spec/escape-char.rb +18 -0
- data/spec/footnote.rb +34 -0
- data/spec/header-id.rb +38 -0
- data/spec/lib/common.rb +103 -0
- data/spec/table.rb +70 -0
- data/spec/toc.rb +64 -0
- data/spec/warning.rb +61 -0
- metadata +99 -0
data/doc/black.css
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
@import "base.css";
|
2
|
+
|
3
|
+
body {
|
4
|
+
color : #c0c0e0;
|
5
|
+
background : #000000;
|
6
|
+
scrollbar-3d-light-color : black;
|
7
|
+
scrollbar-arrow-color : white;
|
8
|
+
scrollbar-base-color : black;
|
9
|
+
scrollbar-dark-shadow-color : black;
|
10
|
+
scrollbar-face-color : black;
|
11
|
+
scrollbar-highlight-color : #666666;
|
12
|
+
scrollbar-shadow-color : gray;
|
13
|
+
|
14
|
+
}
|
15
|
+
|
16
|
+
strong{
|
17
|
+
color:#ffff00;
|
18
|
+
}
|
19
|
+
|
20
|
+
h2,h3{
|
21
|
+
border : thin outset #202070;
|
22
|
+
}
|
23
|
+
|
24
|
+
h2{
|
25
|
+
background : #202070;
|
26
|
+
}
|
27
|
+
|
28
|
+
h3{
|
29
|
+
margin-left: 0.5em;
|
30
|
+
background : #101050;
|
31
|
+
}
|
32
|
+
|
33
|
+
h2, h3, h4{
|
34
|
+
color : #ffffff;
|
35
|
+
padding : 0.2em;
|
36
|
+
}
|
37
|
+
|
38
|
+
h4{
|
39
|
+
margin-left: 1.0em;
|
40
|
+
}
|
41
|
+
|
42
|
+
pre{
|
43
|
+
border: solid thin #202070;
|
44
|
+
background-color: #000000;
|
45
|
+
overflow:auto;
|
46
|
+
font-size: smaller;
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
table {
|
51
|
+
border : none;
|
52
|
+
}
|
53
|
+
|
54
|
+
th,td {
|
55
|
+
padding : 0.2em;
|
56
|
+
}
|
57
|
+
|
58
|
+
th {
|
59
|
+
background : #303060;
|
60
|
+
border : outset 1px #303060;
|
61
|
+
}
|
62
|
+
|
63
|
+
td{
|
64
|
+
background : #000000;
|
65
|
+
border : solid 1px #404080;
|
66
|
+
}
|
67
|
+
|
68
|
+
th.empty,td.empty{
|
69
|
+
background : transparent;
|
70
|
+
}
|
71
|
+
|
72
|
+
table.clear,
|
73
|
+
table.clear th,
|
74
|
+
table.clear td {
|
75
|
+
border : none;
|
76
|
+
background : transparent;
|
77
|
+
}
|
78
|
+
|
79
|
+
blockquote{
|
80
|
+
color: #9999cc;
|
81
|
+
border: solid 1px #669999;
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
hr{
|
86
|
+
border-width: 0 0;
|
87
|
+
border-color: #669999;
|
88
|
+
padding: 0;
|
89
|
+
height: 1px;
|
90
|
+
color: #669999;
|
91
|
+
background-color: #669999;
|
92
|
+
width: 90%;
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
em{
|
97
|
+
font-style: italic;
|
98
|
+
}
|
99
|
+
|
100
|
+
a {
|
101
|
+
|
102
|
+
}
|
103
|
+
|
104
|
+
a:link {
|
105
|
+
color : #00ff00;
|
106
|
+
}
|
107
|
+
a:visited{
|
108
|
+
color : #00c800;
|
109
|
+
}
|
110
|
+
|
111
|
+
|
112
|
+
a:link:hover {
|
113
|
+
background : green;
|
114
|
+
text-decoration: none;
|
115
|
+
}
|
116
|
+
|
117
|
+
a:visited:hover {
|
118
|
+
background : green;
|
119
|
+
text-decoration: none;
|
120
|
+
}
|
121
|
+
|
122
|
+
input, textarea{
|
123
|
+
color : #c0c0e0;
|
124
|
+
background-color : black;
|
125
|
+
}
|
126
|
+
BUTTON{
|
127
|
+
color: #ffffff;
|
128
|
+
border : thin outset #f8f8ff;
|
129
|
+
background-color : #a9a9a9;
|
130
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
Title: クラスリファレンス - BlueFeather マニュアル
|
2
|
+
CSS: black.css
|
3
|
+
|
4
|
+
<div class="back"><a href="index.html">BlueFeather マニュアル</a></div>
|
5
|
+
|
6
|
+
クラスリファレンス
|
7
|
+
====
|
8
|
+
|
9
|
+
このリファレンス内では、BlueFeather が拡張した Markdown 記法のことを指して「BFMarkdown 記法」と書く。
|
10
|
+
|
11
|
+
{toc}
|
12
|
+
|
13
|
+
`BlueFeather` モジュール
|
14
|
+
----
|
15
|
+
|
16
|
+
### `BlueFeather.parse(str)` {#parse_text}
|
17
|
+
### `BlueFeather.parse_text(str)`
|
18
|
+
|
19
|
+
BFMarkdown 記法で書かれた文字列をパースして、結果のHTML片(String)を返す。
|
20
|
+
|
21
|
+
### `BlueFeather.parse_file(path)` {#parse_text_file}
|
22
|
+
### `BlueFeather.parse_text_file(path)`
|
23
|
+
|
24
|
+
ファイル `path` の内容を読み取ってパースし、結果のHTML片(String)を返す。以下の記述と同じ。
|
25
|
+
|
26
|
+
BlueFeather.parse_text(File.read(path))
|
27
|
+
|
28
|
+
### `BlueFeather.parse_document(str)` {#parse_document}
|
29
|
+
|
30
|
+
BFMarkdown 記法で書かれた文字列をパースして、結果のHTML文書を返す。
|
31
|
+
|
32
|
+
### `BlueFeather.parse_document_file(str)` {#parse_document_file}
|
33
|
+
|
34
|
+
ファイル `path` の内容を読み取ってパースし、結果のHTML文書を返す。以下の記述と同じ。
|
35
|
+
|
36
|
+
BlueFeather.parse_document(File.read(path))
|
37
|
+
|
38
|
+
### `BlueFeather::VERSION`
|
39
|
+
### `BlueFeather::VERSION_NUMBER`
|
40
|
+
|
41
|
+
BlueFeather のバージョンを表す定数。VERSION は文字列、VERSION_NUMBER は小数(Float)である。
|
42
|
+
|
43
|
+
`BlueFeather::Document` クラス
|
44
|
+
----
|
45
|
+
文書のメタデータと Markdown テキストの組を保持するクラス。
|
46
|
+
|
47
|
+
### `Document.parse(str)`
|
48
|
+
|
49
|
+
BFMarkdown記法で書かれた文字列をパースして、Document オブジェクトを返す。この時点ではテキストの変換は行わない。
|
50
|
+
|
51
|
+
### `Document.new(headers = {}, body = '')`
|
52
|
+
|
53
|
+
メタデータ(Hash)とテキスト(String)から、Document オブジェクトを生成して返す。この時点ではテキストの変換は行わない。
|
54
|
+
|
55
|
+
### `headers`
|
56
|
+
### `body`
|
57
|
+
|
58
|
+
その文書が持つメタデータ(Hash)と元テキスト(String)へのアクセサ。
|
59
|
+
|
60
|
+
### `self[key]`
|
61
|
+
### `self[key] = value`
|
62
|
+
|
63
|
+
メタデータの値を取得/設定する。`key` は Symbol か String で、小文字と大文字は区別されない。
|
64
|
+
|
65
|
+
### `title`
|
66
|
+
### `css`
|
67
|
+
|
68
|
+
それぞれ `doc['title']`, `doc['css']` と同じ。
|
69
|
+
|
70
|
+
|
71
|
+
### `to_html`
|
72
|
+
|
73
|
+
その文書をHTML文書に変換する。返り値は String。
|
74
|
+
|
75
|
+
`BlueFeather::Parser` クラス
|
76
|
+
----
|
77
|
+
|
78
|
+
BFMarkdown 記法で書かれたテキストをパースするためのクラス。
|
79
|
+
`BlueFeather.parse` などのメソッドでは、内部的に Parser を生成して使用している。
|
80
|
+
|
81
|
+
### `Parser.new(*restrictions)`
|
82
|
+
|
83
|
+
Parser オブジェクトを生成する。`*restrictions` には以下の Symbol を与えることができる。
|
84
|
+
|
85
|
+
\:filter_html
|
86
|
+
: 変換前にすべてのHTMLタグをエスケープする(=HTMLタグの記述を無効化する)。
|
87
|
+
|
88
|
+
### `parse(str)`
|
89
|
+
### `parse_text(str)`
|
90
|
+
### `parse_document(str)`
|
91
|
+
### `parse_file(path)`
|
92
|
+
### `parse_text_file(path)`
|
93
|
+
### `parse_document_file(path)`
|
94
|
+
|
95
|
+
それぞれ BlueFeather モジュールに定義された同名のメソッドと同じ。
|
96
|
+
|
97
|
+
### `use_header_id`
|
98
|
+
### `use_header_id = bool`
|
99
|
+
|
100
|
+
見出しにIDを付ける機能を有効にするかどうかのスイッチ(標準では true)。この機能をオフにすると、BFMarkdown の目次は利用できない。
|
101
|
+
|
102
|
+
### `display_warnings`
|
103
|
+
### `display_warnings = bool`
|
104
|
+
|
105
|
+
BlueFeather では不正なIDなどを見つけたときに、出力されるHTMLの中に警告を含める機能がある。これを有効にするかどうかのスイッチ(標準では true)。
|
@@ -0,0 +1,63 @@
|
|
1
|
+
Title: BlueClothとの主な違い - BlueFeather マニュアル
|
2
|
+
CSS: black.css
|
3
|
+
|
4
|
+
<div class="back"><a href="index.html">BlueFeather マニュアル</a></div>
|
5
|
+
|
6
|
+
BlueClothとの主な違い
|
7
|
+
====
|
8
|
+
|
9
|
+
{toc}
|
10
|
+
|
11
|
+
|
12
|
+
記法の拡張
|
13
|
+
----
|
14
|
+
[PHP Markdown Extra][]から多くの拡張(定義リスト、表組み、など)を取り込み、さらに目次生成や強制ブロック区切りなどの独自拡張を実装しています。
|
15
|
+
詳しくは[Markdown記法の拡張](format-extension.html)を参照してください。
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
インターフェースの変更
|
20
|
+
----
|
21
|
+
BlueCloth では、文字列を継承した BlueCloth クラスのオブジェクトを生成し、そのオブジェクトに対して to_html を呼ぶことで変換を行います。
|
22
|
+
|
23
|
+
require 'bluecloth'
|
24
|
+
|
25
|
+
puts BlueCloth.new(str).to_html
|
26
|
+
|
27
|
+
対して BlueFeather では、 BlueFeather モジュールのメソッドを直接呼んで変換を行うのが、もっとも一般的な方法です。
|
28
|
+
|
29
|
+
require 'bluefeather'
|
30
|
+
|
31
|
+
puts BlueFeather.parse(str)
|
32
|
+
|
33
|
+
また、`parse_file` や `parse_document` など、いくつかのメソッドが新設されています。
|
34
|
+
詳しくは[基本的な使い方](basic-usage.html)を参照してください。
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
完全なHTML文書の生成
|
40
|
+
----
|
41
|
+
[Maruku][] から取り込んだ機能として、部分的なhtml片だけではなく、DTD宣言やhead要素まで含んだ完全なhtml文書を生成できる機能があります。
|
42
|
+
また、メタデータを記述することにより、出力されるhtml文書のタイトルや、CSSファイルのURLも指定することが可能です。
|
43
|
+
|
44
|
+
詳しくは[基本的な使い方](basic-usage.html)、及び[メタデータリファレンス](metadata-reference.html)を参照してください。
|
45
|
+
|
46
|
+
|
47
|
+
BlueCloth 1.0.0 における既知のバグの修正
|
48
|
+
----
|
49
|
+
|
50
|
+
以下のバグの修正を行いました。
|
51
|
+
|
52
|
+
1. 一部の正規表現に、文字コード Shift-JIS が指定されている(= Shift-JIS 以外のマルチバイト文字列を正しく扱えない)
|
53
|
+
2. 一部の文字が含まれていると、`<mailaddress@example.com>` 形式の記述が mailto: リンクとして変換されない(GMailのエイリアス文字 `+` など)
|
54
|
+
3. リンクID定義を、4つ以上のスペースやタブでインデントしてもコードブロックにできない
|
55
|
+
4. 水平線(`<hr />`)タグを、4つ以上のスペースやタブでインデントしてもコードブロックにできない
|
56
|
+
|
57
|
+
空要素タグの閉じ方を変更
|
58
|
+
----
|
59
|
+
|
60
|
+
BlueCloth で `<tag/>` となっていた空要素タグの終端を、`<tag />` に変更しました。
|
61
|
+
|
62
|
+
[Maruku]: http://maruku.rubyforge.org/
|
63
|
+
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Title: Author and License - BlueFeather Manual
|
2
|
+
CSS: black.css
|
3
|
+
|
4
|
+
<div class="back"><a href="index.html">BlueFeather Manual</a></div>
|
5
|
+
|
6
|
+
|
7
|
+
Author and License
|
8
|
+
====
|
9
|
+
|
10
|
+
BlueFeather is a free software. it is distributed by General Public License
|
11
|
+
(GPL) version 2. For details, see top of `bluefeather.rb`, and `license/` directory.
|
12
|
+
|
13
|
+
* [Wikipedia - GNU General Public License](http://en.wikipedia.org/wiki/GNU_General_Public_License)
|
14
|
+
|
15
|
+
~
|
16
|
+
|
17
|
+
If you want to send requests, comments, or bug reports to BlueFeather, please
|
18
|
+
feel free to post messages from
|
19
|
+
<http://ruby.morphball.net/bluefeather/index_en.html> or to send mail to Dice.
|
20
|
+
(<tetradice@gmail.com>)
|
data/doc/en/base.css
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
body {
|
2
|
+
font-size : medium;
|
3
|
+
line-height : 1.4em;
|
4
|
+
margin : 3em 10%;
|
5
|
+
}
|
6
|
+
|
7
|
+
|
8
|
+
div.back{
|
9
|
+
text-align: right;
|
10
|
+
font-size: smaller;
|
11
|
+
}
|
12
|
+
|
13
|
+
/* �\ */
|
14
|
+
|
15
|
+
table{
|
16
|
+
font-size : 1.0em;
|
17
|
+
margin-left : 1.0em;
|
18
|
+
}
|
19
|
+
|
20
|
+
th {
|
21
|
+
border-style : outset;
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
/* ���o���E�i�� */
|
27
|
+
|
28
|
+
h1,h2,h3,h4,h5,h6 {
|
29
|
+
line-height : 1.0em;
|
30
|
+
}
|
31
|
+
|
32
|
+
h1 {
|
33
|
+
font-size : xx-large;
|
34
|
+
}
|
35
|
+
|
36
|
+
h2 {
|
37
|
+
font-size : x-large;
|
38
|
+
margin-top : 4em;
|
39
|
+
}
|
40
|
+
|
41
|
+
h3 {
|
42
|
+
font-size : large;
|
43
|
+
margin-top: 3em;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* ���\�b�h�ꗗ�p */
|
47
|
+
h2 + h2, h3 + h3{
|
48
|
+
margin-top: 0.2em;
|
49
|
+
}
|
50
|
+
|
51
|
+
p {
|
52
|
+
margin-left : 2em;
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
/* ���X�g */
|
58
|
+
li {
|
59
|
+
margin-bottom : 0.6em;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
dl {
|
64
|
+
margin-left : 2.0em;
|
65
|
+
}
|
66
|
+
|
67
|
+
dt {
|
68
|
+
font-weight : bold;
|
69
|
+
}
|
70
|
+
|
71
|
+
dd {
|
72
|
+
margin-left : 2.0em;
|
73
|
+
margin-bottom : 0.5em;
|
74
|
+
}
|
75
|
+
|
76
|
+
ul, ol, dl{
|
77
|
+
margin: 2.0em;
|
78
|
+
}
|
79
|
+
|
80
|
+
ul ul{
|
81
|
+
margin: 0.5em;
|
82
|
+
}
|
83
|
+
|
84
|
+
li p{
|
85
|
+
margin-left: 0.1em;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
/* ���p���ׂ����� */
|
90
|
+
|
91
|
+
blockquote, pre{
|
92
|
+
margin-left: 3em;
|
93
|
+
margin-bottom: 3em;
|
94
|
+
}
|
95
|
+
|
96
|
+
blockquote p{
|
97
|
+
margin-left: 0.5em;
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
pre {
|
102
|
+
padding: 1em;
|
103
|
+
}
|
104
|
+
|
105
|
+
address {
|
106
|
+
text-align : right;
|
107
|
+
font-style: normal;
|
108
|
+
}
|
109
|
+
|
110
|
+
em {
|
111
|
+
font-weight : bold;
|
112
|
+
font-style : normal;
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
pre code{
|
117
|
+
margin: 0;
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
hr {
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
div.layer {
|
128
|
+
padding-left : 1.5em;
|
129
|
+
}
|
130
|
+
|
131
|
+
div.link {
|
132
|
+
font-size : 1.2em;
|
133
|
+
font-weight : bold;
|
134
|
+
margin-top : 2.0em;
|
135
|
+
margin-left : 0.5em;
|
136
|
+
}
|