checkmark 0.1.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.
- data/bin/checkmark +6 -0
- data/lib/checkmark.rb +77 -0
- metadata +63 -0
data/bin/checkmark
ADDED
data/lib/checkmark.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'redcarpet'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Checkmark
|
5
|
+
HTML_BEGIN = <<HTML
|
6
|
+
<!DOCTYPE html>
|
7
|
+
<html>
|
8
|
+
<head>
|
9
|
+
<title>checkmark</title>
|
10
|
+
</head>
|
11
|
+
<style>
|
12
|
+
body{font-family:helvetica, arial;font-size:13px;background:#e7e7e7;}
|
13
|
+
h1,h2,h3,h4,h5,h6{border:0;}
|
14
|
+
h1{font-size:170%;border-top:4px solid #aaa;padding-top:.5em;margin-top:1.5em;}
|
15
|
+
h1:first-child{margin-top:0;padding-top:.25em;border-top:none;}
|
16
|
+
h2{font-size:150%;margin-top:1.5em;border-top:4px solid #e0e0e0;padding-top:.5em;}
|
17
|
+
h3{margin-top:1em;}
|
18
|
+
p{margin:1em 0;line-height:1.5em;}
|
19
|
+
ul{margin:1em 0 1em 2em;padding:0;}
|
20
|
+
ol{margin:1em 0 1em 2em;padding:0;}
|
21
|
+
ol li,ul li{margin-top:.5em;margin-bottom:.5em;}
|
22
|
+
ul ul,ul ol,ol ol,ol ul,{margin-top:0;margin-bottom:0;}
|
23
|
+
blockquote{margin:1em 0;border-left:5px solid #ddd;padding-left:.6em;color:#555;}
|
24
|
+
dt{font-weight:bold;margin-left:1em;}
|
25
|
+
dd{margin-left:2em;margin-bottom:1em;}
|
26
|
+
table{margin:1em 0;}
|
27
|
+
table th{border-bottom:1px solid #bbb;padding:.2em 1em;}
|
28
|
+
table td{border-bottom:1px solid #ddd;padding:.2em 1em;}
|
29
|
+
pre{margin:1em 0;font-size:12px;background-color:#f8f8ff;border:1px solid #dedede;padding:.5em;line-height:1.5em;color:#444;overflow:auto;}
|
30
|
+
pre code{padding:0;font-size:12px;background-color:#f8f8ff;border:none;}
|
31
|
+
code{font-size:12px;background-color:#f8f8ff;color:#444;padding:0 .2em;border:1px solid #dedede;}
|
32
|
+
a{color:#4183c4;text-decoration:none;}
|
33
|
+
a:hover{text-decoration:underline;}
|
34
|
+
a code,a:link code,a:visited code{color:#4183c4;}
|
35
|
+
img{max-width:100%;}
|
36
|
+
.info{background:#999;color:#fff;font-size:12px;padding:5px;}
|
37
|
+
#header{width:920px;margin:0 auto 15px auto;}
|
38
|
+
#header blockquote{color:#fff;}
|
39
|
+
#frame{background:#fff;border:1px solid #e7e7e7;width:920px;margin:0 auto;padding:5px;}
|
40
|
+
#frame .info{font-weight:bold;}
|
41
|
+
#footer{font-weight:bold;width:920px;margin:0 auto;padding:15px 0;text-align:right;}
|
42
|
+
#footer a,#footer a:visited,#footer a:hover,#footer a:active{color:#333}
|
43
|
+
</style>
|
44
|
+
<body>
|
45
|
+
<div id="header" class="info">
|
46
|
+
<h1>checkmark</h1>
|
47
|
+
<blockquote>"<strong><em>check</em></strong> your <strong><em>mark</em></strong>down"</blockquote>
|
48
|
+
</div>
|
49
|
+
<div id="frame">
|
50
|
+
HTML
|
51
|
+
|
52
|
+
HTML_END = <<HTML
|
53
|
+
</div>
|
54
|
+
<div id="footer"><span class="info">√ checkmark © 2011 <a href="http://marcusortiz.com">marcus ortiz</a></span></div>
|
55
|
+
</body>
|
56
|
+
</html>
|
57
|
+
HTML
|
58
|
+
|
59
|
+
def self.dir
|
60
|
+
File.join("#{ENV['HOME']}", ".check")
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.preview_file
|
64
|
+
File.join(self.dir, 'mark.html')
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.run(filename)
|
68
|
+
FileUtils.mkdir_p(self.dir) unless File.exists?(self.dir)
|
69
|
+
File.open(self.preview_file, 'w') do |f|
|
70
|
+
f.write HTML_BEGIN
|
71
|
+
f.write "<span class=\"info\">#{filename}</span>"
|
72
|
+
f.write Redcarpet.new(File.read(filename)).to_html
|
73
|
+
f.write HTML_END
|
74
|
+
end
|
75
|
+
`open #{self.preview_file}` if RUBY_PLATFORM =~ /darwin/
|
76
|
+
end
|
77
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: checkmark
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Marcus Ortiz
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-08-17 00:00:00.000000000 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: redcarpet
|
17
|
+
requirement: &2153185300 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2153185300
|
26
|
+
description: If you're using OS X, checkmark will open the rendered html for your
|
27
|
+
markdown file in a web browser. Otherwise, you can manually open the `mark.html`
|
28
|
+
file that is created your `$HOME/.check/` directory.
|
29
|
+
email: mportiz08@gmail.com
|
30
|
+
executables:
|
31
|
+
- checkmark
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- lib/checkmark.rb
|
36
|
+
- bin/checkmark
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/mportiz08/checkmark
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.6.2
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: checkmark lets you check your markdown files in a web browser
|
63
|
+
test_files: []
|