Hello, If you don''t mind, just another question. I would like to make use of additional link attributes in the meta info section. Actually I want to add a special css-class (piwik_download) to links to certain files, i.e. to make Piwik [1] track clicks on them as downloads. But it doesn''t work: Say I have a test.page with this meta information: --- title: Ein Piwik-Test link_attrs: {title: Large test page, class: piwik_download} --- In another page I add a link to this page (let''s say index.page): [Testseite](/test.html) In the resulting index.html all I get is this HTML-code: <p><a href="test.html">Testseite</a>.</p> So webgen doesn''t recognize the additionally set attributes. :-( But in the automatically generated sitemap.html I get the right HTML-code: <a class="piwik_download" href="test.html" title="Large test page">Ein Piwik-Test</a> Here webgen /does/ pays attention to the additional meta info. Is this an intended behaviour? The documentation [2, 3] makes no such difference between user-made- and webgen-generated-links. From the mailing list [4, 5], especially [4] I think it *should* work; but Thomas Deselaers did have exactly the same problems as I do (not solved, then). By the way, I am using webgen 0.5.13 from the Ubuntu repositories. Thanks for your assistance, Frank [1] <http://piwik.org/docs/javascript-tracking/#toc-force-a-click-on-a-link-to-be-recorded-as-a-download-in-piwik> [2] <http://webgen.rubyforge.org/documentation/reference_metainfo.html> [3] <http://webgen.rubyforge.org/documentation/faq.html> [4] <http://rubyforge.org/pipermail/webgen-users/2009-November/000597.html> [5] <http://rubyforge.org/pipermail/webgen-users/2008-August/000226.html>
On 2012-06-25 21:30 +0200 Frank Ellebrecht wrote:> In another page I add a link to this page (let''s say index.page): > > [Testseite](/test.html) > > In the resulting index.html all I get is this HTML-code: > > <p><a href="test.html">Testseite</a>.</p> > > So webgen doesn''t recognize the additionally set attributes. :-( > > But in the automatically generated sitemap.html I get the right > HTML-code: > > <a class="piwik_download" href="test.html" title="Large test > page">Ein Piwik-Test</a> > > Here webgen /does/ pays attention to the additional meta info. Is this > an intended behaviour? The documentation [2, 3] makes no such > difference between user-made- and webgen-generated-links. From the > mailing list [4, 5], especially [4] I think it *should* work; but > Thomas Deselaers did have exactly the same problems as I do (not > solved, then).There is a fine difference between the first case, where it doesn''t work, and the second, where it works: * In the first case, you are using Markdown to generate an HTML `<a>` tag. What I have done with the default Markdown processor (kramdown) is that you don''t need to use the `{relocatable:}` tag because all links are automatically relocated. This means that links are automatically resolved and unresolvable links are automatically reported. Please note that the Markdown processor generates the HTML `<a>` tag *and not webgen*! * In the second case webgen is used to output links (ie. the method Webgen::Node#link_to is used internally) and therefore it respects the `link_attrs` meta infomation. All webgen generated links will work correctly! If you want to have a correct link in the first case, have a look at the [link] tag which should give you the correct result! Ie. use the following: {link: {path: /test.html, attr: {:link_text: Testseite}} Best regards, Thomas [link]: http://webgen.rubyforge.org/documentation/tag/link.html
Hello Thomas, Thank you very much for the explanation. I have to admit that all these different pipelines, handlers, parsers etc. are the most difficult part when working with webgen. Understanding how they all work together is way beyond me; I just thought webgen would also render the markdown Markup... That said, it works! And if I omit everything else and just use {link: /test.html} the link gets all its properties from the meta info block in test.page (or a corresponding metainfo-file for PDFs, PHP-scripts, ...). That''s awesome! Frank Am 25.06.2012 22:34, schrieb Thomas Leitner:> On 2012-06-25 21:30 +0200 Frank Ellebrecht wrote: >> In another page I add a link to this page (let''s say index.page): >> >> [Testseite](/test.html) >> >> In the resulting index.html all I get is this HTML-code: >> >> <p><a href="test.html">Testseite</a>.</p> >> >> So webgen doesn''t recognize the additionally set attributes. :-( >>[...]> > If you want to have a correct link in the first case, have a look at the > [link] tag which should give you the correct result! Ie. use the > following: > > {link: {path: /test.html, attr: {:link_text: Testseite}} > > Best regards, > Thomas > > [link]: http://webgen.rubyforge.org/documentation/tag/link.html
On 2012-06-26 01:17 +0200 Frank Ellebrecht wrote:> Hello Thomas, > > Thank you very much for the explanation. I have to admit that all > these different pipelines, handlers, parsers etc. are the most > difficult part when working with webgen. Understanding how they all > work together is way beyond me; I just thought webgen would also > render the markdown Markup...webgen *does* render the Markdown markup. However, it does this by using a third-party library (kramdown, maruku, rdiscount, ...) and therefore has no control over what is generated. Short explanations: * Handlers are the things that take a source path and create one or more nodes from it. A node is the internal representation of an output path and is always linked to a source path. For example, the page handler uses a .page file as source for a .html file. The handler knows what content it has to expect from a file and how to transform it into the output file. * The pipeline defines how a block of a file in Webgen Page Format (e.g. all .page and .template files) gets processed. It consists of zero, one or more content processor names and these content processors are called in turn to process the content. For example, if you have `pipeline:erb,markdown,tags` the content is first processed with the ERB content processor (which can be used to add inline Ruby statements), the Markdown processor (which converts the content to HTML) and the Tags processor (which replaced webgen tags with their generated content, i.e. menus, breadcrumb trails, ...)> That said, it works! And if I omit everything else and just use > > {link: /test.html} > > the link gets all its properties from the meta info block in test.page > (or a corresponding metainfo-file for PDFs, PHP-scripts, ...). That''s > awesome!If you have any other questions, feel free to ask! Best regards, Thomas