mdown 42.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mdown.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/mdown ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../lib/mdown.rb"
4
+
5
+ begin
6
+ markdown = Mdown::App.new ARGV[0]
7
+ markdown.preview!
8
+ exit
9
+ rescue RuntimeError => error
10
+ puts "ZOMG " + error.to_s + "!!!"
11
+ end
data/lib/mdown/app.rb ADDED
@@ -0,0 +1,23 @@
1
+ module Mdown
2
+ class App
3
+ def initialize(file)
4
+ check_file! file
5
+ @file = file
6
+ end
7
+
8
+ def preview!
9
+ preview = Maruku.new(File.open(@file).read).to_html
10
+ exec "echo \"#{preview}\" | bcat"
11
+ end
12
+
13
+ private
14
+
15
+ def check_file!(file)
16
+ unless File.exists?(file)
17
+ raise "Unable to find file #{file}"
18
+ exit
19
+ end
20
+ return
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Mdown
2
+ # The 41 previous versions sucked so much
3
+ # they were rejected from the interwebs, ZOMG!!!
4
+ VERSION = "42.0"
5
+ end
data/lib/mdown.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "maruku"
2
+
3
+ require_relative "mdown/app.rb"
4
+
5
+ module Mdown
6
+ end
data/mdown.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mdown/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "mdown"
7
+ s.version = Mdown::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Aziz Light"]
10
+ s.email = ["aziiz.light@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Markdown preview}
13
+ s.description = %q{Preview markdown files in your default browser}
14
+
15
+ s.add_dependency "bcat", "0.6.0"
16
+ s.add_dependency "maruku", "0.6.0"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ end
data/test.html ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC
3
+ "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
4
+ "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
5
+ <html xml:lang='en' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/1999/xhtml'>
6
+ <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>This is the Title</title></head>
7
+ <body>
8
+ <h1 id='this_is_the_title'>This is the Title</h1>
9
+
10
+ <p>This is a list</p>
11
+
12
+ <ul>
13
+ <li>item</li>
14
+
15
+ <li>item</li>
16
+
17
+ <li>item</li>
18
+
19
+ <li>item</li>
20
+
21
+ <li>item</li>
22
+
23
+ <li>item</li>
24
+
25
+ <li>item</li>
26
+ </ul>
27
+
28
+ <p>This is an some code:</p>
29
+
30
+ <pre><code>puts &quot;Hello, World!&quot;</code></pre>
31
+ </body></html>
data/test.markdown ADDED
@@ -0,0 +1,16 @@
1
+ This is the Title
2
+ =================
3
+
4
+ This is a list
5
+
6
+ - item
7
+ - item
8
+ - item
9
+ - item
10
+ - item
11
+ - item
12
+ - item
13
+
14
+ This is an some code:
15
+
16
+ puts "Hello, World!"
data/test.txt ADDED
@@ -0,0 +1,15 @@
1
+ md_el(:document,[
2
+ md_el(:header,["This is the Title"],{:level=>1},[]),
3
+ md_par(["This is a list"]),
4
+ md_el(:ul,[
5
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[]),
6
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[]),
7
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[]),
8
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[]),
9
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[]),
10
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[]),
11
+ md_el(:li_span,["item"],{:want_my_paragraph=>false},[])
12
+ ],{},[]),
13
+ md_par(["This is an some code:"]),
14
+ md_el(:code,[],{:raw_code=>"puts \"Hello, World!\""},[])
15
+ ],{},[])
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mdown
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "42.0"
6
+ platform: ruby
7
+ authors:
8
+ - Aziz Light
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-01 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bcat
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - "="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.6.0
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: maruku
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - "="
34
+ - !ruby/object:Gem::Version
35
+ version: 0.6.0
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ description: Preview markdown files in your default browser
39
+ email:
40
+ - aziiz.light@gmail.com
41
+ executables:
42
+ - mdown
43
+ extensions: []
44
+
45
+ extra_rdoc_files: []
46
+
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - Rakefile
51
+ - bin/mdown
52
+ - lib/mdown.rb
53
+ - lib/mdown/app.rb
54
+ - lib/mdown/version.rb
55
+ - mdown.gemspec
56
+ - test.html
57
+ - test.markdown
58
+ - test.txt
59
+ has_rdoc: true
60
+ homepage: ""
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project:
83
+ rubygems_version: 1.5.2
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Markdown preview
87
+ test_files: []
88
+