bluefeather 0.10 → 0.11

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.
@@ -0,0 +1,24 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title>連絡先・ライセンス - BlueFeather マニュアル</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link rel="stylesheet" type="text/css" href="black.css" />
7
+ </head>
8
+ <body>
9
+
10
+ <div class="back"><a href="index.html">BlueFeather マニュアル</a></div>
11
+
12
+ <h1 id="bfheader-22033ed9a491d8394d357096e69dee5e">連絡先・ライセンス</h1>
13
+
14
+ <p>BlueFeather は、改変元である BlueCloth のライセンス(利用条件)に基づき、General Public License(GPL)バージョン 2 の元で配布されるフリーソフトウェアです。
15
+ 詳しくは、<code>bluefeather.rb</code> のファイル頭にある著作権表示、および同梱の <code>license/</code> ディレクトリ内にある GPL 公衆利用許諾契約書を参照してください。</p>
16
+
17
+ <ul>
18
+ <li><a href="http://ja.wikipedia.org/wiki/GNU_General_Public_License">Wikipedia - GNU General Public License</a></li>
19
+ </ul>
20
+
21
+ <p>BlueFeather への要望、ご意見、バグ報告などがありましたら、<a href="http://ruby.morphball.net/bluefeather/">BlueFeather 配布サイト</a>よりメッセージを送信していただくか、もしくは Dice(<a href="&#109;&#097;&#x69;&#x6C;t&#x6F;:&#x74;&#x65;&#x74;&#x72;&#x61;&#x64;&#x69;&#099;&#101;&#064;&#x67;&#109;&#x61;&#105;&#108;&#x2E;&#099;&#111;&#x6D;">&#x74;&#x65;&#x74;&#x72;&#x61;&#x64;&#x69;&#099;&#101;&#064;&#x67;&#109;&#x61;&#105;&#108;&#x2E;&#099;&#111;&#x6D;</a>)までメールでご連絡していただけるよう、よろしくお願いします。</p>
22
+
23
+ </body>
24
+ </html>
@@ -43,7 +43,27 @@ BlueFeather が解釈する Markdown 記法への独自拡張については、[
43
43
  example3.bftext => example3.html (10499 byte)
44
44
  %
45
45
 
46
- オプションの種類については、この文書内の[コマンドラインオプション](#commandline-options)の項を参照してください。
46
+
47
+
48
+ ### 強制変換オプション(`--force`)
49
+
50
+ 通常 `bluefeather` コマンドは、_入力テキストファイルが更新されていたときのみ_(更新日時が新しくなっていたときのみ)変換を行います。
51
+
52
+ % bluefeather example1.bftext
53
+ example1.bftext => example1.html (4240 byte)
54
+ % bluefeather example1.bftext
55
+ %
56
+
57
+ 更新日時に関わらず全てのファイルを変換したい場合には、`--force` オプションをつけて実行してください。
58
+
59
+ % bluefeather example1.bftext
60
+ example1.bftext => example1.html (4240 byte)
61
+ % bluefeather --force example1.bftext
62
+ example1.bftext => example1.html (4240 byte)
63
+ %
64
+
65
+ この他のオプションの種類については、この文書内の[コマンドラインオプション](#commandline-options)の項を参照してください。
66
+
47
67
 
48
68
  ### 拡張子による出力htmlの違い
49
69
 
@@ -164,6 +184,10 @@ test3.html
164
184
  `text`, `bftext` ならhtml片を、 `document`, `bfdoc` なら完全なhtml文書を出力します。
165
185
  (標準ではファイルの拡張子から自動判別)
166
186
 
187
+ `--force`
188
+ : 入力ファイルの更新日時に関わらず、全てのファイルを変換します。(標準では入力ファイルが新しくなっている場合のみ変換)
189
+
190
+
167
191
  `-h`, `--help`
168
192
  : `bluefeather` コマンドの解説を表示します。
169
193
 
@@ -0,0 +1,296 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title>インストール・基本的な使い方 - BlueFeather マニュアル</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link rel="stylesheet" type="text/css" href="black.css" />
7
+ </head>
8
+ <body>
9
+
10
+ <div class="back"><a href="index.html">BlueFeather マニュアル</a></div>
11
+
12
+ <h1 id="bfheader-c167f974473fb1cdff6e0f2f067cfbc3">インストール・基本的な使い方</h1>
13
+
14
+ <p>この文書では、BlueFeather そのものの使い方について記述しています。
15
+ BlueFeather が解釈する Markdown 記法への独自拡張については、<a href="format-extension.html">Markdown 記法の拡張</a>を参照してください。</p>
16
+
17
+ <ul>
18
+ <li><a href="#bfheader-14b7d76f2abce310837a677aad65c1ad" rel="toc">インストール</a></li>
19
+ <li><a href="#bfheader-5e9396aa1fb605475445d077ca2f690b" rel="toc">コマンドラインから使う</a>
20
+ <ul>
21
+ <li><a href="#bfheader-4092ed98e9035652d4c9ca9441701ed7" rel="toc">基本</a></li>
22
+ <li><a href="#bfheader-02fe5453bd08eb3cb5d1d3c8dea497ca" rel="toc">強制変換オプション(<code>--force</code>)</a></li>
23
+ <li><a href="#bfheader-986401246f72b46787bad31b4e773c02" rel="toc">拡張子による出力htmlの違い</a></li>
24
+ <li><a href="#bfheader-29df151398c61ca5ad1df45823c7e8d1" rel="toc">文書メタデータ</a></li>
25
+ <li><a href="#bfheader-0b9b6b9ab94c1f57fecc31f93bc353ad" rel="toc">標準入力からの読み込み(stdin-mode)</a></li>
26
+ <li><a href="#commandline-options" rel="toc">コマンドラインオプション</a></li>
27
+ </ul></li>
28
+ <li><a href="#bfheader-7b3de7743b61cccaa29b530bce475ac3" rel="toc">Rubyスクリプト内で使う</a>
29
+ <ul>
30
+ <li><a href="#bfheader-4092ed98e9035652d4c9ca9441701ed7" rel="toc">基本</a></li>
31
+ <li><a href="#bfheader-3987fc65af96b04e3a2c75849e6d3cb0" rel="toc">HTML文書の生成</a></li>
32
+ <li><a href="#bfheader-1514458460dd901af0feb52ebb2d981f" rel="toc">文書のメタデータ取得</a></li>
33
+ </ul></li>
34
+ </ul>
35
+
36
+ <h2 id="bfheader-14b7d76f2abce310837a677aad65c1ad">インストール</h2>
37
+
38
+ <p>同梱の setup.rb を実行することにより、ファイルが適切な位置にコピーされ、インストールが完了します。</p>
39
+
40
+ <pre><code>% ruby setup.rb
41
+ </code></pre>
42
+
43
+ <p>もしくは、RubyGems がインストールされていれば、インターネットに接続されたPCから次のように打ち込むことでインストールすることも可能です。</p>
44
+
45
+ <pre><code>% gem install bluefeather
46
+ </code></pre>
47
+
48
+ <h2 id="bfheader-5e9396aa1fb605475445d077ca2f690b">コマンドラインから使う</h2>
49
+
50
+ <h3 id="bfheader-4092ed98e9035652d4c9ca9441701ed7">基本</h3>
51
+
52
+ <p>インストールが正常に終了していれば、<code>bluefeather</code> コマンドを使って、Markdown記法で書かれたファイルを変換することができます。
53
+ インターフェースは以下の通りです。</p>
54
+
55
+ <pre><code>bluefeather [options] file1 [file2] [file3] ...
56
+ </code></pre>
57
+
58
+ <p>たとえば、次のように入力することで、拡張子が <code>.bftext</code> のファイル全てをhtmlファイルに変換することができます。</p>
59
+
60
+ <pre><code>% bluefeather *.bftext
61
+ example1.bftext =&gt; example1.html (4240 byte)
62
+ example2.bftext =&gt; example2.html (5613 byte)
63
+ example3.bftext =&gt; example3.html (10499 byte)
64
+ %
65
+ </code></pre>
66
+
67
+ <h3 id="bfheader-02fe5453bd08eb3cb5d1d3c8dea497ca">強制変換オプション(<code>--force</code>)</h3>
68
+
69
+ <p>通常 <code>bluefeather</code> コマンドは、<em>入力テキストファイルが更新されていたときのみ</em>(更新日時が新しくなっていたときのみ)変換を行います。</p>
70
+
71
+ <pre><code>% bluefeather example1.bftext
72
+ example1.bftext =&gt; example1.html (4240 byte)
73
+ % bluefeather example1.bftext
74
+ %
75
+ </code></pre>
76
+
77
+ <p>更新日時に関わらず全てのファイルを変換したい場合には、<code>--force</code> オプションをつけて実行してください。</p>
78
+
79
+ <pre><code>% bluefeather example1.bftext
80
+ example1.bftext =&gt; example1.html (4240 byte)
81
+ % bluefeather --force example1.bftext
82
+ example1.bftext =&gt; example1.html (4240 byte)
83
+ %
84
+ </code></pre>
85
+
86
+ <p>この他のオプションの種類については、この文書内の<a href="#commandline-options">コマンドラインオプション</a>の項を参照してください。</p>
87
+
88
+ <h3 id="bfheader-986401246f72b46787bad31b4e773c02">拡張子による出力htmlの違い</h3>
89
+
90
+ <p><code>bluefeather</code> コマンドでは、変換対象のファイルの拡張子によって、どのようなhtmlファイルを出力するかが異なります。</p>
91
+
92
+ <dl>
93
+ <dt><code>.md</code>, <code>.bfdoc</code></dt>
94
+ <dd>DTD宣言やhead要素などを含んだ、完全なHTML文書を生成する</dd>
95
+ <dt>それ以外</dt>
96
+ <dd>HTML片を生成する(DTD宣言やhead要素は含まない)</dd>
97
+ </dl>
98
+
99
+ <p>たとえば、次のような一文だけが書かれたテキストファイルがあるとします。</p>
100
+
101
+ <pre><code>test paragraph.
102
+ </code></pre>
103
+
104
+ <p>このテキストファイルが <code>test1.bftext</code> という名前であれば、変換結果(<code>test1.html</code>)はこのようになります。</p>
105
+
106
+ <pre><code>&lt;p&gt;test paragraph.&lt;/p&gt;
107
+ </code></pre>
108
+
109
+ <p>しかし、もしこのファイルが <code>test1.bfdoc</code> という名前であれば、上記の例と異なり<em>完全なHTML文書を生成します。</em></p>
110
+
111
+ <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
112
+ &lt;html&gt;
113
+ &lt;head&gt;
114
+ &lt;title&gt;no title (Generated by BlueFeather)&lt;/title&gt;
115
+ &lt;/head&gt;
116
+ &lt;body&gt;
117
+
118
+ &lt;p&gt;test paragraph.&lt;/p&gt;
119
+
120
+ &lt;/body&gt;
121
+ &lt;/html&gt;
122
+ </code></pre>
123
+
124
+ <p>なお、このとき変換する文書にレベル1の見出しが含まれていれば、<em>その見出しが自動的にhtml文書のtitleとして使われます。</em></p>
125
+
126
+ <dl>
127
+ <dt>test2.bfdoc</dt>
128
+ <dd><pre><code>Test Document
129
+ =============
130
+
131
+ test paragraph.
132
+ </code></pre></dd>
133
+ <dt>test2.html(出力結果)</dt>
134
+ <dd><pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
135
+ &lt;html&gt;
136
+ &lt;head&gt;
137
+ &lt;title&gt;Test Document&lt;/title&gt;
138
+ &lt;/head&gt;
139
+ &lt;body&gt;
140
+
141
+ &lt;h1 id="bfheader-a5decd745d43af4aa8cf62eef5be43ac"&gt;Test Document&lt;/h1&gt;
142
+
143
+ &lt;p&gt;test paragraph.&lt;/p&gt;
144
+
145
+ &lt;/body&gt;
146
+ &lt;/html&gt;
147
+ </code></pre></dd>
148
+ </dl>
149
+
150
+ <h3 id="bfheader-29df151398c61ca5ad1df45823c7e8d1">文書メタデータ</h3>
151
+
152
+ <p>拡張子が <code>.bfdoc</code> や <code>.md</code> のファイルには、文書メタデータを付け加えることが出来ます。</p>
153
+
154
+ <dl>
155
+ <dt>test3.bfdoc</dt>
156
+ <dd><pre><code>Title: Test Document
157
+ CSS: style.css
158
+
159
+ Test paragraph.
160
+ </code></pre></dd>
161
+ <dt>test3.html</dt>
162
+ <dd><pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
163
+ &lt;html&gt;
164
+ &lt;head&gt;
165
+ &lt;title&gt;Test Document&lt;/title&gt;
166
+ &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
167
+ &lt;/head&gt;
168
+ &lt;body&gt;
169
+
170
+ &lt;p&gt;Test paragraph.&lt;/p&gt;
171
+
172
+ &lt;/body&gt;
173
+ &lt;/html&gt;
174
+ </code></pre></dd>
175
+ </dl>
176
+
177
+ <p>メタデータについての詳細は、<a href="metadata-reference.html">メタデータリファレンス</a>を参照してください。</p>
178
+
179
+ <h3 id="bfheader-0b9b6b9ab94c1f57fecc31f93bc353ad">標準入力からの読み込み(stdin-mode)</h3>
180
+
181
+ <p>ファイル名を <code>-</code> とだけ指定すると特殊な動作モードになり、標準入力からテキストを読み込み、変換結果のhtmlを標準出力へ書き込みます。
182
+ パイプラインを用いるときなどに便利です。</p>
183
+
184
+ <pre><code>% bluefeather -
185
+ </code></pre>
186
+
187
+ <h3 id="commandline-options">コマンドラインオプション</h3>
188
+
189
+ <dl>
190
+ <dt><code>-e NAME</code>, <code>--encoding NAME</code></dt>
191
+ <dd>
192
+ 変換するテキストファイルのエンコーディングを、指定したエンコーディングとして解釈します。
193
+ (<code>shift-jis</code> / <code>euc-jp</code> / <code>utf-8</code> / <code>none</code> のうちいずれか、もしくは最初の数文字。標準では <code>utf-8</code>)</dd>
194
+ <dt><code>-f TYPE</code>, <code>--format TYPE</code></dt>
195
+ <dd>
196
+ 出力するhtmlの種別を特定します。
197
+ <code>text</code>, <code>bftext</code> ならhtml片を、 <code>document</code>, <code>bfdoc</code> なら完全なhtml文書を出力します。
198
+ (標準ではファイルの拡張子から自動判別)</dd>
199
+ <dt><code>--force</code></dt>
200
+ <dd>入力ファイルの更新日時に関わらず、全てのファイルを変換します。(標準では入力ファイルが新しくなっている場合のみ変換)</dd>
201
+ <dt><code>-h</code>, <code>--help</code></dt>
202
+ <dd><code>bluefeather</code> コマンドの解説を表示します。</dd>
203
+ <dt><code>-o DIR</code>, <code>--output DIR</code></dt>
204
+ <dd>指定したディレクトリに全てのファイルを生成します。(標準ではパース対象のファイルと同じ位置に生成)</dd>
205
+ <dt><code>-q</code>, <code>--quiet</code></dt>
206
+ <dd>動作時に作業の状況や結果を表示しません。</dd>
207
+ <dt><code>--suffix .SUF</code></dt>
208
+ <dd>出力するファイルの拡張子を指定します。(標準は.html)</dd>
209
+ <dt><code>-v</code>, <code>--verbose</code></dt>
210
+ <dd>冗長フラグ。作業内容を詳細に表示します。</dd>
211
+ <dt><code>--version</code></dt>
212
+ <dd>BlueFeather のバージョンを表示します。</dd>
213
+ </dl>
214
+
215
+ <h2 id="bfheader-7b3de7743b61cccaa29b530bce475ac3">Rubyスクリプト内で使う</h2>
216
+
217
+ <h3 id="bfheader-4092ed98e9035652d4c9ca9441701ed7">基本</h3>
218
+
219
+ <p>もっとも基本的なメソッドは、<code>BlueFeather.parse</code> です。
220
+ このメソッドにより、BlueFeatherを用いて文字列をパースし、htmlに変換することができます。</p>
221
+
222
+ <pre><code>require 'bluefeather'
223
+
224
+ str = "もっとも基本的な例です。"
225
+ puts BlueFeather.parse(str) #=&gt; "&lt;p&gt;もっとも基本的な例です。&lt;/p&gt;"
226
+ </code></pre>
227
+
228
+ <p>また、<code>BlueFeather.parse_file</code> を使えば、ファイルの中にある文字列を読み込んでパースすることができます。</p>
229
+
230
+ <pre><code>BlueFeather.parse_file('test1.txt')
231
+ BlueFeather.parse_file('test2.markdown')
232
+ BlueFeather.parse_file('test3.bftext')
233
+ </code></pre>
234
+
235
+ <h3 id="bfheader-3987fc65af96b04e3a2c75849e6d3cb0">HTML文書の生成</h3>
236
+
237
+ <p><code>parse</code> や <code>parse_file</code> メソッドの代わりに、<code>parse_document</code> や <code>parse_document_file</code> メソッドを用いることによって、HTML片ではなく<em>完全なHTML文書を生成する</em>ことが可能です。</p>
238
+
239
+ <dl>
240
+ <dt>test.bfdoc</dt>
241
+ <dd><pre><code>The sentence is expected as HTML.
242
+ </code></pre></dd>
243
+ <dt>test.rb</dt>
244
+ <dd><pre><code>require 'bluefeather'
245
+
246
+ puts '-- parse_file --'
247
+ puts BlueFeather.parse_file('test.bfdoc')
248
+
249
+ puts '-- parse_document_file --'
250
+ puts BlueFeather.parse_document_file('test.bfdoc')
251
+ </code></pre></dd>
252
+ <dt>実行結果</dt>
253
+ <dd><pre><code>-- parse_file --
254
+ &lt;p&gt;The sentence is expected as HTML.&lt;/p&gt;
255
+
256
+ -- parse_document_file --
257
+ &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
258
+ &lt;html&gt;
259
+ &lt;head&gt;
260
+ &lt;title&gt;no title (Generated by BlueFeather)&lt;/title&gt;
261
+ &lt;/head&gt;
262
+ &lt;body&gt;
263
+
264
+ &lt;p&gt;The sentence is expected as HTML.&lt;/p&gt;
265
+
266
+ &lt;/body&gt;
267
+ &lt;/html&gt;
268
+ </code></pre></dd>
269
+ </dl>
270
+
271
+ <h3 id="bfheader-1514458460dd901af0feb52ebb2d981f">文書のメタデータ取得</h3>
272
+
273
+ <p>文書をパースして直接 html を生成するのではなく、<code>BlueFeather::Document</code> オブジェクトを生成することにより、その文書のメタデータを取得することができます。</p>
274
+
275
+ <pre><code>doc = BlueFeather::Document.parse(&lt;&lt;EOS)
276
+ Title: test document
277
+ CSS: style.css
278
+
279
+ test paragraph.
280
+ EOS
281
+
282
+ p doc['title'] # =&gt; "test document"
283
+ p doc['css'] # =&gt; "style.css"
284
+ p doc[:css] # =&gt; "style.css"
285
+ p doc['undefined'] # =&gt; nil
286
+
287
+ p doc.body # =&gt; "test paragraph."
288
+ </code></pre>
289
+
290
+ <p>この <code>BlueFeather::Document</code> オブジェクトから実際に html を生成するには、 <code>to_html</code> メソッドを呼んでください。</p>
291
+
292
+ <pre><code>doc.to_html
293
+ </code></pre>
294
+
295
+ </body>
296
+ </html>
@@ -0,0 +1,165 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title>クラスリファレンス - BlueFeather マニュアル</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link rel="stylesheet" type="text/css" href="black.css" />
7
+ </head>
8
+ <body>
9
+
10
+ <div class="back"><a href="index.html">BlueFeather マニュアル</a></div>
11
+
12
+ <h1 id="bfheader-50326feb7b87c1ef44c75dccdb8284ac">クラスリファレンス</h1>
13
+
14
+ <p>このリファレンス内では、BlueFeather が拡張した Markdown 記法のことを指して「BFMarkdown 記法」と書く。</p>
15
+
16
+ <ul>
17
+ <li><a href="#bfheader-80ceaec8f5a40f3d46aac3444c6df2e7" rel="toc"><code>BlueFeather</code> モジュール</a>
18
+ <ul>
19
+ <li><a href="#parse_text" rel="toc"><code>BlueFeather.parse(str)</code></a></li>
20
+ <li><a href="#bfheader-fa1477eb445b3fdc80dd2c0525218ab7" rel="toc"><code>BlueFeather.parse_text(str)</code></a></li>
21
+ <li><a href="#parse<em>text</em>file" rel="toc"><code>BlueFeather.parse_file(path)</code></a></li>
22
+ <li><a href="#bfheader-858e9b32f250472d1729d73a2609d7b9" rel="toc"><code>BlueFeather.parse_text_file(path)</code></a></li>
23
+ <li><a href="#parse_document" rel="toc"><code>BlueFeather.parse_document(str)</code></a></li>
24
+ <li><a href="#parse<em>document</em>file" rel="toc"><code>BlueFeather.parse_document_file(str)</code></a></li>
25
+ <li><a href="#bfheader-3857f80b19708653b12301c67de2e1db" rel="toc"><code>BlueFeather::VERSION</code></a></li>
26
+ <li><a href="#bfheader-042b8b21520ede9536ad15036ee9f27c" rel="toc"><code>BlueFeather::VERSION_NUMBER</code></a></li>
27
+ </ul></li>
28
+ <li><a href="#bfheader-8736ab72a1f0a3f39997a38e5ea6ffa5" rel="toc"><code>BlueFeather::Document</code> クラス</a>
29
+ <ul>
30
+ <li><a href="#bfheader-f610b3e9bb522e93c220281e2be98d96" rel="toc"><code>Document.parse(str)</code></a></li>
31
+ <li><a href="#bfheader-0ee4e10469def3879abce3265424e49a" rel="toc"><code>Document.new(headers = {}, body = '')</code></a></li>
32
+ <li><a href="#bfheader-9a4a2896cad3fd8123e63e051634fad7" rel="toc"><code>headers</code></a></li>
33
+ <li><a href="#bfheader-d80932823b30aed42cdd3426641abdc7" rel="toc"><code>body</code></a></li>
34
+ <li><a href="#bfheader-7b4733c37b3c14c458d48d40fa200d04" rel="toc"><code>self[key]</code></a></li>
35
+ <li><a href="#bfheader-6d1c97a406278a22629ccccc9590d9d6" rel="toc"><code>self[key] = value</code></a></li>
36
+ <li><a href="#bfheader-92f24a1f999095d1e7e6125d7916d913" rel="toc"><code>title</code></a></li>
37
+ <li><a href="#bfheader-e364b84145e7b2539f6f4cc865ce3605" rel="toc"><code>css</code></a></li>
38
+ <li><a href="#bfheader-ac3aad72cd17d2c5d24bbef5ce7a9a0c" rel="toc"><code>to_html</code></a></li>
39
+ </ul></li>
40
+ <li><a href="#bfheader-f93be37288db08fefc350b1b097b132a" rel="toc"><code>BlueFeather::Parser</code> クラス</a>
41
+ <ul>
42
+ <li><a href="#bfheader-e74e4d256c4beeb90140f0e59cac21a6" rel="toc"><code>Parser.new(*restrictions)</code></a></li>
43
+ <li><a href="#bfheader-a4485922bf37d1851d69cb5eb418eb6a" rel="toc"><code>parse(str)</code></a></li>
44
+ <li><a href="#bfheader-8dccda8014a084fe0edd024dbfa3ef78" rel="toc"><code>parse_text(str)</code></a></li>
45
+ <li><a href="#bfheader-7f0d5d19aaa6811892f042dbae201712" rel="toc"><code>parse_document(str)</code></a></li>
46
+ <li><a href="#bfheader-ba6534e0361442adfcad777cc2115d6b" rel="toc"><code>parse_file(path)</code></a></li>
47
+ <li><a href="#bfheader-ee572d3b913c928b30e1ebe9f074476c" rel="toc"><code>parse_text_file(path)</code></a></li>
48
+ <li><a href="#bfheader-a8490c0eed2b612ce8bf29a1e94f6120" rel="toc"><code>parse_document_file(path)</code></a></li>
49
+ <li><a href="#bfheader-d0d9c5a6e6ce645a3623698e41588143" rel="toc"><code>use_header_id</code></a></li>
50
+ <li><a href="#bfheader-add222db7e9aa13f363a2ea48c7e5e25" rel="toc"><code>use_header_id = bool</code></a></li>
51
+ <li><a href="#bfheader-0b7fc6da6625a0e867d3a1d6f063d751" rel="toc"><code>display_warnings</code></a></li>
52
+ <li><a href="#bfheader-9d774efbf227885f2175f1405f450fa7" rel="toc"><code>display_warnings = bool</code></a></li>
53
+ </ul></li>
54
+ </ul>
55
+
56
+ <h2 id="bfheader-80ceaec8f5a40f3d46aac3444c6df2e7"><code>BlueFeather</code> モジュール</h2>
57
+
58
+ <h3 id="parse_text"><code>BlueFeather.parse(str)</code></h3>
59
+
60
+ <h3 id="bfheader-fa1477eb445b3fdc80dd2c0525218ab7"><code>BlueFeather.parse_text(str)</code></h3>
61
+
62
+ <p>BFMarkdown 記法で書かれた文字列をパースして、結果のHTML片(String)を返す。</p>
63
+
64
+ <h3 id="parse_text_file"><code>BlueFeather.parse_file(path)</code></h3>
65
+
66
+ <h3 id="bfheader-858e9b32f250472d1729d73a2609d7b9"><code>BlueFeather.parse_text_file(path)</code></h3>
67
+
68
+ <p>ファイル <code>path</code> の内容を読み取ってパースし、結果のHTML片(String)を返す。以下の記述と同じ。</p>
69
+
70
+ <pre><code>BlueFeather.parse_text(File.read(path))
71
+ </code></pre>
72
+
73
+ <h3 id="parse_document"><code>BlueFeather.parse_document(str)</code></h3>
74
+
75
+ <p>BFMarkdown 記法で書かれた文字列をパースして、結果のHTML文書を返す。</p>
76
+
77
+ <h3 id="parse_document_file"><code>BlueFeather.parse_document_file(str)</code></h3>
78
+
79
+ <p>ファイル <code>path</code> の内容を読み取ってパースし、結果のHTML文書を返す。以下の記述と同じ。</p>
80
+
81
+ <pre><code>BlueFeather.parse_document(File.read(path))
82
+ </code></pre>
83
+
84
+ <h3 id="bfheader-3857f80b19708653b12301c67de2e1db"><code>BlueFeather::VERSION</code></h3>
85
+
86
+ <h3 id="bfheader-042b8b21520ede9536ad15036ee9f27c"><code>BlueFeather::VERSION_NUMBER</code></h3>
87
+
88
+ <p>BlueFeather のバージョンを表す定数。VERSION は文字列、VERSION_NUMBER は小数(Float)である。</p>
89
+
90
+ <h2 id="bfheader-8736ab72a1f0a3f39997a38e5ea6ffa5"><code>BlueFeather::Document</code> クラス</h2>
91
+
92
+ <p>文書のメタデータと Markdown テキストの組を保持するクラス。</p>
93
+
94
+ <h3 id="bfheader-f610b3e9bb522e93c220281e2be98d96"><code>Document.parse(str)</code></h3>
95
+
96
+ <p>BFMarkdown記法で書かれた文字列をパースして、Document オブジェクトを返す。この時点ではテキストの変換は行わない。</p>
97
+
98
+ <h3 id="bfheader-0ee4e10469def3879abce3265424e49a"><code>Document.new(headers = {}, body = '')</code></h3>
99
+
100
+ <p>メタデータ(Hash)とテキスト(String)から、Document オブジェクトを生成して返す。この時点ではテキストの変換は行わない。</p>
101
+
102
+ <h3 id="bfheader-9a4a2896cad3fd8123e63e051634fad7"><code>headers</code></h3>
103
+
104
+ <h3 id="bfheader-d80932823b30aed42cdd3426641abdc7"><code>body</code></h3>
105
+
106
+ <p>その文書が持つメタデータ(Hash)と元テキスト(String)へのアクセサ。</p>
107
+
108
+ <h3 id="bfheader-7b4733c37b3c14c458d48d40fa200d04"><code>self[key]</code></h3>
109
+
110
+ <h3 id="bfheader-6d1c97a406278a22629ccccc9590d9d6"><code>self[key] = value</code></h3>
111
+
112
+ <p>メタデータの値を取得/設定する。<code>key</code> は Symbol か String で、小文字と大文字は区別されない。</p>
113
+
114
+ <h3 id="bfheader-92f24a1f999095d1e7e6125d7916d913"><code>title</code></h3>
115
+
116
+ <h3 id="bfheader-e364b84145e7b2539f6f4cc865ce3605"><code>css</code></h3>
117
+
118
+ <p>それぞれ <code>doc['title']</code>, <code>doc['css']</code> と同じ。</p>
119
+
120
+ <h3 id="bfheader-ac3aad72cd17d2c5d24bbef5ce7a9a0c"><code>to_html</code></h3>
121
+
122
+ <p>その文書をHTML文書に変換する。返り値は String。</p>
123
+
124
+ <h2 id="bfheader-f93be37288db08fefc350b1b097b132a"><code>BlueFeather::Parser</code> クラス</h2>
125
+
126
+ <p>BFMarkdown 記法で書かれたテキストをパースするためのクラス。
127
+ <code>BlueFeather.parse</code> などのメソッドでは、内部的に Parser を生成して使用している。</p>
128
+
129
+ <h3 id="bfheader-e74e4d256c4beeb90140f0e59cac21a6"><code>Parser.new(*restrictions)</code></h3>
130
+
131
+ <p>Parser オブジェクトを生成する。<code>*restrictions</code> には以下の Symbol を与えることができる。</p>
132
+
133
+ <dl>
134
+ <dt>:filter_html</dt>
135
+ <dd>変換前にすべてのHTMLタグをエスケープする(=HTMLタグの記述を無効化する)。</dd>
136
+ </dl>
137
+
138
+ <h3 id="bfheader-a4485922bf37d1851d69cb5eb418eb6a"><code>parse(str)</code></h3>
139
+
140
+ <h3 id="bfheader-8dccda8014a084fe0edd024dbfa3ef78"><code>parse_text(str)</code></h3>
141
+
142
+ <h3 id="bfheader-7f0d5d19aaa6811892f042dbae201712"><code>parse_document(str)</code></h3>
143
+
144
+ <h3 id="bfheader-ba6534e0361442adfcad777cc2115d6b"><code>parse_file(path)</code></h3>
145
+
146
+ <h3 id="bfheader-ee572d3b913c928b30e1ebe9f074476c"><code>parse_text_file(path)</code></h3>
147
+
148
+ <h3 id="bfheader-a8490c0eed2b612ce8bf29a1e94f6120"><code>parse_document_file(path)</code></h3>
149
+
150
+ <p>それぞれ BlueFeather モジュールに定義された同名のメソッドと同じ。</p>
151
+
152
+ <h3 id="bfheader-d0d9c5a6e6ce645a3623698e41588143"><code>use_header_id</code></h3>
153
+
154
+ <h3 id="bfheader-add222db7e9aa13f363a2ea48c7e5e25"><code>use_header_id = bool</code></h3>
155
+
156
+ <p>見出しにIDを付ける機能を有効にするかどうかのスイッチ(標準では true)。この機能をオフにすると、BFMarkdown の目次は利用できない。</p>
157
+
158
+ <h3 id="bfheader-0b7fc6da6625a0e867d3a1d6f063d751"><code>display_warnings</code></h3>
159
+
160
+ <h3 id="bfheader-9d774efbf227885f2175f1405f450fa7"><code>display_warnings = bool</code></h3>
161
+
162
+ <p>BlueFeather では不正なIDなどを見つけたときに、出力されるHTMLの中に警告を含める機能がある。これを有効にするかどうかのスイッチ(標準では true)。</p>
163
+
164
+ </body>
165
+ </html>