Sha256: f0a4774cd83c35f911d272e80a115ef25ba41ddb8a6ab23486fee9496e48ca7b

Contents?: true

Size: 915 Bytes

Versions: 3

Compression:

Stored size: 915 Bytes

Contents

require 'kramdown'
module Verku
  class Exporter
    class HTML < Base
      def export!
        locals = config.merge({ "contents" => content })
        locals['copyright'].gsub!("(C)", "&copy;")
        output = render_template(root_dir.join("_templates/html/layout.erb"), locals)
        File.open(root_dir.join(html_file), 'w').write(output)
        true

      rescue Exception => error
        handle_error(error)
        false
      end

      private
        def content
          source_list.map do |file|
            # d = File.read_content(file)
            # raise d.inspect
            Kramdown::Document.new(
              read_content(file)[0],
              :latex_headers => %w{chapter section subsection subsubsection paragraph subparagraph}
            ).to_html
            # PandocRuby.markdown(read_content(file)[0]).to_html.sectionize
          end.join("\n\n")
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
verku-0.16.8 lib/verku/exporter/html.rb
verku-0.16.7 lib/verku/exporter/html.rb
verku-0.16.6 lib/verku/exporter/html.rb