# coding: utf-8 require 'asciidoctor' require 'asciidoctor/converter/html5' require 'pathname' class Asciidoctor::AbstractBlock attr_accessor :real_level def document_dirname if @document.upper_doc && (@document.upper_doc != @document.top_doc) base = @document.upper_doc.document_filepath() base.delete_suffix @document.attributes['outfilesuffix'] else "." end end def document_filename base = @document.id if @document.upper_doc && (@document.upper_doc != @document.top_doc) base = base.delete_prefix "#{document.upper_doc.id}_" end base + @document.attributes['outfilesuffix'] end def document_filepath suffix = @document.attributes['outfilesuffix'] File.join(document_dirname, @document.document_filename).delete_prefix( ".#{File::SEPARATOR}") end def filepath_to other self_dir = Pathname.new document_dirname other_dir = Pathname.new other.document_dirname ret = File.join( other_dir.relative_path_from(self_dir), other.document_filename).delete_prefix(".#{File::SEPARATOR}") ret end end class Asciidoctor::Document attr_accessor :parsed attr_accessor :processed attr_accessor :catalog attr_accessor :child_documents attr_accessor :top_doc attr_accessor :upper_doc attr_accessor :next_doc attr_accessor :prev_doc alias core_init initialize def initialize data = nil, options = {} options[:sourcemap] = true core_init data, options @child_documents = [] end def content # this is different from the reguar Document.content super end alias core_docinfo docinfo def docinfo location = :head, suffix = nil result = core_docinfo location, suffix if ((location == :footer) && (attr? 'source-location', nil, true) && (attr? 'project-gh', nil, true)) result += '