File: class-reference.html

package info (click to toggle)
ruby-bluefeather 0.41-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 632 kB
  • ctags: 167
  • sloc: ruby: 4,195; makefile: 7
file content (200 lines) | stat: -rw-r--r-- 12,051 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>クラスリファレンス - BlueFeather マニュアル</title>
<link rel="stylesheet" type="text/css" href="black.css" />
</head>
<body>

<div class="back"><a href="index.html">BlueFeather マニュアル</a></div>

<h1 id="bfheader-50326feb7b87c1ef44c75dccdb8284ac">クラスリファレンス</h1>

<p>このリファレンス内では、BlueFeather が拡張した Markdown 記法のことを指して「BFMarkdown 記法」と書く。</p>

<ul>
<li><a href="#bfheader-80ceaec8f5a40f3d46aac3444c6df2e7" rel="toc"><code>BlueFeather</code> モジュール</a>
<ul>
<li><a href="#parse_text" rel="toc"><code>BlueFeather.parse(str)</code></a></li>
<li><a href="#bfheader-fa1477eb445b3fdc80dd2c0525218ab7" rel="toc"><code>BlueFeather.parse_text(str)</code></a></li>
<li><a href="#parse<em>text</em>file" rel="toc"><code>BlueFeather.parse_file(path)</code></a></li>
<li><a href="#bfheader-858e9b32f250472d1729d73a2609d7b9" rel="toc"><code>BlueFeather.parse_text_file(path)</code></a></li>
<li><a href="#parse_document" rel="toc"><code>BlueFeather.parse_document(str, default_enc = EncodingType::UTF8)</code></a></li>
<li><a href="#parse<em>document</em>file" rel="toc"><code>BlueFeather.parse_document_file(path, default_enc = EncodingType::UTF8)</code></a></li>
<li><a href="#bfheader-3857f80b19708653b12301c67de2e1db" rel="toc"><code>BlueFeather::VERSION</code></a></li>
<li><a href="#bfheader-042b8b21520ede9536ad15036ee9f27c" rel="toc"><code>BlueFeather::VERSION_NUMBER</code></a></li>
</ul></li>
<li><a href="#bfheader-8736ab72a1f0a3f39997a38e5ea6ffa5" rel="toc"><code>BlueFeather::Document</code> クラス</a>
<ul>
<li><a href="#Document-parse" rel="toc"><code>Document.parse(str, default_enc = EncodingType::UTF8)</code></a></li>
<li><a href="#Document-parse_io" rel="toc"><code>Document.parse_io(io, default_enc = EncodingType::UTF8)</code></a></li>
<li><a href="#bfheader-0ee4e10469def3879abce3265424e49a" rel="toc"><code>Document.new(headers = {}, body = '')</code></a></li>
<li><a href="#bfheader-9a4a2896cad3fd8123e63e051634fad7" rel="toc"><code>headers</code></a></li>
<li><a href="#bfheader-d80932823b30aed42cdd3426641abdc7" rel="toc"><code>body</code></a></li>
<li><a href="#bfheader-7b4733c37b3c14c458d48d40fa200d04" rel="toc"><code>self[key]</code></a></li>
<li><a href="#bfheader-6d1c97a406278a22629ccccc9590d9d6" rel="toc"><code>self[key] = value</code></a></li>
<li><a href="#bfheader-92f24a1f999095d1e7e6125d7916d913" rel="toc"><code>title</code></a></li>
<li><a href="#bfheader-e364b84145e7b2539f6f4cc865ce3605" rel="toc"><code>css</code></a></li>
<li><a href="#bfheader-75ce338ba301a5d0566fc17b978e7ef9" rel="toc"><code>encoding_type</code></a></li>
<li><a href="#bfheader-ac3aad72cd17d2c5d24bbef5ce7a9a0c" rel="toc"><code>to_html</code></a></li>
</ul></li>
<li><a href="#bfheader-f93be37288db08fefc350b1b097b132a" rel="toc"><code>BlueFeather::Parser</code> クラス</a>
<ul>
<li><a href="#bfheader-e74e4d256c4beeb90140f0e59cac21a6" rel="toc"><code>Parser.new(*restrictions)</code></a></li>
<li><a href="#bfheader-a4485922bf37d1851d69cb5eb418eb6a" rel="toc"><code>parse(str)</code></a></li>
<li><a href="#bfheader-8dccda8014a084fe0edd024dbfa3ef78" rel="toc"><code>parse_text(str)</code></a></li>
<li><a href="#bfheader-7f0d5d19aaa6811892f042dbae201712" rel="toc"><code>parse_document(str)</code></a></li>
<li><a href="#bfheader-ba6534e0361442adfcad777cc2115d6b" rel="toc"><code>parse_file(path)</code></a></li>
<li><a href="#bfheader-ee572d3b913c928b30e1ebe9f074476c" rel="toc"><code>parse_text_file(path)</code></a></li>
<li><a href="#bfheader-a8490c0eed2b612ce8bf29a1e94f6120" rel="toc"><code>parse_document_file(path)</code></a></li>
<li><a href="#bfheader-d0d9c5a6e6ce645a3623698e41588143" rel="toc"><code>use_header_id</code></a></li>
<li><a href="#bfheader-add222db7e9aa13f363a2ea48c7e5e25" rel="toc"><code>use_header_id = bool</code></a></li>
<li><a href="#bfheader-0b7fc6da6625a0e867d3a1d6f063d751" rel="toc"><code>display_warnings</code></a></li>
<li><a href="#bfheader-9d774efbf227885f2175f1405f450fa7" rel="toc"><code>display_warnings = bool</code></a></li>
</ul></li>
<li><a href="#EncodingType" rel="toc"><code>BlueFeather::EncodingType</code> モジュール</a>
<ul>
<li><a href="#bfheader-09f0d7e312745126885b6e05dbb8871d" rel="toc"><code>UTF8</code>, <code>UTF_8</code></a></li>
<li><a href="#bfheader-7bf1da914437f82fadb58dba6bb64656" rel="toc"><code>EUC</code>, <code>EUCJP</code>, <code>EUC_JP</code></a></li>
<li><a href="#bfheader-078b01e339b95e89823c0a1dc642ee16" rel="toc"><code>SJIS</code>, <code>SHIFT_JIS</code></a></li>
<li><a href="#bfheader-936a18b71e0ca92a9d907406dbb7b411" rel="toc"><code>ASCII</code>, <code>US_ASCII</code></a></li>
</ul></li>
</ul>

<h2 id="bfheader-80ceaec8f5a40f3d46aac3444c6df2e7"><code>BlueFeather</code> モジュール</h2>

<h3 id="parse_text"><code>BlueFeather.parse(str)</code></h3>

<h3 id="bfheader-fa1477eb445b3fdc80dd2c0525218ab7"><code>BlueFeather.parse_text(str)</code></h3>

<p>BFMarkdown 記法で書かれた文字列をパースして、結果のHTML片(String)を返す。</p>

<h3 id="parse_text_file"><code>BlueFeather.parse_file(path)</code></h3>

<h3 id="bfheader-858e9b32f250472d1729d73a2609d7b9"><code>BlueFeather.parse_text_file(path)</code></h3>

<p>ファイル <code>path</code> の内容を読み取ってパースし、結果のHTML片(String)を返す。以下の記述と同じ。</p>

<pre><code>BlueFeather.parse_text(File.read(path))
</code></pre>

<h3 id="parse_document"><code>BlueFeather.parse_document(str, default_enc = EncodingType::UTF8)</code></h3>

<p>BFMarkdown 記法で書かれた文字列をパースして、結果のHTML文書を返す。</p>

<p>default_enc は <a href="#EncodingType">EncodingType 定数</a>で指定することができる。
詳細については<a href="encoding-rule.html">エンコーディングの取り扱い</a>を参照。</p>

<h3 id="parse_document_file"><code>BlueFeather.parse_document_file(path, default_enc = EncodingType::UTF8)</code></h3>

<p>ファイル <code>path</code> の内容を読み取ってパースし、結果のHTML文書を返す。以下の記述と同じ。</p>

<pre><code>BlueFeather.parse_document(File.read(path), default_enc)
</code></pre>

<h3 id="bfheader-3857f80b19708653b12301c67de2e1db"><code>BlueFeather::VERSION</code></h3>

<h3 id="bfheader-042b8b21520ede9536ad15036ee9f27c"><code>BlueFeather::VERSION_NUMBER</code></h3>

<p>BlueFeather のバージョンを表す定数。VERSION は文字列、VERSION_NUMBER は小数(Float)である。</p>

<h2 id="bfheader-8736ab72a1f0a3f39997a38e5ea6ffa5"><code>BlueFeather::Document</code> クラス</h2>

<p>文書のメタデータと Markdown テキストの組を保持するクラス。</p>

<h3 id="Document-parse"><code>Document.parse(str, default_enc = EncodingType::UTF8)</code></h3>

<p>BFMarkdown記法で書かれた文字列をパースして、Document オブジェクトを返す。この時点ではテキストの変換は行わない。</p>

<p>default_enc は <a href="#EncodingType">EncodingType 定数</a>で指定することができる。
詳細については<a href="encoding-rule.html">エンコーディングの取り扱い</a>を参照。</p>

<h3 id="Document-parse_io"><code>Document.parse_io(io, default_enc = EncodingType::UTF8)</code></h3>

<p>引数として IO オブジェクトを受け取ること以外は <a href="#Document-parse"><code>Document.parse</code></a> と同じ。</p>

<h3 id="bfheader-0ee4e10469def3879abce3265424e49a"><code>Document.new(headers = {}, body = '')</code></h3>

<p>メタデータ(Hash)とテキスト(String)から、Document オブジェクトを生成して返す。この時点ではテキストの変換は行わない。</p>

<h3 id="bfheader-9a4a2896cad3fd8123e63e051634fad7"><code>headers</code></h3>

<h3 id="bfheader-d80932823b30aed42cdd3426641abdc7"><code>body</code></h3>

<p>その文書が持つメタデータ(Hash)と元テキスト(String)へのアクセサ。</p>

<h3 id="bfheader-7b4733c37b3c14c458d48d40fa200d04"><code>self[key]</code></h3>

<h3 id="bfheader-6d1c97a406278a22629ccccc9590d9d6"><code>self[key] = value</code></h3>

<p>メタデータの値を取得/設定する。<code>key</code> は Symbol か String で、小文字と大文字は区別されない。</p>

<h3 id="bfheader-92f24a1f999095d1e7e6125d7916d913"><code>title</code></h3>

<h3 id="bfheader-e364b84145e7b2539f6f4cc865ce3605"><code>css</code></h3>

<p>それぞれ <code>doc['title']</code>, <code>doc['css']</code> と同じ。</p>

<h3 id="bfheader-75ce338ba301a5d0566fc17b978e7ef9"><code>encoding_type</code></h3>

<p>その文書のエンコーディングを取得する。返り値は EncodingType モジュール内の定数か、もしくは nil。</p>

<h3 id="bfheader-ac3aad72cd17d2c5d24bbef5ce7a9a0c"><code>to_html</code></h3>

<p>その文書をHTML文書に変換する。返り値は String。</p>

<h2 id="bfheader-f93be37288db08fefc350b1b097b132a"><code>BlueFeather::Parser</code> クラス</h2>

<p>BFMarkdown 記法で書かれたテキストをパースするためのクラス。
<code>BlueFeather.parse</code> などのメソッドでは、内部的に Parser を生成して使用している。</p>

<h3 id="bfheader-e74e4d256c4beeb90140f0e59cac21a6"><code>Parser.new(*restrictions)</code></h3>

<p>Parser オブジェクトを生成する。<code>*restrictions</code> には以下の Symbol を与えることができる。</p>

<dl>
  <dt>:filter_html</dt>
  <dd>変換前にすべてのHTMLタグをエスケープする(=HTMLタグの記述を無効化する)。</dd>
</dl>

<h3 id="bfheader-a4485922bf37d1851d69cb5eb418eb6a"><code>parse(str)</code></h3>

<h3 id="bfheader-8dccda8014a084fe0edd024dbfa3ef78"><code>parse_text(str)</code></h3>

<h3 id="bfheader-7f0d5d19aaa6811892f042dbae201712"><code>parse_document(str)</code></h3>

<h3 id="bfheader-ba6534e0361442adfcad777cc2115d6b"><code>parse_file(path)</code></h3>

<h3 id="bfheader-ee572d3b913c928b30e1ebe9f074476c"><code>parse_text_file(path)</code></h3>

<h3 id="bfheader-a8490c0eed2b612ce8bf29a1e94f6120"><code>parse_document_file(path)</code></h3>

<p>それぞれ BlueFeather モジュールに定義された同名のメソッドと同じ。</p>

<h3 id="bfheader-d0d9c5a6e6ce645a3623698e41588143"><code>use_header_id</code></h3>

<h3 id="bfheader-add222db7e9aa13f363a2ea48c7e5e25"><code>use_header_id = bool</code></h3>

<p>見出しにIDを付ける機能を有効にするかどうかのスイッチ(標準では true)。この機能をオフにすると、BFMarkdown の目次は利用できない。</p>

<h3 id="bfheader-0b7fc6da6625a0e867d3a1d6f063d751"><code>display_warnings</code></h3>

<h3 id="bfheader-9d774efbf227885f2175f1405f450fa7"><code>display_warnings = bool</code></h3>

<p>BlueFeather では不正なIDなどを見つけたときに、出力されるHTMLの中に警告を含める機能がある。これを有効にするかどうかのスイッチ(標準では true)。</p>

<h2 id="EncodingType"><code>BlueFeather::EncodingType</code> モジュール</h2>

<h3 id="bfheader-09f0d7e312745126885b6e05dbb8871d"><code>UTF8</code>, <code>UTF_8</code></h3>

<h3 id="bfheader-7bf1da914437f82fadb58dba6bb64656"><code>EUC</code>, <code>EUCJP</code>, <code>EUC_JP</code></h3>

<h3 id="bfheader-078b01e339b95e89823c0a1dc642ee16"><code>SJIS</code>, <code>SHIFT_JIS</code></h3>

<h3 id="bfheader-936a18b71e0ca92a9d907406dbb7b411"><code>ASCII</code>, <code>US_ASCII</code></h3>

<p>BlueFeather におけるエンコーディングの種類を表す定数(String)。</p>

</body>
</html>