Sha256: 37dc0f38dd47cd4855110823c4d5ad627b45211c61691c46b4ad7de81781910f
Contents?: true
Size: 1.5 KB
Versions: 5
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true require 'nokogiri' module Nokogiri module XML class Builder class NodeBuilder attr_reader :node end end end end module Epuber class Compiler class Generator # @return [Epuber::Compiler::CompilationContext] # attr_reader :compilation_context # @param [Epuber::Compiler::CompilationContext] compilation_context # def initialize(compilation_context) @compilation_context = compilation_context @book = compilation_context.book @target = compilation_context.target @file_resolver = compilation_context.file_resolver end protected def pretty_path_for_toc_item(toc_item, fragment: true) file = @file_resolver.file_from_request(toc_item.file_request) [file.destination_path, fragment ? toc_item.file_fragment : nil].compact.join('#') end # @param [Epuber::Compiler::FileTypes::AbstractFile] file # # @return [String] # def pretty_path(file) file.destination_path end # Helper function for generating XML # # @yields xml_builder # @yieldsparam [Nokogiri::XML::Builder] xml_builder # # @return [Nokogiri::XML::Document] # def generate_xml(&block) builder = Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml| @xml = xml block.call(xml) unless block.nil? @xml = nil end builder.doc end end end end
Version data entries
5 entries across 5 versions & 1 rubygems