Sha256: 10409a63af82994f600866d0461d654ffbe6490b829ce654efa49efa524ee120
Contents?: true
Size: 763 Bytes
Versions: 5
Compression:
Stored size: 763 Bytes
Contents
# frozen_string_literal: true module Kitabu class Stats attr_reader :root_dir def initialize(root_dir) @root_dir = root_dir end def text @text ||= html.text end def html @html ||= Nokogiri::HTML(content) end def words @words ||= text.split.size end def chapters @chapters ||= html.css(".chapter").size end def images @images ||= html.css("img").size end def footnotes @footnotes ||= html.css("p.footnote").size end def links @links ||= html.css("[href^='http']").size end def code_blocks @code_blocks ||= html.css("pre").size end def content @content ||= Exporter::HTML.new(root_dir).content end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
kitabu-3.1.0 | lib/kitabu/stats.rb |
kitabu-3.0.3 | lib/kitabu/stats.rb |
kitabu-3.0.2 | lib/kitabu/stats.rb |
kitabu-3.0.1 | lib/kitabu/stats.rb |
kitabu-3.0.0 | lib/kitabu/stats.rb |