On 13 Jan 2011, at 08:58, Marc wrote:

> Hi,
> 
> I've been experimenting with adding a custom tag to Page, which works
> when I have:
> 
> module UiTags
>  include Radiant::Taggable
> 
>  desc "Returns the server host name"
>  tag 'lsi:hostname' do |tag|
>    CGI.escapeHTML(request.host()) unless request.nil?
>  end
> end
> 
> but not:
> 
> module UiTags
>  include Radiant::Taggable
> 
>  desc "Returns the server host name"
>  tag 'hostname' do |tag|
>    CGI.escapeHTML(request.host()) unless request.nil?
>  end
> end
> 
> I get an error 'lsi' tag not defined… Which is strange since other
> extensions use the prefix:name form. Radiant 0.9.1 and Rails 2.3.8.

Have you got those the right way round? Should be an easy fix, though. The 
error is literally correct, and you need to define a tag for the prefix too:

        desc "Custom namespace"
        tag 'lsi' do |tag|
          tag.expand
        end

        desc "Returns the server host name"
        tag 'lsi:hostname' do |tag|
          CGI.escapeHTML(request.host()) unless request.nil?
        end

There may be useful work you can do to set context within the Isi tag, but note 
that when you call <r:isi:hostname /> in that chained form the tag attributes 
are not passed through to the prefix tag.

best,

will




Reply via email to