Hello, I''m looking for a recommendation for how to use webgen with binary files. How should binary files, such as Word, PDF, PowerPoint, and images, be linked from the generated website? Here is the scenario: There are folders containing binary files. Pages need to be generated, each of which contain a list of the files contained within a folder, with links to the files. I couldn''t find a SourceHandler that would seem to perform this task. Is there some sample code to handle this, or that shows how to perform something similar, such as an image gallery? Thanks. - Dennis Sutch
Hi,> I''m looking for a recommendation for how to use webgen with binary > files. How should binary files, such as Word, PDF, PowerPoint, and > images, be linked from the generated website? > > Here is the scenario: There are folders containing binary files. > Pages need to be generated, each of which contain a list of the files > contained within a folder, with links to the files. > > I couldn''t find a SourceHandler that would seem to perform this task. > Is there some sample code to handle this, or that shows how to perform > something similar, such as an image gallery?There has been an image gallery source handler in the 0.4.x version of webgen. Alas, I did not have the time to port it to 0.5.x. Binary files are just copied to the destination directory, so just add the need patterns to the patterns already used by SourceHandler::Copy (have a look at http://webgen.rubyforge.org/documentation/manual.html#website-configfile). You can either create a source handler that uses a specified list of folders to automatically generate a page for each, or, if that is too much to do, you could just add one page file per folder and use a template that generates the listing. I would do it like this: /binary/pictures/ /binary/word/ /binary/others/ /binary/pictures.page /binary/word.page /binary/others.page /binary/default.template where in the first three directories are the binary files and each .page file contains something like this: --- bin_dir: pictures and the default.template contains something like this: <% dir = File.join(node.parent.absolute_lcn, node[''bin_dir'']) context.content_node.tree.node_access[dir].children.sort.each do |child| %> <%= context.dest_node.link_to(child) <% end %> -- Thomas
Thomas, Using a template seems like it will give me what I need for now. Thank you. I may look into making a source handler, since I''d like this to be a bit more dynamic. Can you recommend a method for using the template technique and including captions and other info for each image? I''d assume that each folder (or file) requires a .metadata file. On Sep 12, 6:03?am, Thomas Leitner <t_leit... at gmx.at> wrote:> Hi, > > > I''m looking for a recommendation for how to use webgen with binary > > files. ?How should binary files, such as Word, PDF, PowerPoint, and > > images, be linked from the generated website? > > > Here is the scenario: ?There are folders containing binary files. > > Pages need to be generated, each of which contain a list of the files > > contained within a folder, with links to the files. > > > I couldn''t find a SourceHandler that would seem to perform this task. > > Is there some sample code to handle this, or that shows how to perform > > something similar, such as an image gallery? > > There has been an image gallery source handler in the 0.4.x version of > webgen. Alas, I did not have the time to port it to 0.5.x. > > Binary files are just copied to the destination directory, so just add > the need patterns to the patterns already used by SourceHandler::Copy > (have a look athttp://webgen.rubyforge.org/documentation/manual.html#website-configfile). > > You can either create a source handler that uses a specified list of > folders to automatically generate a page for each, or, if that is too > much to do, you could just add one page file per folder and use a > template that generates the listing. I would do it like this: > > /binary/pictures/ > /binary/word/ > /binary/others/ > /binary/pictures.page > /binary/word.page > /binary/others.page > /binary/default.template > > where in the first three directories are the binary files and > each .page file contains something like this: > > ? ? --- > ? ? bin_dir: pictures > > and the default.template contains something like this: > > ? ? <% > ? ? dir = File.join(node.parent.absolute_lcn, node[''bin_dir'']) > ? ? context.content_node.tree.node_access[dir].children.sort.each do |child| > ? ? %> ? > ? ? <%= context.dest_node.link_to(child) > ? ? <% end %> > > -- Thomas > _______________________________________________ > webgen-users mailing list > webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users
Am Fri, 12 Sep 2008 11:13:58 -0700 (PDT) schrieb sutch <dsutch at gmail.com>:> Thomas, > > Using a template seems like it will give me what I need for now. > Thank you. I may look into making a source handler, since I''d like > this to be a bit more dynamic. > > Can you recommend a method for using the template technique and > including captions and other info for each image? I''d assume that > each folder (or file) requires a .metadata file.You can use one .metainfo file for each image, or you create only one metainfo file with meta info for all images. Then you can easily include captions, descriptions, ... For example: /bindir/images/metainfo where this file contains something like image1.jpg: title: foo bar baz caption: bar foo baz desc: baz image2.jpg: caption: bar foo baz and so on. -- Thomas