Hi,
I''m trying to understand webgen''s inner workings a little, so
I can
extend it myself. I thought writing a new Tag class would be a good
place to start, but I''m already running into problems...
I''m trying to use the example "Reverser" class from the rdocs
on
Tag::Base. I thought I just needed to copy the code from the sample
tag class to the init.rb file of a webgen site, and then add some
"{reverse: Reverse this string}" tag to a page file to see it work.
However, I get the following error when I do this:
"undefined local variable or method `default'' for
main:Object"
The line of code causing this problem is
Webgen::WebsiteAccess.website.config.reverser.do_reverse
nil, :mandatory => default
Am I correct in that this should be
Webgen::WebsiteAccess.website.config.reverser.do_reverse
(nil, :mandatory => ''default'')
? When I make this change, I get the new error:
"Error while rendering </testtag.en.html>:
No such configuration option: do_reverse">From here on, I don''t know what to do...
Also, I''m afraid I don''t really understand what the
"body" in the tag
class method call(tag, body, context) is. If I have a tag {mytag:
{someparam: somevalue, otherparam: othervalue}} in the file "/
index.page", what is the "body" given to the call method?
Obviously I''m still in the stage of complete confusion. Any help would
be greatly appreciated!
Thomas
Hi Thomas (there is quite an amount of Thomasses on this list), I recently was at the same spot as you are and worked my way through webgens sourcecode. I guess, my overlib example is about the most simple example you can do: Find details in the emails to this list: http://groups.google.com/group/webgen-users/browse_thread/thread/cbee5502d1fd0b08 cheers, thomas On Mon, Dec 21, 2009 at 11:33, Thomas Danckaert <thomas.danckaert at gmail.com> wrote:> Hi, > > I''m trying to understand webgen''s inner workings a little, so I can > extend it myself. ?I thought writing a new Tag class would be a good > place to start, but I''m already running into problems... > > I''m trying to use the example "Reverser" class from the rdocs on > Tag::Base. ?I thought I just needed to copy the code from the sample > tag class to the init.rb file of a webgen site, and then add some > "{reverse: Reverse this string}" tag to a page file to see it work. > However, I get the following error when I do this: > > "undefined local variable or method `default'' for main:Object" > > The line of code causing this problem is > Webgen::WebsiteAccess.website.config.reverser.do_reverse > nil, :mandatory => default > Am I correct in that this should be > Webgen::WebsiteAccess.website.config.reverser.do_reverse > (nil, :mandatory => ''default'') > ? When I make this change, I get the new error: > > "Error while rendering </testtag.en.html>: > ? No such configuration option: do_reverse" > >From here on, I don''t know what to do... > > Also, I''m afraid I don''t really understand what the "body" in the tag > class method call(tag, body, context) is. ?If I have a tag {mytag: > {someparam: somevalue, otherparam: othervalue}} in the file "/ > index.page", what is the "body" given to the call method? > > Obviously I''m still in the stage of complete confusion. Any help would > be greatly appreciated! > > Thomas > _______________________________________________ > webgen-users mailing list > webgen-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/webgen-users >-- http://thomas.deselaers.de
> The line of code causing this problem is > Webgen::WebsiteAccess.website.config.reverser.do_reverse > nil, :mandatory => default > Am I correct in that this should be > Webgen::WebsiteAccess.website.config.reverser.do_reverse > (nil, :mandatory => ''default'')Yes, this is a bug in the documentation. Is already fixed in the repo and the fix will go live with the next release.> ? When I make this change, I get the new error: > > "Error while rendering </testtag.en.html>: > No such configuration option: do_reverse" > >>From here on, I don''t know what to do...Can you provide your ext/init.rb file sothat I can investigate?> Also, I''m afraid I don''t really understand what the "body" in the tag > class method call(tag, body, context) is. If I have a tag {mytag: > {someparam: somevalue, otherparam: othervalue}} in the file "/ > index.page", what is the "body" given to the call method?webgen 0.5 allows you to use a body with a tag. Have a look at http://webgen.rubyforge.org/documentation/contentprocessor/tags.html and http://webgen.rubyforge.org/documentation/tag/coderay.html for more information. -- Thomas