Sha256: 9dccfcee8b6a12d79d1e48556aedb5d1a58f255fb43b7f8b7235f26b14664c4a

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

description 'Include tags'

Tag.define :include, :optional => '*', :requires => 'page', :limit => 10, :description => 'Include page' do |context, attrs|
  path = attrs['page']
  path = context.page.path/'..'/path if !path.starts_with? '/'
  if page = Page.find(path, context.page.tree_version)
    Aspects::Aspect.find!(page, :name => attrs['aspect'], :layout => true).
      call(context.subcontext(:params => attrs.merge(:included => true), :page => page), page)
  else
    %{<a href="#{escape_html build_path(path, :action => :new)}">#{escape_html :create_page.t(:page => path)}</a>}
  end
end

Tag.define :includeonly, :immediate => true, :description => 'Text which is shown only if included' do |context, attrs, content|
  nested_tags(context.subcontext, content) if context.params[:included]
end

Tag.define :noinclude, :immediate => true, :description => 'Text which is not included' do |context, attrs, content|
  nested_tags(context.subcontext, content) if !context.params[:included]
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
olelo-0.9.3 plugins/tags/include.rb
olelo-0.9.2 plugins/tags/include.rb
olelo-0.9.1 plugins/tags/include.rb