Sha256: d08219cdc40adbf6d8e8ade2412b575bebc4b02148e105486050e1e90fcba28a

Contents?: true

Size: 690 Bytes

Versions: 7

Compression:

Stored size: 690 Bytes

Contents

module Expressir
  module Express
    module HyperlinkFormatter
      def format_expressions_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

7 entries across 7 versions & 1 rubygems

Version Path
expressir-1.0.0 lib/expressir/express/hyperlink_formatter.rb
expressir-1.0.0-x86_64-linux lib/expressir/express/hyperlink_formatter.rb
expressir-1.0.0-x86_64-darwin lib/expressir/express/hyperlink_formatter.rb
expressir-1.0.0-x86-mingw32 lib/expressir/express/hyperlink_formatter.rb
expressir-1.0.0-x86-linux lib/expressir/express/hyperlink_formatter.rb
expressir-1.0.0-x64-mingw32 lib/expressir/express/hyperlink_formatter.rb
expressir-1.0.0-arm64-darwin lib/expressir/express/hyperlink_formatter.rb