Sha256: 27ed423deabaf786851502ffbf5e7798d21e9a6d4cf213df0004bd412b1b5167

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

#!/usr/bin/env ruby
#$Id: run-markdown.rb 174 2006-08-21 14:51:12Z bitherder $
$:.unshift File.join(File.dirname(__FILE__), "../..", "lib")

require 'tartan'
require 'tartan_markdown'
# require 'profile'

class WikiparserRunner
  def self.run(base, *other_args)
    wikiFileName=base + ".text"
    outFileName=base  + ".out"
    
    options = {}
    args = []
    other_args.each do |arg|
      if arg =~ /([^=]+)=(.*)/
        
        key = $1 
        value = $2

        if key =~ /^:(.*)$/
          key = $1.to_sym
        end

        value = case value
        when /^:(.*)/
          $1.to_sym
        when /^[tT]rue$/
          true
        when /^[fF]alse$/
          false
        else
          value
        end
        
        options[key] = value
      else
        args << arg
      end
    end

    text = File.open(wikiFileName).read
    require 'profile' if options['profile']
    wp = TartanMarkdown.new(text, options)
    html = wp.to_html
    outFile = File.open(outFileName, "w+")
    outFile.puts html
    outFile.rewind
    outFile
  end
end

if __FILE__ == $0
  WikiparserRunner.run(*ARGV).close
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tartan-0.1.1 test/MarkdownTest_1.0/run-markdown.rb