Sha256: a8c413a518e057a16c11c8765906080d5c8334ebc79bd6aac3423965bdc485cc
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
# -*- encoding: utf-8 -*- require 'nokogiri' require 'bluecloth' module Genit # Open an html file in various format. class HtmlDocument # Public: Open a html document. # # file - Full path String filename. # # Returns a Nokogiri::HTML document. def self.open file Nokogiri::HTML(File.open(file)) end # Public: Open a html or markdown file as a string. # # file - Full path String name of a html or markdown file. # # Returns a String. def self.open_as_string file string = IO.read file string = BlueCloth.new(string).to_html if file.end_with? '.markdown' string end # Public: Get the list of <genit> tag in a document. # # file - Nokogiri::HTML document. # # Returns a list of Nokogiri::XML::NodeSet. def self.genit_tags_from file file.css "genit" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
genit-0.2 | lib/genit/html_document.rb |