Damien Pollet
2010-Feb-10 18:13 UTC
[webgen-users] metainfo tag called instead of a custom one
Hi, I had adapted this mailto tag http://pjkh.com/articles/2007/12/14/webgen-mailto-tag Now webgen gives me errors like so: ERROR -- No default mandatory parameter specified for tag ''Webgen::Tag::Metainfo'' but set in </contact.en.html> ERROR -- No value for meta info key ''mailto'' in </contact.en.html> found in </contact.en.html> Which suggests that the default tag handler gets called instead of mine. The contact page contains something like {mailto: foo at host.com} For the tag code I followed the example at http://webgen.rubyforge.org/documentation/rdoc/Webgen/Tag/Base.html (BTW there should be quotes around ''default'', no?) Again I have no idea what caused it to break and with all the module inclusion and method_missing hacks I don''t know how to debug this. class Mailto include Webgen::Tag::Base def call( tag, body, context ) email = encode_email(param(''mailto.to'')) link = param(''mailto.link'') || email subject = param(''mailto.subject'') html = "<a href=''mailto:#{email}#{''?subject='' + subject unless subject.nil?}''>#{link}</a>" return [html,false] end private def encode_email( mail ) expanded = mail #mail.gsub(''.'', '' dot '').gsub(''@'', '' at '') entities = "" expanded.each_char { |c| entities << "&##{c[0].ord};"} return entities end end config = Webgen::WebsiteAccess.website.config config[''contentprocessor.tags.map''][''mailto''] = ''Mailto'' config.mailto.to nil, :doc => ''The destination email address. Mandatory.'', :mandatory => ''default'' config.mailto.link nil, :doc => ''The linked text. Defaults to the email address.'' config.mailto.subject nil, :doc => ''The subject of the mail message. Optional.'' -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-11 14:33 UTC
[webgen-users] metainfo tag called instead of a custom one
On Wed, 10 Feb 2010 19:13:43 +0100, Damien Pollet wrote:> Hi, > > I had adapted this mailto tag > http://pjkh.com/articles/2007/12/14/webgen-mailto-tag > Now webgen gives me errors like so: > > ERROR -- No default mandatory parameter specified for tag > ''Webgen::Tag::Metainfo'' but set in </contact.en.html> > ERROR -- No value for meta info key ''mailto'' in </contact.en.html> > found in </contact.en.html> > > Which suggests that the default tag handler gets called instead of > mine. The contact page contains something like {mailto: foo at host.com} > > For the tag code I followed the example at > http://webgen.rubyforge.org/documentation/rdoc/Webgen/Tag/Base.html > (BTW there should be quotes around ''default'', no?)Yes, this is fixed in the repo.> Again I have no idea what caused it to break and with all the module > inclusion and method_missing hacks I don''t know how to debug this. > > <SNIP /> >I have add your code to ext/init.rb of a newly created site and it works just fine... Have you tried deleting the webgen.cache file? -- Thomas