On 05.03.2007, at 23:01, Andrea Censi wrote:
> I want to create a tag processor that is activated by something like:
>
> {flickr: http://www.flickr.com/photos/censi/232006603/}
>
> (it then downloads from flickr the description of the photo -- look
> for example at http://www.dis.uniroma1.it/~acensi/category/sss06.html)
>
> This is my flickr.rb:
>
> load_plugin ''webgen/plugins/tags/tag_processor''
> module Tags
> class FlickrTag < DefaultTag
> param ''url'', nil, ''Url of the photo on
Flickr.''
> register_tag ''flickr''
>
> def process_tag( tag, chain )
> url = param( ''url'' )
> ...
> end
> end
> end
>
>
> I get ''ERROR -- No default mandatory parameter specified for tag
> ''Tag/Flickr'' but set in < ...
sss062.page>''
>
> I can''t understand what''s wrong.
You need to specify which parameter should be used as default
mandatory parameter. webgen normally needs a YAML hash as argument to
a tag, like this {myTag: {option: value, option2: value2}}. However,
as some tags sometimes only have one mandatory parameter (eg. Tag/
Relocatable just needs to know the file it should make relocatable) I
introduced the default mandatory parameter. This parameter always
needs to have a value and can be set by using the shortcut {myTag:
value}.
Just add the following under the "param ''url''..."
line:
set_mandatory ''url'', true
After that it will work!
Bye,
Thomas