Niranjan
2009-Sep-08 15:15 UTC
[webgen-users] Getting problem in loading the webgen tag extensions on windows and mac machine
Hi, I am developing some custom tags with webgen. and included this tag in one of the page files as :- {largethumbnail: {source: ''../../images/myimage.gif'', width: 265}} e.g. -------------------------------------------- class LargeThumbnail include Webgen::Tag::Base def call(tag, body, context) .... some html code here end end website = Webgen::WebsiteAccess.website config = website.config config[''contentprocessor.tags.map''][''largethumbnail''] ''LargeThumbnail'' config.largethumbnail.source(nil, :mandatory => ''default'') config.largethumbnail.width(nil) ------------------------------------------------------- And also including this in ext\init.rb file as :- require File.join(File.dirname(__FILE__), ''large_thumbnail'') However, I get the below error on my windows and mac machine: WARN -- Invalid parameter ''source'' for tag ''Webgen::Tag::Metainfo'' in </master_test.en.html> WARN -- Invalid parameter ''width'' for tag ''Webgen::Tag::Metainfo'' in </master_test.en.html> ERROR -- No value for meta info key ''largethumbnail'' in </ master_test.en.html> found in </master_test.en.html> Basically it is not able to load the extension file. It is always looking for the default ''Webgen::Tag::Metainfo'' I tried to debug whether it is getting proper paths in envt variables, but did not work. I have ruby 1.8.5 installed on my windows machine. Would really appreciate your help on this. Thanks in advance... Best Regards, Niranjan
Thomas Leitner
2009-Sep-10 05:33 UTC
[webgen-users] Getting problem in loading the webgen tag extensions on windows and mac machine
Hi,> -------------------------------------------- > class LargeThumbnail > > include Webgen::Tag::Base > > def call(tag, body, context) > .... some html code here > end > > end > > website = Webgen::WebsiteAccess.website > config = website.config > > config[''contentprocessor.tags.map''][''largethumbnail''] > ''LargeThumbnail'' > config.largethumbnail.source(nil, :mandatory => ''default'') > config.largethumbnail.width(nil) > ------------------------------------------------------- > > And also including this in ext\init.rb file as :- > > require File.join(File.dirname(__FILE__), ''large_thumbnail'')the basic problem is that if you require the file, it is only required once. However, due to how webgen works the initialisation process is sometimes done twice. The first time the large_thumbnail.rb file gets required and the configuration stored in the config variable. However, the second time Ruby sees that the file has already been required and does not require it again, therefore the config variable is not populated. You can circumvent this problem by * either using `load` instead of `require` * or just defining the class in the large_thumbnail.rb file and doing the configuration stuff in init.rb. The second way is how webgen does it interally. All the functionality is split into different files and the configuration takes place in one central file called lib/webgen/default_config.rb. -- Thomas
Niranjan
2009-Sep-15 16:52 UTC
[webgen-users] Getting problem in loading the webgen tag extensions on windows and mac machine
Thanks Thomas ! Best Regards, Niranjan On Sep 10, 10:33?am, Thomas Leitner <t_leit... at gmx.at> wrote:> Hi, > > > > > > > -------------------------------------------- > > class LargeThumbnail > > > ? include Webgen::Tag::Base > > > ? def call(tag, body, context) > > ? ? ? ? .... some html code here > > ? end > > > end > > > website = Webgen::WebsiteAccess.website > > config ?= website.config > > > config[''contentprocessor.tags.map''][''largethumbnail''] > > ''LargeThumbnail'' > > config.largethumbnail.source(nil, :mandatory => ''default'') > > config.largethumbnail.width(nil) > > ------------------------------------------------------- > > > And also including this in ext\init.rb file as :- > > > require File.join(File.dirname(__FILE__), ''large_thumbnail'') > > the basic problem is that if you require the file, it is only required > once. However, due to how webgen works the initialisation process is > sometimes done twice. The first time the large_thumbnail.rb file gets > required and the configuration stored in the config variable. However, > the second time Ruby sees that the file has already been required and > does not require it again, therefore the config variable is not > populated. > > You can circumvent this problem by > > * either using `load` instead of `require` > * or just defining the class in the large_thumbnail.rb file and doing > ? the configuration stuff in init.rb. > > The second way is how webgen does it interally. All the functionality > is split into different files and the configuration takes place in one > central file called lib/webgen/default_config.rb. > > -- Thomas > _______________________________________________ > webgen-users mailing list > webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users- Hide quoted text - > > - Show quoted text -