Sha256: f43c9cc57c4d1cb0f105e85049f8cc9e185a88f693766711c5300cfe85d52a7f

Contents?: true

Size: 953 Bytes

Versions: 12

Compression:

Stored size: 953 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

12 entries across 12 versions & 1 rubygems

Version Path
olelo-0.9.15 plugins/tags/include.rb
olelo-0.9.14 plugins/tags/include.rb
olelo-0.9.13 plugins/tags/include.rb
olelo-0.9.12 plugins/tags/include.rb
olelo-0.9.11 plugins/tags/include.rb
olelo-0.9.10 plugins/tags/include.rb
olelo-0.9.9 plugins/tags/include.rb
olelo-0.9.8 plugins/tags/include.rb
olelo-0.9.7 plugins/tags/include.rb
olelo-0.9.6 plugins/tags/include.rb
olelo-0.9.5 plugins/tags/include.rb
olelo-0.9.4 plugins/tags/include.rb