Sha256: 5901b6f42dd8f10631c10eaf40dd720400d1de149f3245950ae16f4255665c3c

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

module Rtml::Links
  # str_or_sym is the string or symbol to find
  # id_ref is a boolean: if true, then # is prepended where necessary
  def id_for(str_or_sym)
    tml_id = Rtml::Dom::Element.find_or_create_tml_id(str_or_sym)

    if local?(tml_id)
      "##{tml_id}"
    else
      tml_id
    end
  end

  def local?(str_or_sym)
    !(str_or_sym.kind_of?(String) && (str_or_sym =~ /\// || str_or_sym =~ /#/ || str_or_sym =~ /:/) || str_or_sym.blank?)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtml-2.0.4 lib/rtml/links.rb