karmi-markout 0.0.0

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,235 @@
1
+ Markdown
2
+ ========
3
+
4
+ Download
5
+ --------
6
+
7
+ [Markdown 1.0.1][dl] (18 KB) -- 17 Dec 2004
8
+
9
+ [dl]: http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
10
+
11
+
12
+ Introduction
13
+ ------------
14
+
15
+ Markdown is a text-to-HTML conversion tool for web writers. Markdown
16
+ allows you to write using an easy-to-read, easy-to-write plain text
17
+ format, then convert it to structurally valid XHTML (or HTML).
18
+
19
+ Thus, "Markdown" is two things: (1) a plain text formatting syntax;
20
+ and (2) a software tool, written in Perl, that converts the plain text
21
+ formatting to HTML. See the [Syntax][] page for details pertaining to
22
+ Markdown's formatting syntax. You can try it out, right now, using the
23
+ online [Dingus][].
24
+
25
+ [syntax]: /projects/markdown/syntax
26
+ [dingus]: /projects/markdown/dingus
27
+
28
+ The overriding design goal for Markdown's formatting syntax is to make
29
+ it as readable as possible. The idea is that a Markdown-formatted
30
+ document should be publishable as-is, as plain text, without looking
31
+ like it's been marked up with tags or formatting instructions. While
32
+ Markdown's syntax has been influenced by several existing text-to-HTML
33
+ filters, the single biggest source of inspiration for Markdown's
34
+ syntax is the format of plain text email.
35
+
36
+ The best way to get a feel for Markdown's formatting syntax is simply
37
+ to look at a Markdown-formatted document. For example, you can view
38
+ the Markdown source for the article text on this page here:
39
+ <http://daringfireball.net/projects/markdown/index.text>
40
+
41
+ (You can use this '.text' suffix trick to view the Markdown source for
42
+ the content of each of the pages in this section, e.g. the
43
+ [Syntax][s_src] and [License][l_src] pages.)
44
+
45
+ [s_src]: /projects/markdown/syntax.text
46
+ [l_src]: /projects/markdown/license.text
47
+
48
+ Markdown is free software, available under a BSD-style open source
49
+ license. See the [License] [pl] page for more information.
50
+
51
+ [pl]: /projects/markdown/license
52
+
53
+
54
+ Discussion List <a id="discussion-list" />
55
+ ---------------
56
+
57
+ I've set up a public [mailing list for discussion about Markdown] [ml].
58
+ Any topic related to Markdown -- both its formatting syntax and
59
+ its software -- is fair game for discussion. Anyone who is interested
60
+ is welcome to join.
61
+
62
+ It's my hope that the mailing list will lead to good ideas for future
63
+ improvements to Markdown.
64
+
65
+ [ml]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
66
+
67
+
68
+ Installation and Requirements <a id="install" />
69
+ -----------------------------
70
+
71
+ Markdown requires Perl 5.6.0 or later. Welcome to the 21st Century.
72
+ Markdown also requires the standard Perl library module [Digest::MD5]
73
+ [md5], which is probably already installed on your server.
74
+
75
+ [md5]: http://search.cpan.org/dist/Digest-MD5/MD5.pm
76
+
77
+
78
+ ### Movable Type ###
79
+
80
+ Markdown works with Movable Type version 2.6 or later (including
81
+ Movable Type 3.0).
82
+
83
+ 1. Copy the "Markdown.pl" file into your Movable Type "plugins"
84
+ directory. The "plugins" directory should be in the same directory
85
+ as "mt.cgi"; if the "plugins" directory doesn't already exist, use
86
+ your FTP program to create it. Your installation should look like
87
+ this:
88
+
89
+ (mt home)/plugins/Markdown.pl
90
+
91
+ 2. Once installed, Markdown will appear as an option in Movable Type's
92
+ Text Formatting pop-up menu. This is selectable on a per-post basis:
93
+
94
+ ![Screenshot of Movable Type 'Text Formatting' Menu][tfmenu]
95
+
96
+ Markdown translates your posts to HTML when you publish; the posts
97
+ themselves are stored in your MT database in Markdown format.
98
+
99
+ 3. If you also install SmartyPants 1.5 (or later), Markdown will
100
+ offer a second text formatting option: "Markdown With
101
+ SmartyPants". This option is the same as the regular "Markdown"
102
+ formatter, except that it automatically uses SmartyPants to create
103
+ typographically correct curly quotes, em-dashes, and ellipses. See
104
+ the [SmartyPants web page][sp] for more information.
105
+
106
+ 4. To make Markdown (or "Markdown With SmartyPants") your default
107
+ text formatting option for new posts, go to Weblog Config:
108
+ Preferences.
109
+
110
+ Note that by default, Markdown produces XHTML output. To configure
111
+ Markdown to produce HTML 4 output, see "Configuration", below.
112
+
113
+ [sp]: http://daringfireball.net/projects/smartypants/
114
+
115
+
116
+
117
+ ### Blosxom ###
118
+
119
+ Markdown works with Blosxom version 2.0 or later.
120
+
121
+ 1. Rename the "Markdown.pl" plug-in to "Markdown" (case is
122
+ important). Movable Type requires plug-ins to have a ".pl"
123
+ extension; Blosxom forbids it.
124
+
125
+ 2. Copy the "Markdown" plug-in file to your Blosxom plug-ins folder.
126
+ If you're not sure where your Blosxom plug-ins folder is, see the
127
+ Blosxom documentation for information.
128
+
129
+ 3. That's it. The entries in your weblog will now automatically be
130
+ processed by Markdown.
131
+
132
+ 4. If you'd like to apply Markdown formatting only to certain
133
+ posts, rather than all of them, Markdown can optionally be used in
134
+ conjunction with Blosxom's [Meta][] plug-in. First, install the
135
+ Meta plug-in. Next, open the Markdown plug-in file in a text
136
+ editor, and set the configuration variable `$g_blosxom_use_meta`
137
+ to 1. Then, simply include a "`meta-markup: Markdown`" header line
138
+ at the top of each post you compose using Markdown.
139
+
140
+ [meta]: http://www.blosxom.com/plugins/meta/meta.htm
141
+
142
+
143
+ ### BBEdit ###
144
+
145
+ Markdown works with BBEdit 6.1 or later on Mac OS X. It also works
146
+ with BBEdit 5.1 or later and MacPerl 5.6.1 on Mac OS 8.6 or later. If
147
+ you're running Mac OS X 10.2 (Jaguar), you may need to install the
148
+ Perl module [Digest::MD5] [md5] from CPAN; Digest::MD5 comes
149
+ pre-installed on Mac OS X 10.3 (Panther).
150
+
151
+ 1. Copy the "Markdown.pl" file to appropriate filters folder in your
152
+ "BBEdit Support" folder. On Mac OS X, this should be:
153
+
154
+ BBEdit Support/Unix Support/Unix Filters/
155
+
156
+ See the BBEdit documentation for more details on the location of
157
+ these folders.
158
+
159
+ You can rename "Markdown.pl" to whatever you wish.
160
+
161
+ 2. That's it. To use Markdown, select some text in a BBEdit document,
162
+ then choose Markdown from the Filters sub-menu in the "#!" menu, or
163
+ the Filters floating palette
164
+
165
+
166
+
167
+ Configuration <a id="configuration"></a>
168
+ -------------
169
+
170
+ By default, Markdown produces XHTML output for tags with empty elements.
171
+ E.g.:
172
+
173
+ <br />
174
+
175
+ Markdown can be configured to produce HTML-style tags; e.g.:
176
+
177
+ <br>
178
+
179
+
180
+ ### Movable Type ###
181
+
182
+ You need to use a special `MTMarkdownOptions` container tag in each
183
+ Movable Type template where you want HTML 4-style output:
184
+
185
+ <MTMarkdownOptions output='html4'>
186
+ ... put your entry content here ...
187
+ </MTMarkdownOptions>
188
+
189
+ The easiest way to use MTMarkdownOptions is probably to put the
190
+ opening tag right after your `<body>` tag, and the closing tag right
191
+ before `</body>`.
192
+
193
+ To suppress Markdown processing in a particular template, i.e. to
194
+ publish the raw Markdown-formatted text without translation into
195
+ (X)HTML, set the `output` attribute to 'raw':
196
+
197
+ <MTMarkdownOptions output='raw'>
198
+ ... put your entry content here ...
199
+ </MTMarkdownOptions>
200
+
201
+
202
+ ### Command-Line ###
203
+
204
+ Use the `--html4tags` command-line switch to produce HTML output from a
205
+ Unix-style command line. E.g.:
206
+
207
+ % perl Markdown.pl --html4tags foo.text
208
+
209
+ Type `perldoc Markdown.pl`, or read the POD documentation within the
210
+ Markdown.pl source code for more information.
211
+
212
+
213
+ Acknowledgements <a id="acknowledgements" />
214
+ ----------------
215
+
216
+ [Aaron Swartz][] deserves a tremendous amount of credit for helping to
217
+ design Markdown's formatting syntax. Markdown is *much* better thanks
218
+ to Aaron's ideas, feedback, and testing. Also, Aaron's [html2text][]
219
+ is a very handy (and free) utility for turning HTML into
220
+ Markdown-formatted plain text.
221
+
222
+ [Nathaniel Irons][], [Dan Benjamin][], [Daniel Bogan][], and [Jason Perkins][]
223
+ also deserve thanks for their feedback.
224
+
225
+ [Michel Fortin][] has ported Markdown to PHP; it's a splendid port, and highly recommended for anyone looking for a PHP implementation of Markdown.
226
+
227
+ [Aaron Swartz]: http://www.aaronsw.com/
228
+ [Nathaniel Irons]: http://bumppo.net/
229
+ [Dan Benjamin]: http://hivelogic.com/
230
+ [Daniel Bogan]: http://waferbaby.com/
231
+ [Jason Perkins]: http://pressedpants.com/
232
+ [Michel Fortin]: http://www.michelf.com/projects/php-markdown/
233
+ [html2text]: http://www.aaronsw.com/2002/html2text/
234
+
235
+ [tfmenu]: mt_textformat_menu.png
@@ -0,0 +1,33 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'markout/document'
3
+
4
+ module Markout
5
+ class DocumentTest < Test::Unit::TestCase
6
+
7
+ def test_should_load_file
8
+ assert_nothing_raised { new_valid_document }
9
+ end
10
+
11
+ def test_should_raise_exception_when_file_not_found
12
+ assert_raise(FileNotFound) { @document = Document.new( "tmp/xxx/yyy/zzz/#{Time.now.to_i}" ) }
13
+ end
14
+
15
+ def test_should_set_paths
16
+ new_valid_document
17
+ assert_not_nil @document.path
18
+ assert_equal File.join( File.expand_path(File.dirname(__FILE__)), '/fixtures/markdown.txt' ), @document.path
19
+ assert_equal Pathname.new( File.expand_path(File.dirname(__FILE__)) + '/fixtures'), @document.base_path
20
+ end
21
+
22
+ def test_should_read_file_contents
23
+ new_valid_document
24
+ assert_not_nil @document.content
25
+ assert_equal @document.content, fixture('markdown.txt')
26
+ end
27
+
28
+ def new_valid_document
29
+ @document = Document.new( fixture_file('markdown.txt') )
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,13 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'markout/formatter'
3
+
4
+ module Markout
5
+ class FormatterTest < Test::Unit::TestCase
6
+
7
+ def test_should_raise_exception
8
+ @formatter = Formatter.new( Document.new( fixture_file('markdown.txt') ) )
9
+ assert_raise(NoMethodError) { @formatter.export }
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,34 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'markout/formatter'
3
+ require 'markout/formatters/html/html'
4
+
5
+ module Markout
6
+ class HtmlTest < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @document = Document.new( fixture_file('markdown.txt') )
10
+ end
11
+
12
+ def test_should_set_default_template
13
+ @formatter = Html.new( @document )
14
+ assert_equal 'default', @formatter.send(:template_name)
15
+ assert File.exist?(@formatter.send(:template_path))
16
+ end
17
+
18
+ def test_should_set_template
19
+ @formatter = Html.new( @document, :template => 'my_special_template' )
20
+ assert_equal 'my_special_template', @formatter.send(:template_name)
21
+ end
22
+
23
+ def test_should_match_title
24
+ @formatter = Html.new( @document )
25
+ assert_equal 'Markdown', @formatter.send(:title)
26
+ end
27
+
28
+ def test_should_suck_in_images
29
+ @formatter = Html.new( @document )
30
+ assert @formatter.export =~ Regexp.new("<img src=\"data:image\/png;base64,#{Base64.encode64(fixture('mt_textformat_menu.png'))[0..20]}"), "Should read image contents into HTML"
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'markout/output'
3
+
4
+ module Markout
5
+ class OutputTest < Test::Unit::TestCase
6
+
7
+ def test_default_initialization
8
+ assert_nothing_raised { default_output }
9
+ assert_not_nil @output.document
10
+ assert_not_nil @output.format
11
+ assert_not_nil @output.formatter
12
+ assert_equal Markout::Html, @output.formatter.class
13
+ end
14
+
15
+ def test_export
16
+ default_output
17
+ assert_equal fixture('markdown.html'), @output.export
18
+ end
19
+
20
+ def test_export_to_file
21
+ # TODO
22
+ end
23
+
24
+ def default_output
25
+ @output = Output.new( fixture_file('markdown.txt') )
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ # Load all testfiles excluding self
4
+ (Dir['*_test.rb'] - [File.basename(__FILE__)]).each { |testcase| require testcase }
5
+
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'markout'
7
+
8
+ def fixture(name)
9
+ File.read( File.join(File.dirname(__FILE__), 'fixtures', name.to_s) )
10
+ end
11
+
12
+ def fixture_file(name)
13
+ File.join(File.dirname(__FILE__), 'fixtures', name.to_s)
14
+ end
15
+
16
+ class Test::Unit::TestCase
17
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: karmi-markout
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Karel Minarik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-30 00:00:00 -07:00
13
+ default_executable: markout
14
+ dependencies: []
15
+
16
+ description:
17
+ email: karmi@karmi.cz
18
+ executables:
19
+ - markout
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - LICENSE
25
+ files:
26
+ - README.rdoc
27
+ - VERSION.yml
28
+ - bin/markout
29
+ - lib/markout
30
+ - lib/markout/document.rb
31
+ - lib/markout/formatter.rb
32
+ - lib/markout/formatters
33
+ - lib/markout/formatters/html
34
+ - lib/markout/formatters/html/html.rb
35
+ - lib/markout/formatters/html/templates
36
+ - lib/markout/formatters/html/templates/default
37
+ - lib/markout/formatters/html/templates/default/content.rhtml
38
+ - lib/markout/formatters/html/templates/default/print.css
39
+ - lib/markout/formatters/html/templates/default/screen.css
40
+ - lib/markout/formatters/pdf
41
+ - lib/markout/formatters/pdf/pdf.rb
42
+ - lib/markout/history.rb
43
+ - lib/markout/output.rb
44
+ - lib/markout/revision.rb
45
+ - lib/markout.rb
46
+ - test/fixtures
47
+ - test/fixtures/markdown.html
48
+ - test/fixtures/markdown.txt
49
+ - test/fixtures/mt_textformat_menu.png
50
+ - test/markout_document_test.rb
51
+ - test/markout_formatter_test.rb
52
+ - test/markout_html_test.rb
53
+ - test/markout_output_test.rb
54
+ - test/markout_test.rb
55
+ - test/test_helper.rb
56
+ - LICENSE
57
+ has_rdoc: true
58
+ homepage: http://github.com/karmi/markout
59
+ post_install_message:
60
+ rdoc_options:
61
+ - --inline-source
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.2.0
81
+ signing_key:
82
+ specification_version: 2
83
+ summary: Sexy Markdown output
84
+ test_files: []
85
+