Sha256: 39501c1bb7f6de233fa25a1d67631b024a5a35560675db6a6734da71b4bd335f

Contents?: true

Size: 1014 Bytes

Versions: 9

Compression:

Stored size: 1014 Bytes

Contents

format do
  view :template_nest, cache: :never, unknown: true do
    return "" unless voo.nest_name

    if voo.nest_name.to_name.field_only?
      with_nest_mode :normal do
        nest template_link_set_name, view: :template_link
      end
    else
      "{{#{voo.nest_syntax}}}"
    end
  end

  def template_link_set_name
    name = voo.nest_name.to_name
    if name.absolute?
      name.trait_name :self
    else
      template_link_set_name_for_relative_name name
    end
  end

  def template_link_set_name_for_relative_name name
    name = name.stripped.gsub(/^\+/, "")

    if (type = on_type_set)
      [type, name].to_name.trait_name :type_plus_right
    else
      name.to_name.trait_name :right
    end
  end

  def on_type_set
    return unless
      (tmpl_set_name = parent.card.name.trunk_name) &&
      (tmpl_set_class_name = tmpl_set_name.tag_name) &&
      (tmpl_set_class_card = Card[tmpl_set_class_name]) &&
      (tmpl_set_class_card.codename == :type)

    tmpl_set_name.left_name
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-mod-edit-0.13.4 set/all/template_nest.rb
card-mod-edit-0.13.3 set/all/template_nest.rb
card-mod-edit-0.13.2 set/all/template_nest.rb
card-mod-edit-0.13.1 set/all/template_nest.rb
card-mod-edit-0.13.0 set/all/template_nest.rb
card-mod-edit-0.11.7 set/all/template_nest.rb
card-mod-edit-0.12.0 set/all/template_nest.rb
card-mod-edit-0.11.6 set/all/template_nest.rb
card-mod-edit-0.11.5 set/all/template_nest.rb