Sha256: 0660934dd58244848581ed952521fbb8f62ebcfbf5d2eb952cef462149134651
Contents?: true
Size: 1.12 KB
Versions: 171
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
171 entries across 171 versions & 1 rubygems