webmat (owner)

Revisions

gist: 26055 Download_button fork
public
Public Clone URL: git://gist.github.com/26055.git
Embed All Files: show embed
Text #
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
#!/usr/bin/env ruby
 
# Filename: mdc
# You put it in your path, then install Maruku, the awesome markdown gem.
# Maruku has awesome warning and isn't buggy.
 
# Usage:
# mdc article.md
# #=> article.html
#
# # adds extension .md to input filename if you supply no extension
# mdc git_remote_branch
# #=> git_remote_branch.html
#
# # defaults to reading from article.md
# mdc
# #=> article.html
 
# Please disregards insults in the following.
 
require 'fileutils'
include FileUtils
 
def crap_out(msg)
  puts msg
  exit 1
end
 
input_file_name = ARGV[0] || 'article.md'
ext = File.extname(input_file_name)
 
crap_out "This is the html file you dummy" if ext == '.html'
input_file_name += '.md' if ext.nil?
 
 
output_file_name = input_file_name[0..-(ext.length)] + 'html'
rm output_file_name, :force => true
cmd = "maruku --html-frag #{input_file_name} -o #{output_file_name}"
system(cmd)
if $?.exitstatus == 0
  puts output_file_name
end
exit $?.exitstatus
 
# Awesome maruku warning:
 
=begin
mdc
 
___________________________________________________________________________
| Maruku tells you:
+---------------------------------------------------------------------------
| Unclosed span (waiting for ["_"])
| ---------------------------------------------------------------------------
| s often, you may have to set up your PATH variable in your ~/.bash_profile.EOF
| ---------------------------------------------------------------------------|
| +--- Byte 94
| Shown bytes [19 to 75] of 94:
| >If you don't do this often, you may have to set up your PATH variable in your ~/.bash_profile.
|
| At line 12
| header2 |--------|
| empty ||
| text |If you don't do this often, you may have to set up your PATH variable in your ~/.bash_profile.|
| empty --> ||
| code | export PATH="/usr/local/bin:$PATH"|
| empty ||
| text |Prepare a working directory to keep the source close to the corresponding executables.|
|
|
| Elements read in span:
|
| Current string:
| "profile."
+---------------------------------------------------------------------------
!/Library/Ruby/Gems/1.8/gems/maruku-0.5.9/lib/maruku/errors_management.rb:49:in `maruku_error'
!/Library/Ruby/Gems/1.8/gems/maruku-0.5.9/lib/maruku/input/parse_span_better.rb:210:in `read_span'
!/Library/Ruby/Gems/1.8/gems/maruku-0.5.9/lib/maruku/input/parse_span_better.rb:411:in `read_em'
!/Library/Ruby/Gems/1.8/gems/maruku-0.5.9/lib/maruku/input/parse_span_better.rb:194:in `read_span'
!/Library/Ruby/Gems/1.8/gems/maruku-0.5.9/lib/maruku/input/parse_span_better.rb:46:in `parse_span_better'
\___________________________________________________________________________
article.html
 
=end