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.
Files changed (46) hide show
  1. data/Rakefile.rb +168 -0
  2. data/bin/bluefeather +4 -0
  3. data/doc/author-and-license.bfdoc +16 -0
  4. data/doc/base.css +135 -0
  5. data/doc/basic-usage.bfdoc +265 -0
  6. data/doc/black.css +130 -0
  7. data/doc/class-reference.bfdoc +105 -0
  8. data/doc/difference.bfdoc +63 -0
  9. data/doc/en/author-and-license.bfdoc +20 -0
  10. data/doc/en/base.css +136 -0
  11. data/doc/en/basic-usage.bfdoc +266 -0
  12. data/doc/en/black.css +130 -0
  13. data/doc/en/class-reference.bfdoc +6 -0
  14. data/doc/en/difference.bfdoc +72 -0
  15. data/doc/en/format-extension.bfdoc +324 -0
  16. data/doc/en/index.bfdoc +41 -0
  17. data/doc/en/metadata-reference.bfdoc +7 -0
  18. data/doc/format-extension.bfdoc +325 -0
  19. data/doc/index.bfdoc +36 -0
  20. data/doc/metadata-reference.bfdoc +86 -0
  21. data/lib/bluefeather.rb +1872 -0
  22. data/lib/bluefeather/cui.rb +207 -0
  23. data/license/gpl-2.0.txt +339 -0
  24. data/license/gpl.ja.txt +416 -0
  25. data/original-tests/00_Class.tests.rb +42 -0
  26. data/original-tests/05_Markdown.tests.rb +1530 -0
  27. data/original-tests/10_Bug.tests.rb +44 -0
  28. data/original-tests/15_Contrib.tests.rb +130 -0
  29. data/original-tests/bftestcase.rb +278 -0
  30. data/original-tests/data/antsugar.txt +34 -0
  31. data/original-tests/data/ml-announce.txt +17 -0
  32. data/original-tests/data/re-overflow.txt +67 -0
  33. data/original-tests/data/re-overflow2.txt +281 -0
  34. data/readme_en.txt +37 -0
  35. data/readme_ja.txt +33 -0
  36. data/spec/auto-link.rb +100 -0
  37. data/spec/code-block.rb +91 -0
  38. data/spec/dl.rb +182 -0
  39. data/spec/escape-char.rb +18 -0
  40. data/spec/footnote.rb +34 -0
  41. data/spec/header-id.rb +38 -0
  42. data/spec/lib/common.rb +103 -0
  43. data/spec/table.rb +70 -0
  44. data/spec/toc.rb +64 -0
  45. data/spec/warning.rb +61 -0
  46. metadata +99 -0
@@ -0,0 +1,266 @@
1
+ Title: Installing and Basic Usage - BlueFeather Manual
2
+ CSS: black.css
3
+
4
+ <div class="back"><a href="index.html">BlueFeather Manual</a></div>
5
+
6
+
7
+
8
+ Installing and Basic Usage
9
+ ====
10
+
11
+ This document describes only usage of the software. If you want to know about
12
+ syntax, see [Markdown Syntax Extension](format-extension.html).
13
+
14
+ {toc}
15
+
16
+
17
+ Install
18
+ ----
19
+ Run setup.rb. Then required files will be copied and installing will be complete.
20
+
21
+ % ruby setup.rb
22
+
23
+ Or use RubyGems.
24
+
25
+ % gem install bluefeather
26
+
27
+
28
+ Use by Command-line
29
+ ----
30
+
31
+ ### Basic
32
+
33
+ If installing is correctly completed, you can use `bluefeather` command. This
34
+ command convert Markdown text to html.
35
+
36
+ bluefeather [options] file1 [file2] [file3] ...
37
+
38
+ ~
39
+
40
+ % bluefeather *.bftext
41
+ example1.bftext => example1.html (4240 byte)
42
+ example2.bftext => example2.html (5613 byte)
43
+ example3.bftext => example3.html (10499 byte)
44
+ %
45
+
46
+ If you know better about options, see the section of [Command-line Option](#commandline-options).
47
+
48
+ ### Extname Switch
49
+
50
+ `bluefeather` command switches by extname of an input file how generate a html file.
51
+
52
+ `.md`, `.bfdoc`
53
+ :generate html document
54
+
55
+ others
56
+ :generate html part
57
+
58
+
59
+
60
+ For example, see the text.
61
+
62
+ test paragraph.
63
+
64
+ If this text is named '`test1.bftext`', `bluefeather` generates `test1.html` such as this.
65
+
66
+ <p>test paragraph.</p>
67
+
68
+ But this text is named '`test1.bfdoc`', generated html is changed.
69
+
70
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
71
+ <html>
72
+ <head>
73
+ <title>no title (Generated by BlueFeather)</title>
74
+ </head>
75
+ <body>
76
+
77
+ <p>test paragraph.</p>
78
+
79
+ </body>
80
+ </html>
81
+
82
+ If the converted document is include h1 element, BlueFeather use it's content for title of html document.
83
+
84
+ test2.bfdoc
85
+
86
+ :
87
+
88
+ Test Document
89
+ =============
90
+
91
+ test paragraph.
92
+
93
+ test2.html (output)
94
+
95
+ :
96
+
97
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
98
+ <html>
99
+ <head>
100
+ <title>Test Document</title>
101
+ </head>
102
+ <body>
103
+
104
+ <h1 id="bfheader-a5decd745d43af4aa8cf62eef5be43ac">Test Document</h1>
105
+
106
+ <p>test paragraph.</p>
107
+
108
+ </body>
109
+ </html>
110
+
111
+
112
+ ### Document Metadata
113
+
114
+ You can add *document metadata* to files which have extname `.bfdoc` or `.md`
115
+
116
+
117
+ test3.bfdoc
118
+
119
+ :
120
+
121
+ Title: Test Document
122
+ CSS: style.css
123
+
124
+ Test paragraph.
125
+
126
+ test3.html
127
+
128
+ :
129
+
130
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
131
+ <html>
132
+ <head>
133
+ <title>Test Document</title>
134
+ <link rel="stylesheet" type="text/css" href="style.css" />
135
+ </head>
136
+ <body>
137
+
138
+ <p>Test paragraph.</p>
139
+
140
+ </body>
141
+ </html>
142
+
143
+
144
+
145
+ If you know better about metadata, see the section of [Metadata Reference](metadata-reference.html).
146
+
147
+ ### stdin-mode
148
+
149
+ If you use stdin and stdout, specify a parameter only `-`. This mode is useful for pipe-line.
150
+
151
+ % bluefeather -
152
+
153
+
154
+ ### Command-line Options {#commandline-options}
155
+
156
+ % bluefeather --help
157
+ bluefeather - Extended Markdown Converter
158
+
159
+ Usage: bluefeather [options] file1 [file2 file3 ..]
160
+
161
+ Options:
162
+ -e, --encoding NAME parse input files as encoding of NAME.
163
+ (s[hift-jis] / e[uc-jp] / u[tf-8] / n[one]. default: 'utf-8')
164
+ -f, --format TYPE specify format.
165
+ (t[ext] => text mode
166
+ d[ocument] => document mode)
167
+ -h, --help show this help.
168
+ -o, --output DIR output files to DIR. (default: same as input file)
169
+ -q, --quiet no output to stderr.
170
+ --suffix .SUF specify suffix of output files. (default: '.html')
171
+ -v, --verbose verbose mode - output detail of operation.
172
+ --version show BlueFeather version.
173
+
174
+ Advanced Usage:
175
+ * If specify files only '-', bluefeather read from stdin and write to stdout.
176
+
177
+
178
+ Example:
179
+ bluefeather *.bftext *.bfdoc
180
+ bluefeather -v --sufix .xhtml -o ../ sample.markdown
181
+ bluefeather -
182
+
183
+ More info:
184
+ see <http://ruby.morphball.net/bluefeather/>
185
+ %
186
+
187
+ Use in Ruby Script
188
+ ----
189
+
190
+ ### Basic
191
+
192
+ Most basic method is `BlueFeather.parse`.
193
+
194
+ require 'bluefeather'
195
+
196
+ str = "most basic example."
197
+ puts BlueFeather.parse(str) #=> "<p>most basic example.</p>"
198
+
199
+ And you can use `BlueFeather.parse_file`.
200
+
201
+ BlueFeather.parse_file('test1.txt')
202
+ BlueFeather.parse_file('test2.markdown')
203
+ BlueFeather.parse_file('test3.bftext')
204
+
205
+
206
+ ### Generate HTML Document ###
207
+
208
+ If you want a html document not html fragment, you may use `parse_document` or `parse_document_file`.
209
+
210
+ test.bfdoc
211
+
212
+ : The sentence is expected as HTML.
213
+
214
+ test.rb
215
+
216
+ :
217
+
218
+ require 'bluefeather'
219
+
220
+ puts '-- parse_file --'
221
+ puts BlueFeather.parse_file('test.bfdoc')
222
+
223
+ puts '-- parse_document_file --'
224
+ puts BlueFeather.parse_document_file('test.bfdoc')
225
+
226
+ Result
227
+
228
+ :
229
+
230
+ -- parse_file --
231
+ <p>The sentence is expected as HTML.</p>
232
+
233
+ -- parse_document_file --
234
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
235
+ <html>
236
+ <head>
237
+ <title>no title (Generated by BlueFeather)</title>
238
+ </head>
239
+ <body>
240
+
241
+ <p>The sentence is expected as HTML.</p>
242
+
243
+ </body>
244
+ </html>
245
+
246
+ ### Get document metadata ###
247
+
248
+ If you want to get directly metadata of document, instead of BlueFeather module method, you should use `BlueFeather::Document` class.
249
+
250
+ doc = BlueFeather::Document.parse(<<EOS)
251
+ Title: test document
252
+ CSS: style.css
253
+
254
+ test paragraph.
255
+ EOS
256
+
257
+ p doc['title'] # => "test document"
258
+ p doc['css'] # => "style.css"
259
+ p doc[:css] # => "style.css"
260
+ p doc['undefined'] # => nil
261
+
262
+ p doc.body # => "test paragraph."
263
+
264
+ `to_html` parses the text and generates an html document actually.
265
+
266
+ doc.to_html
data/doc/en/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,6 @@
1
+ Title: Class Reference - BlueFeather Manual
2
+ CSS: black.css
3
+
4
+ <div class="back"><a href="index.html">BlueFeather Manual</a></div>
5
+
6
+ (Not translated yet. see the [Japanese version](../class-reference.html))
@@ -0,0 +1,72 @@
1
+ Title: Difference from BlueCloth - BlueFeather Manual
2
+ CSS: black.css
3
+
4
+ <div class="back"><a href="index.html">BlueFeather Manual</a></div>
5
+
6
+ Difference from BlueCloth
7
+ ====
8
+
9
+ {toc}
10
+
11
+
12
+ Markdown Syntax Extension
13
+ ----
14
+ BlueFeather has imported some extension of syntax from [PHP Markdown Extra][]
15
+ -- definition list, table, and others. And that, BlueFeather has been added
16
+ original extension -- TOC generation and block separator. See the
17
+ [Markdown Syntax Extension](format-extension.html).
18
+
19
+
20
+
21
+ Change of Interface
22
+ ----
23
+ BlueCloth
24
+
25
+ :
26
+
27
+ require 'bluecloth'
28
+
29
+ puts BlueCloth.new(str).to_html
30
+
31
+ BlueFeather
32
+
33
+ :
34
+
35
+ require 'bluefeather'
36
+
37
+ puts BlueFeather.parse(str)
38
+
39
+ See the [Installing and Basic Usage](basic-usage.html).
40
+
41
+
42
+
43
+
44
+ Generating Entire HTML Document
45
+ ----
46
+ Imported by [Maruku][], BlueFeather can generate entire html document not only
47
+ html fragment. And that, *document metadata* enables to specify title and URL of
48
+ css-stylesheet.
49
+
50
+ See the [Installing and Basic Usage](basic-usage.html) and [Metadata Reference](metadata-reference.html).
51
+
52
+
53
+ Bug Fix to BlueCloth 1.0.0
54
+ ----
55
+
56
+ These bugs are fixed on BlueFeather.
57
+
58
+ 1. Some Regexp is set encoding of Shift-JIS.
59
+ 2. '`<mail+address@example.com>`' is not parsed such as mailto-anchor. (ex: GMail alias charcters)
60
+ 3. Link id definition indented 4-or-more spaces or tab is not parsed such as
61
+ code block.
62
+ 4. `<hr />` indented 4-or-more spaces or tab is not parsed such as
63
+ code block.
64
+
65
+ Change of EmptyElementSuffix
66
+ ----
67
+
68
+ BlueCloth output empty element tags, `<tag/>`. Instead BlueFeather output `<tag />`.
69
+
70
+
71
+ [Maruku]: http://maruku.rubyforge.org/
72
+ [PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/