Sha256: 737a56837870e7f4d78b3f894f80a41e15279a75073736faa724f13e9b759094

Contents?: true

Size: 446 Bytes

Versions: 7

Compression:

Stored size: 446 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?
  if ARGV[0].nil?
    print_usage
  else
    process_html(ARGV[0])
  end
else
  html = STDIN.read

  if html.nil?
    print_usage
  else
    process_html(html)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
microformats-4.5.0 bin/microformats
microformats-4.4.1 bin/microformats
microformats-4.3.1 bin/microformats
microformats-4.2.1 bin/microformats
microformats-4.2.0 bin/microformats
microformats-4.1.0 bin/microformats
microformats-4.0.9 bin/microformats