Sha256: 5b9395dbfe7201d0934a39a6ef23b9e66cab2bc1c5de6189e6feb6416ad21ae0
Contents?: true
Size: 1.12 KB
Versions: 15
Compression:
Stored size: 1.12 KB
Contents
module Expressir module Express # Formatter module - format references as hyperlinks # @example Include into Formatter subclass # formatter = Class.new(Expressir::Express::Formatter) do # include Expressir::Express::HyperlinkFormatter # end module HyperlinkFormatter # @!visibility private def self.included(mod) if !mod.superclass.private_method_defined? :format_references_simple_reference raise "Missing method" end end private def format_references_simple_reference(node) return node.id unless node.base_path # find closest node with path current_node = node while !current_node.path current_node = current_node.parent end # skip if this reference and target node are in the same node with path node_base_path_parts = node.base_path.split(".") current_node_path_parts = current_node.path.split(".") return node.id if node_base_path_parts[0..1] == current_node_path_parts[0..1] "{{{<<express:#{node.base_path},#{node.id}>>}}}" end end end end
Version data entries
15 entries across 15 versions & 1 rubygems