Sha256: 1089d023cc2f9c1c02542b4c90b1d1974437443752c8a62f8f536ddf48f6e0aa
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
#!/usr/bin/env ruby require 'redcarpet' require 'hubdown/cli_parser' require 'hubdown/page_builder' require 'hubdown/pygments_renderer' def init @file_name = ARGV.shift output = "" parser = CliParser.new parser.run ARGV mdown = create_mdown if parser.config[:output] || parser.config[:wrap] page_data = create_page mdown if parser.config[:output] File.open( parser.config[:output], "w" ) { |f| f.write page_data } end if parser.config[:wrap] output = page_data end else output = mdown end if output != "" puts output end end def create_page mdown options = { "body" => mdown, "filename" => @file_name, "uri" => 'https://github.com/knomedia/hubdown' } p = Hubdown::PageBuilder.new options page_data = p.get_page page_data end def create_mdown md_options = { :autolink => true, :no_intra_emphasis => true, :space_after_headers => true, :fenced_code_blocks => true, :tables => true, :strikethrough => true, :lax_spacing => true, :space_after_headers => true, :superscript => true } renderer = PygmentsRenderer.new({ :hard_wrap => false }) markdown = Redcarpet::Markdown.new(renderer, md_options) contents = "" File.open( @file_name, 'r') {|f| contents = f.read() } md = markdown.render( contents ) md end init
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hubdown-0.0.13 | bin/hubdown |
hubdown-0.0.12 | bin/hubdown |