Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.