Sha256: 8d57b95e8a8596fab63613a7e78b9570647166961f7d652b6fc587af3456ecf8

Contents?: true

Size: 457 Bytes

Versions: 6

Compression:

Stored size: 457 Bytes

Contents

#!/usr/bin/env ruby

require 'microformats'
require 'json'

def print_usage
  puts "Usage: microformats (URL, filepath, or HTML)"
end

def process_html(html)
    collection = Microformats.parse(html)
    puts JSON.pretty_generate(JSON[collection.to_json.to_s])
end

if STDIN.tty?
  unless ARGV[0].nil?
    process_html(ARGV[0])
  else
    print_usage
  end
else
  html = STDIN.read
  unless html.nil?
    process_html(html)
  else
    print_usage
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
microformats-4.0.7 bin/microformats
microformats-4.0.6 bin/microformats
microformats-4.0.5 bin/microformats
microformats-4.0.4 bin/microformats
microformats-4.0.3 bin/microformats
microformats-4.0.2 bin/microformats