From kannan at cakoose.com Thu Feb 3 21:47:04 2011 From: kannan at cakoose.com (Kannan Goundan) Date: Fri, 4 Feb 2011 02:47:04 +0000 (UTC) Subject: [webgen-users] Making {include_file} work well with Maruku Message-ID: I write most of my webpage in Maruku, but there are two places where I want to include code samples. I use the {include_file} tag to include the code samples. For example: --- title: "Example" --- name:content pipeline:tags,maruku Please look at the following code: {include_file: {filename: Example.java}} Here is an applet: In the first case, only the first line is placed in a
 block.  The 
rest of the lines are just dumped out at the top level.

In the second case, Maruku complains because the "value" attribute ends 
up expanding to multiple lines.  Is there a way to tell {include_file} to 
escape newlines as well?

Thanks!
-- Kannan


From kannan at cakoose.com  Mon Feb  7 02:58:30 2011
From: kannan at cakoose.com (Kannan Goundan)
Date: Mon, 7 Feb 2011 07:58:30 +0000 (UTC)
Subject: [webgen-users] Making {include_file} work well with Maruku
References: 
Message-ID: 

Kannan Goundan wrote:

> I write most of my webpage in Maruku, but there are two places where I
> want to include code samples.  I use the {include_file} tag to include
> the code samples.  For example:
> 
>    ---
>    title: "Example"
>    --- name:content pipeline:tags,maruku Please look at the following
>    code:
> 
>       {include_file: {filename: Example.java}}
> 
>    Here is an applet:
> 
>    
>           
> 
> In the first case, only the first line is placed in a 
 block.  The
> rest of the lines are just dumped out at the top level.
> 
> In the second case, Maruku complains because the "value" attribute ends
> up expanding to multiple lines.  Is there a way to tell {include_file}
> to escape newlines as well?
> 
> Thanks!
> -- Kannan

I kinda worked around the problem by switching to ERB and writing Ruby 
code to pull in the file.  Is there a way to embed Ruby code in Markdown 
content?


From kannan at cakoose.com  Mon Feb  7 03:00:56 2011
From: kannan at cakoose.com (Kannan Goundan)
Date: Mon, 7 Feb 2011 08:00:56 +0000 (UTC)
Subject: [webgen-users] Pygments
Message-ID: 

The Pygments highlighter supports many more languages than CodeRay.  
Pygments is written in Python, but I've seen non-Python projects use it 
(Jekyll, Pygments).

There's also this: https://github.com/nex3/rb-pygments

Any idea how much work it would be to add Pygments support to Webgen?


From rok at mis.mpg.de  Thu Feb 10 15:14:01 2011
From: rok at mis.mpg.de (Ronald Kriemann)
Date: Thu, 10 Feb 2011 21:14:01 +0100
Subject: [webgen-users] Menu definition problem
Message-ID: <20110210201401.GR3155@munin.mis.mpg.de>

Hi,

I'm currently in the process of switching from my previous web page
management tool (by coincidence also called "webgen" ;-) to webgen-0.5
and stumbled upon a problem regarding the definition of menus, which
I can not resolve either by the online documentation or the previous 
posts in the different groups (maybe it is a too trivial question?)

I want to define a standard menu, e.g.

EntryA
EntryB
~~SubEntryB.1
~~SubEntryB.2
EntryC
~~SubEntryC.1
~~SubEntryC.2

Hence, I have the corresponding file system hierarchy

EntryA.page
EntryB/
EntryB/SubEntryB.1 
...
EntryC/
EntryC/SubEntryC.2 
...

And all is fine. Except, and here comes the problem, when I try to 
change the menu links of the top level entries such that the directly
link to a sub entry instead of the default "index.html", e.g. clicking 
on EntryB in the menu should open EntryB/SubEntryB.1.html. 

By using virtual entries for the top level entries I can have that
behaviour, but I can not deactivate the menu entry for the directory
itself ("in_menu: false" does not work). As soon as one of the sub entries 
has "in_menu: true", the top level entry appears in the menu. I've tried 
different settings for "{menu: }" but either used the wrong switch or
this is not possible. Furthermore, the menu structure is destroyed 
by this, i.e. the virtual entry is not the parent of the sub entries.
In the documentation static menus are mentioned, but I can not find 
any information about defining relations between menu items.

My current fix for the problem is having a "index.html" instead of
a "index.page" in each sub directory and putting an automatic redirection
to the right web page. But I consider this a hack not a real solution.

So my question: how can I change to default definition of the link for 
directories, e.g. replace "index.html" by "SubEntryB.1.html" in the
meta information of EntryB, or how can I define the menu hierarchy for 
virtual entries, e.g. VirtualEntryB is parent of SubEntryB.1, and prevent
appearing the directory entry EntryB in my menu? 

RGDS
  Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4262 bytes
Desc: not available
URL: 

From vbeffara at ens-lyon.fr  Tue Feb 15 08:38:19 2011
From: vbeffara at ens-lyon.fr (Vincent Beffara)
Date: Tue, 15 Feb 2011 14:38:19 +0100
Subject: [webgen-users] Pipeline for LaTeX files
Message-ID: 


Hi,

I have a bunch of LaTeX files which I would like to include into my web
site as individual pages. Thanks to MathJax, this can be done almost
automatically, or at least just by essentially copy-and-pasting the main
{document} environment into the body of a .html file. So far, so good.

I would like to teach webgen to do all that automatically: if I drop a
.tex file into the src/ directory, it should parse it for metadata like
title, date ..., transform it into the proper .html file, with the same
template as for the .page files, include it in the menu and so
on. Trying to figure out how to do that, I got lost in the
documentation.

Where should I start ? Any pointers ?

Thanks for your help,

       /vincent

-- 
|                 |   UMPA - ENS Lyon   | M?l: vbeffara at ens-lyon.fr |
| Vincent Beffara |  46 all?e d'Italie  | T?l: (+33) 4 72 72 85 25  |
|                 | 69364 Lyon Cedex 07 | Fax: (+33) 4 72 72 84 80  |


From t_leitner at gmx.at  Tue Feb 15 09:45:13 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Tue, 15 Feb 2011 15:45:13 +0100
Subject: [webgen-users] Menu definition problem
In-Reply-To: <20110210201401.GR3155@munin.mis.mpg.de>
References: <20110210201401.GR3155@munin.mis.mpg.de>
Message-ID: <20110215154513.00ec77ab@noweto>

On 2011-02-10 21:14 +0100 Ronald Kriemann wrote:
> Hi,
> 
> I'm currently in the process of switching from my previous web page
> management tool (by coincidence also called "webgen" ;-) to webgen-0.5
> and stumbled upon a problem regarding the definition of menus, which
> I can not resolve either by the online documentation or the previous 
> posts in the different groups (maybe it is a too trivial question?)
> 
> I want to define a standard menu, e.g.
> 
> EntryA
> EntryB
> ~~SubEntryB.1
> ~~SubEntryB.2
> EntryC
> ~~SubEntryC.1
> ~~SubEntryC.2
> 
> Hence, I have the corresponding file system hierarchy
> 
> EntryA.page
> EntryB/
> EntryB/SubEntryB.1 
> ...
> EntryC/
> EntryC/SubEntryC.2 
> ...
> 
> And all is fine. Except, and here comes the problem, when I try to 
> change the menu links of the top level entries such that the directly
> link to a sub entry instead of the default "index.html", e.g.
> clicking on EntryB in the menu should open EntryB/SubEntryB.1.html. 
> 
> By using virtual entries for the top level entries I can have that
> behaviour, but I can not deactivate the menu entry for the directory
> itself ("in_menu: false" does not work). As soon as one of the sub
> entries has "in_menu: true", the top level entry appears in the menu.
> I've tried different settings for "{menu: }" but either used the
> wrong switch or this is not possible. Furthermore, the menu structure
> is destroyed by this, i.e. the virtual entry is not the parent of the
> sub entries. In the documentation static menus are mentioned, but I
> can not find any information about defining relations between menu
> items.
> 
> My current fix for the problem is having a "index.html" instead of
> a "index.page" in each sub directory and putting an automatic
> redirection to the right web page. But I consider this a hack not a
> real solution.
> 
> So my question: how can I change to default definition of the link
> for directories, e.g. replace "index.html" by "SubEntryB.1.html" in
> the meta information of EntryB, or how can I define the menu
> hierarchy for virtual entries, e.g. VirtualEntryB is parent of
> SubEntryB.1, and prevent appearing the directory entry EntryB in my
> menu? 

Have a look at the documentation for the meta information `index_path`.
It allows you to define the target page that is used when linking to a
directory - exactly want you want! Just use a meta information file for
setting it, eg. create a file `src/metainfo` and put the following into
it:

--- name:alcn
/EntryB/:
  index_path: SubEntryB.1.html
  in_menu: true

/EntryC/:
  index_path: SubEntryC.1.html
  in_menu: true

Best regards,
  Thomas

From t_leitner at gmx.at  Tue Feb 15 09:50:45 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Tue, 15 Feb 2011 15:50:45 +0100
Subject: [webgen-users] Pygments
In-Reply-To: 
References: 
Message-ID: <20110215155045.480fa4b0@noweto>

On 2011-02-07 08:00 +0000 Kannan Goundan wrote:
> The Pygments highlighter supports many more languages than CodeRay.  
> Pygments is written in Python, but I've seen non-Python projects use
> it (Jekyll, Pygments).
> 
> There's also this: https://github.com/nex3/rb-pygments
> 
> Any idea how much work it would be to add Pygments support to Webgen?

Have a look at the implementation of the xmllint content processor
(for how to use the output of a system command) and the coderay tag
(for how to implement a tag). This should give you an idea on how to
implement a tag that does the same thing as the coderay tag but with
pygments as backend.

-- Thomas

From t_leitner at gmx.at  Tue Feb 15 10:31:32 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Tue, 15 Feb 2011 16:31:32 +0100
Subject: [webgen-users] Making {include_file} work well with Maruku
In-Reply-To: 
References: 
 
Message-ID: <20110215163132.6f7d5206@noweto>

On 2011-02-07 07:58 +0000 Kannan Goundan wrote:
> I kinda worked around the problem by switching to ERB and writing
> Ruby code to pull in the file.  Is there a way to embed Ruby code in
> Markdown content?

You can use the ERB and Maruku content processors together but you need
to be aware of the order in which they are used. It is normally better
to first use the ERB processor and then Maruku because Maruku might
mangle the special start/end tags that ERB uses.

So, the following works as expected:

    --- pipeline:erb,maruku

    > This is a paragraph in a blockquote.

    <% 5.times do %>
    * This is an item
    <% end %>

    Here is a paragraph after the list.

So just use the normal ERB syntax (<% ... %>) anywhere you like and make
sure that you output correct Markdown syntax!

Best regards,
  Thomas

From t_leitner at gmx.at  Wed Feb 16 02:20:12 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Wed, 16 Feb 2011 08:20:12 +0100
Subject: [webgen-users] Pipeline for LaTeX files
In-Reply-To: 
References: 
Message-ID: <20110216082012.14c8f869@noweto>

On 2011-02-15 14:38 +0100 Vincent Beffara wrote:
> I would like to teach webgen to do all that automatically: if I drop a
> .tex file into the src/ directory, it should parse it for metadata
> like title, date ..., transform it into the proper .html file, with
> the same template as for the .page files, include it in the menu and
> so on. Trying to figure out how to do that, I got lost in the
> documentation.
> 
> Where should I start ? Any pointers ?

* First you need to provide a content processor for your tex files that
  parses the .tex files and converts them to HTML. webgen has no
  built-in content processor to do that - you will need to code it
  yourself.

  Have a look at the API documentation for
  [Webgen::ContentProcessor][1] which provides general information and
  an example.

* Then you need to tell the source handler 'page' to use the .tex files
  together with your new content processor (I'll call it `texproc`).
  This can be done by adding the following to your config.yaml:

      patterns:
        Page:
          add: [**/*.tex]

  After that you need to create a src/texfiles.metainfo file with the
  following content:

      --- name:paths
      /**/*.tex:
        blocks:
          default:
            pipeline: texproc

This allows you to:

* Drop in a .tex anywhere in your src/ directory and have it processed
  via the source handler 'page' like any .page file.

* Set the `template` meta information like with normal .page files. Or,
  for that matter, any other meta information you need (like `in_menu).

* And, since webgen assumes that .tex files are in Webgen Page Format,
  you can add a meta information block at the beginning with needed
  meta information. Or just use a meta information file for this
  purpose so that the .tex files don't need to be edited.

The default processing pipeline used for .tex files is set to your
newly created tex processor via the meta information file.

BUT be aware that, since we are using the source handler 'page' for
handling your .tex files, it assumes that .tex files are in the Webgen
Page Format (like .page files). Therefore you would need to escape
three dashes at the beginning of a line. However I don't think that
this happens in .tex files anyway...

Let me know if you need more help/information/pointers!

Best regards,
  Thomas

[1]: http://webgen.rubyforge.org/documentation/rdoc/Webgen/ContentProcessor.html

From kannan at cakoose.com  Wed Feb 16 06:21:42 2011
From: kannan at cakoose.com (Kannan Goundan)
Date: Wed, 16 Feb 2011 03:21:42 -0800 (PST)
Subject: [webgen-users] Pygments
In-Reply-To: <20110215155045.480fa4b0@noweto>
References:  <20110215155045.480fa4b0@noweto>
Message-ID: 

I put code in "/plugins/pygments.rb" but I'm not sure how to
get webgen to find it.  The error I get when I try and use a
{pygments::java} tag:

ERROR -- No default mandatory parameter specified for tag
'Webgen::Tag::Metainfo' but set in 

Also, where do I specify the options that a tag takes?  I didn't see
anything in coderay.rb that defines the set of options.  I'd like to
avoid touching the Webgen source itself (it's installed via Gems) and
restrict everything to the "/plugins" directory if possible.

On Feb 15, 6:50?am, Thomas Leitner  wrote:
> On 2011-02-07 08:00 +0000 Kannan Goundan wrote:
>
> > The Pygments highlighter supports many more languages than CodeRay. ?
> > Pygments is written in Python, but I've seen non-Python projects use
> > it (Jekyll, Pygments).
>
> > There's also this:https://github.com/nex3/rb-pygments
>
> > Any idea how much work it would be to add Pygments support to Webgen?
>
> Have a look at the implementation of the xmllint content processor
> (for how to use the output of a system command) and the coderay tag
> (for how to implement a tag). This should give you an idea on how to
> implement a tag that does the same thing as the coderay tag but with
> pygments as backend.
>
> -- Thomas
> _______________________________________________
> webgen-users mailing list
> webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users

From kannan at cakoose.com  Wed Feb 16 07:07:11 2011
From: kannan at cakoose.com (Kannan Goundan)
Date: Wed, 16 Feb 2011 04:07:11 -0800 (PST)
Subject: [webgen-users] Pygments
In-Reply-To: 
References:  <20110215155045.480fa4b0@noweto>
	
Message-ID: 

I was looking at 0.4 documentation and doing the wrong thing.  If you
put everything in "ext/init.rb" it works, basically.

http://pastebin.com/Dzk6Xpva

You need to specify the highlighting stuff in a style sheet.  This is
what I'm using right now:

/* Keywords */
span.kn,span.kd,span.k,span.kr {
  font-weight: bold;
  color: black;
}

/* Comments */
span.c1 {
  font-weight: bold;
  color: #388048;
}

/* Literals */
span.s,span.mi {
  color: #486088;
}

Pygments supports way more languages than Coderay.  It would be nice
if Webgen supported it out of the box.

-- Kannan

On Feb 16, 3:21?am, Kannan Goundan  wrote:
> I put code in "/plugins/pygments.rb" but I'm not sure how to
> get webgen to find it. ?The error I get when I try and use a
> {pygments::java} tag:
>
> ERROR -- No default mandatory parameter specified for tag
> 'Webgen::Tag::Metainfo' but set in 
>
> Also, where do I specify the options that a tag takes? ?I didn't see
> anything in coderay.rb that defines the set of options. ?I'd like to
> avoid touching the Webgen source itself (it's installed via Gems) and
> restrict everything to the "/plugins" directory if possible.
>
> On Feb 15, 6:50?am, Thomas Leitner  wrote:
>
> > On 2011-02-07 08:00 +0000 Kannan Goundan wrote:
>
> > > The Pygments highlighter supports many more languages than CodeRay. ?
> > > Pygments is written in Python, but I've seen non-Python projects use
> > > it (Jekyll, Pygments).
>
> > > There's also this:https://github.com/nex3/rb-pygments
>
> > > Any idea how much work it would be to add Pygments support to Webgen?
>
> > Have a look at the implementation of the xmllint content processor
> > (for how to use the output of a system command) and the coderay tag
> > (for how to implement a tag). This should give you an idea on how to
> > implement a tag that does the same thing as the coderay tag but with
> > pygments as backend.
>
> > -- Thomas
> > _______________________________________________
> > webgen-users mailing list
> > webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users
>
> _______________________________________________
> webgen-users mailing list
> webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users

From t_leitner at gmx.at  Wed Feb 16 07:41:56 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Wed, 16 Feb 2011 13:41:56 +0100
Subject: [webgen-users] Pygments
In-Reply-To: 
References:  <20110215155045.480fa4b0@noweto>
	
Message-ID: <20110216134156.565275ad@noweto>

On 2011-02-16 03:21 -0800 Kannan Goundan wrote:
> I put code in "/plugins/pygments.rb" but I'm not sure how to
> get webgen to find it.  The error I get when I try and use a
> {pygments::java} tag:
> 
> ERROR -- No default mandatory parameter specified for tag
> 'Webgen::Tag::Metainfo' but set in 
> 
> Also, where do I specify the options that a tag takes?  I didn't see
> anything in coderay.rb that defines the set of options.  I'd like to
> avoid touching the Webgen source itself (it's installed via Gems) and
> restrict everything to the "/plugins" directory if possible.

You need to put your code into the file ext/init.rb so that webgen
finds it. Options are defined outside of the tag class, have a look at
lib/webgen/default_config.rb in the webgen distribution. There you can
see how the coderay tag gets its options defined.

Also have a look at the documentation of
http://webgen.rubyforge.org/documentation/rdoc/Webgen/Tag/Base.html
where everything is described and a sample implementation available.

-- Thomas

From vbeffara at ens-lyon.fr  Wed Feb 16 09:50:21 2011
From: vbeffara at ens-lyon.fr (Vincent Beffara)
Date: Wed, 16 Feb 2011 15:50:21 +0100
Subject: [webgen-users] Pipeline for LaTeX files
References:  <20110216082012.14c8f869@noweto>
Message-ID: 


Hi Thomas, and thanks for the advice !

It already gives quite acceptable results after just a few tries. I'm
glad I chose webgen for my website.

TL> * First you need to provide a content processor for your tex files
TL>   that parses the .tex files and converts them to HTML. webgen has
TL>   no built-in content processor to do that - you will need to code
TL>   it yourself.

Mkay, that step will be the longest because of all the tweaking
necessary, but at least I can manage. Transforming LaTeX into markdown
is not too difficult in first aproximation, and then kramdown will do
the rest.

TL> * Then you need to tell the source handler 'page' to use the .tex
TL>   files together with your new content processor (I'll call it
TL>   `texproc`).

Great. This works as expected.

TL> * Drop in a .tex anywhere in your src/ directory and have it
TL>   processed via the source handler 'page' like any .page file.

That works very well. Only thing is, the generated page is still named
whatever.tex, how can I have it renamed whatever.html instead ?

TL> * Set the `template` meta information like with normal .page
TL>   files. Or, for that matter, any other meta information you need
TL>   (like `in_menu).

This I could not figure out how to do. I know how to parse the file to
extract the title, but how do I tell webgen that this is it? Probably
something like context['title']="Whatever" in the content processor, but
I couldn't figure it out.

TL> * And, since webgen assumes that .tex files are in Webgen Page
TL>   Format, you can add a meta information block at the beginning with
TL>   needed meta information. Or just use a meta information file for
TL>   this purpose so that the .tex files don't need to be edited.

I would rather not touch the .tex file in that way, and have webgen
extract the relevant info automatically instead.

Thanks again !

Cheers,

        /vincent

-- 
|                 |   UMPA - ENS Lyon   | M?l: vbeffara at ens-lyon.fr |
| Vincent Beffara |  46 all?e d'Italie  | T?l: (+33) 4 72 72 85 25  |
|                 | 69364 Lyon Cedex 07 | Fax: (+33) 4 72 72 84 80  |


From vbeffara at ens-lyon.fr  Wed Feb 16 15:56:48 2011
From: vbeffara at ens-lyon.fr (Vincent Beffara)
Date: Wed, 16 Feb 2011 21:56:48 +0100
Subject: [webgen-users] Pipeline for LaTeX files
References:  <20110216082012.14c8f869@noweto>
	
Message-ID: 


Hi again,

TL> * Drop in a .tex anywhere in your src/ directory and have it
TL> processed via the source handler 'page' like any .page file.

VB> That works very well. Only thing is, the generated page is still
VB> named whatever.tex, how can I have it renamed whatever.html instead
VB> ?

OK, I got this one by tweaking the texfiles.metainfo file. Any way to
achieve the same thing (declaring that .tex files should be treated,
setting the output file name) by editing config.yaml instead of creating
such a metainfo file ? Maybe it's just me but I like having the whole
configuration in a single file ...

TL> * Set the `template` meta information like with normal .page
TL> files. Or, for that matter, any other meta information you need
TL> (like `in_menu).

VB> This I could not figure out how to do. I know how to parse the file
VB> to extract the title, but how do I tell webgen that this is it?
VB> Probably something like context['title']="Whatever" in the content
VB> processor, but I couldn't figure it out.

On this I am still looking ... But I am already quite happy with the
results.

Thanks again !

       /v

-- 
|                 |   UMPA - ENS Lyon   | M?l: vbeffara at ens-lyon.fr |
| Vincent Beffara |  46 all?e d'Italie  | T?l: (+33) 4 72 72 85 25  |
|                 | 69364 Lyon Cedex 07 | Fax: (+33) 4 72 72 84 80  |


From t_leitner at gmx.at  Thu Feb 17 03:34:59 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Thu, 17 Feb 2011 09:34:59 +0100
Subject: [webgen-users] Pipeline for LaTeX files
In-Reply-To: 
References:  <20110216082012.14c8f869@noweto>
	 
Message-ID: <20110217093459.333b748c@noweto>

On 2011-02-16 21:56 +0100 Vincent Beffara wrote:
> OK, I got this one by tweaking the texfiles.metainfo file. Any way to
> achieve the same thing (declaring that .tex files should be treated,
> setting the output file name) by editing config.yaml instead of
> creating such a metainfo file ? Maybe it's just me but I like having
> the whole configuration in a single file ...

I don't think so. Most of the "configuration" is done by setting some
meta information on the files. There are some configuration options for
setting default meta information but that's it. The `output_path_style`
meta information determines the output path and it, if not changed for
all files handled by a source handler, is changed via a metainfo file.
 
> VB> This I could not figure out how to do. I know how to parse the
> VB> file to extract the title, but how do I tell webgen that this is
> VB> it? Probably something like context['title']="Whatever" in the
> VB> content processor, but I couldn't figure it out.

Hmmm... that won't work: The meta information for a file is set when
creating the internal node representation for the file and should not
be changed afterwards (for consistency). Since the content processor is
run when writing the file to the destination, it is too late to extract
meta information from the file because other files may have already
been written out and may already have used, for example, the 'title'
meta information.

You can work around this problem by writing your on source handler.
Just copy the implementation of the page handler and, in #create_node,
parse your .tex file, extract and set the needed meta information and
then create the node (ie. the internal representation). This would also
allow you to work around the problem with setting the output path since
you could use the default meta information to set it.

-- Thomas

From kannan at cakoose.com  Thu Feb 17 06:00:17 2011
From: kannan at cakoose.com (Kannan Goundan)
Date: Thu, 17 Feb 2011 03:00:17 -0800 (PST)
Subject: [webgen-users] Pygments
In-Reply-To: <20110216134156.565275ad@noweto>
References:  <20110215155045.480fa4b0@noweto>
	
	<20110216134156.565275ad@noweto>
Message-ID: <0fb0ba9f-a63c-4dee-ba7e-872c203b0c50@n16g2000prc.googlegroups.com>

I'm trying to make "pygments" and "pygmentsfile" tags.  The second
will read in a file for you.

I'm getting strange errors.  My code: http://pastebin.com/AVpXUVez

When I try and use the {pygments} tag, Webgen gives me an error:

  Error in  while rendering 
with Webgen::Tag::Pygments:
      Not all mandatory parameters set: tag.pygmentsfile.filename,
tag.pygmentsfile.lang

(The list of tags is something I added to the error message.)

It looks like the "pygments" tag is requiring parameters associated
with the "pygmentsfile" tag.  What am I doing wrong?


On Feb 16, 4:41?am, Thomas Leitner  wrote:
> On 2011-02-16 03:21 -0800 Kannan Goundan wrote:
>
> > I put code in "/plugins/pygments.rb" but I'm not sure how to
> > get webgen to find it. ?The error I get when I try and use a
> > {pygments::java} tag:
>
> > ERROR -- No default mandatory parameter specified for tag
> > 'Webgen::Tag::Metainfo' but set in 
>
> > Also, where do I specify the options that a tag takes? ?I didn't see
> > anything in coderay.rb that defines the set of options. ?I'd like to
> > avoid touching the Webgen source itself (it's installed via Gems) and
> > restrict everything to the "/plugins" directory if possible.
>
> You need to put your code into the file ext/init.rb so that webgen
> finds it. Options are defined outside of the tag class, have a look at
> lib/webgen/default_config.rb in the webgen distribution. There you can
> see how the coderay tag gets its options defined.
>
> Also have a look at the documentation ofhttp://webgen.rubyforge.org/documentation/rdoc/Webgen/Tag/Base.html
> where everything is described and a sample implementation available.
>
> -- Thomas
> _______________________________________________
> webgen-users mailing list
> webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users

From t_leitner at gmx.at  Thu Feb 17 07:34:45 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Thu, 17 Feb 2011 13:34:45 +0100
Subject: [webgen-users] Pygments
In-Reply-To: <0fb0ba9f-a63c-4dee-ba7e-872c203b0c50@n16g2000prc.googlegroups.com>
References:  <20110215155045.480fa4b0@noweto>
	
	<20110216134156.565275ad@noweto>
	<0fb0ba9f-a63c-4dee-ba7e-872c203b0c50@n16g2000prc.googlegroups.com>
Message-ID: <20110217133445.19f240f9@noweto>

On 2011-02-17 03:00 -0800 Kannan Goundan wrote:
> I'm trying to make "pygments" and "pygmentsfile" tags.  The second
> will read in a file for you.
> 
> I'm getting strange errors.  My code: http://pastebin.com/AVpXUVez
> 
> When I try and use the {pygments} tag, Webgen gives me an error:
> 
>   Error in  while rendering 
> with Webgen::Tag::Pygments:
>       Not all mandatory parameters set: tag.pygmentsfile.filename,
> tag.pygmentsfile.lang
> 
> (The list of tags is something I added to the error message.)
> 
> It looks like the "pygments" tag is requiring parameters associated
> with the "pygmentsfile" tag.  What am I doing wrong?

That seems to be a bug in webgen... Rename your class PygmentsFile to,
for example, FilePygments and it will work. The offending code is in
lib/webgen/tag/base.rb:140.

-- Thomas

From vbeffara at ens-lyon.fr  Thu Feb 17 07:41:17 2011
From: vbeffara at ens-lyon.fr (Vincent Beffara)
Date: Thu, 17 Feb 2011 13:41:17 +0100
Subject: [webgen-users] Pipeline for LaTeX files
References:  <20110216082012.14c8f869@noweto>
	 
	<20110217093459.333b748c@noweto>
Message-ID: 


>> Maybe it's just me but I like having the whole configuration in a
>> single file ...

TL> I don't think so. Most of the "configuration" is done by setting
TL> some meta information on the files. There are some configuration
TL> options for setting default meta information but that's it. The
TL> `output_path_style` meta information determines the output path and
TL> it, if not changed for all files handled by a source handler, is
TL> changed via a metainfo file.

Fair enough, that makes sense. As long as usage is convenient - which it
is, most definitely.

TL> Since the content processor is run when writing the file to the
TL> destination, it is too late to extract meta information from the
TL> file because other files may have already been written out and may
TL> already have used, for example, the 'title' meta information.

Ah, good point, I hadn't thought of that. Even if I had managed to do
what I was looking for, the result would have been wrong anyway.

TL> You can work around this problem by writing your on source handler.

Thanks for the advice, I will try to do that. Somehow it feels a bit
more involved than a content processor, but also more like the right way
to do it.

Cheers,

        /v

-- 
|                 |   UMPA - ENS Lyon   | M?l: vbeffara at ens-lyon.fr |
| Vincent Beffara |  46 all?e d'Italie  | T?l: (+33) 4 72 72 85 25  |
|                 | 69364 Lyon Cedex 07 | Fax: (+33) 4 72 72 84 80  |


From rok at mis.mpg.de  Thu Feb 17 08:17:22 2011
From: rok at mis.mpg.de (Ronald Kriemann)
Date: Thu, 17 Feb 2011 14:17:22 +0100
Subject: [webgen-users] Menu definition problem
Message-ID: <20110217131721.GR3155@munin.mis.mpg.de>

> --- name:alcn
> /EntryB/:
>   index_path: SubEntryB.1.html
>   in_menu: true
>
> /EntryC/:
>   index_path: SubEntryC.1.html
>   in_menu: true

I've tried

/EntryB/:
  index_path: EntryB/SubEntryB.1.html

which had no effect, e.g. still "index.html" was used, but obviously, 
the link is already within the subdirectory.

Thank you very much for the help.

RGDS
  Ronald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4262 bytes
Desc: not available
URL: 

From kannan at cakoose.com  Sat Feb 19 19:58:00 2011
From: kannan at cakoose.com (Kannan Goundan)
Date: Sat, 19 Feb 2011 16:58:00 -0800 (PST)
Subject: [webgen-users] Pygments
In-Reply-To: <20110217133445.19f240f9@noweto>
References:  <20110215155045.480fa4b0@noweto>
	
	<20110216134156.565275ad@noweto>
	<0fb0ba9f-a63c-4dee-ba7e-872c203b0c50@n16g2000prc.googlegroups.com>
	<20110217133445.19f240f9@noweto>
Message-ID: <0432c2ed-b486-492c-94de-0ca4dd72f9f2@u23g2000pro.googlegroups.com>

Renaming to "FilePygments" got rid of that problem, but now I have
another.

My "ext/init.rb" is basically the same as before: http://pastebin.com/tQkaymma

My page has:
   {pygmentsfile: {lang: "cks_type", filename: "examples/
students.tcks"}}

The error I get:
  Error while rendering :
    can't convert nil into String

If I change "ext/init.rb" to have a default value for the "filename"
parameter, webgen uses that default value instead of the one provided
in the tag.

On Feb 17, 4:34?am, Thomas Leitner  wrote:
> On 2011-02-17 03:00 -0800 Kannan Goundan wrote:
>
> > I'm trying to make "pygments" and "pygmentsfile" tags. ?The second
> > will read in a file for you.
>
> > I'm getting strange errors. ?My code:http://pastebin.com/AVpXUVez
>
> > When I try and use the {pygments} tag, Webgen gives me an error:
>
> > ? Error in  while rendering 
> > with Webgen::Tag::Pygments:
> > ? ? ? Not all mandatory parameters set: tag.pygmentsfile.filename,
> > tag.pygmentsfile.lang
>
> > (The list of tags is something I added to the error message.)
>
> > It looks like the "pygments" tag is requiring parameters associated
> > with the "pygmentsfile" tag. ?What am I doing wrong?
>
> That seems to be a bug in webgen... Rename your class PygmentsFile to,
> for example, FilePygments and it will work. The offending code is in
> lib/webgen/tag/base.rb:140.
>
> -- Thomas
> _______________________________________________
> webgen-users mailing list
> webgen-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/webgen-users

From t_leitner at gmx.at  Sun Feb 20 03:23:16 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Sun, 20 Feb 2011 09:23:16 +0100
Subject: [webgen-users] Pygments
In-Reply-To: <0432c2ed-b486-492c-94de-0ca4dd72f9f2@u23g2000pro.googlegroups.com>
References:  <20110215155045.480fa4b0@noweto>
	
	<20110216134156.565275ad@noweto>
	<0fb0ba9f-a63c-4dee-ba7e-872c203b0c50@n16g2000prc.googlegroups.com>
	<20110217133445.19f240f9@noweto>
	<0432c2ed-b486-492c-94de-0ca4dd72f9f2@u23g2000pro.googlegroups.com>
Message-ID: <20110220092316.7d37639c@noweto>

On 2011-02-19 16:58 -0800 Kannan Goundan wrote:
> Renaming to "FilePygments" got rid of that problem, but now I have
> another.
> 
> My "ext/init.rb" is basically the same as before:
> http://pastebin.com/tQkaymma
> 
> My page has:
>    {pygmentsfile: {lang: "cks_type", filename: "examples/
> students.tcks"}}
> 
> The error I get:
>   Error while rendering :
>     can't convert nil into String
> 
> If I change "ext/init.rb" to have a default value for the "filename"
> parameter, webgen uses that default value instead of the one provided
> in the tag.

After renaming your class you also need to change all occurences of
pygmentsfile to filepygments since the default way for webgen to find
the options for a tag class is by using the class name! I.e.
`tag.pygmentsfile.lang` ? `tag.filepygments.lang`!

-- Thomas



-- 
|\  Thomas Leitner  --  thomas [underscore] leitner [at] gmx [dot] at
|>
|/  "Life is what happens to you while you're busy making other plans"

From vbeffara at ens-lyon.fr  Thu Feb 24 06:19:22 2011
From: vbeffara at ens-lyon.fr (Vincent Beffara)
Date: Thu, 24 Feb 2011 12:19:22 +0100
Subject: [webgen-users] Pipeline for LaTeX files
References:  <20110216082012.14c8f869@noweto>
	 
	<20110217093459.333b748c@noweto> 
Message-ID: 


Hello,

    TL> You can work around this problem by writing your on source
    TL> handler.

    VB> Thanks for the advice, I will try to do that. Somehow it feels a
    VB> bit more involved than a content processor, but also more like
    VB> the right way to do it.

I finally managed to do just that, and it works beautifully. Thanks
again ! (Finally I ended up generating html directly rather than
markdown, because escaping the _ and * from latex files was a bit
hit-and-miss ...) It looks like this,

http://www.umpa.ens-lyon.fr/~vbeffara/articles/Cardy_Easy.html

and actually mathjax is doing most of the work for me. I did have to
tweak the .tex file a little bit to make parsing it easier, but I can
live with that.

I have a ruby question though, to see if I got everything right. Page
derives from Base, and I wanted to derive LaTeX from Page because it is
mostly a tweak on it, just to extract one piece of metadata. But
extracting it before calling super is overridden, and extracting it
afterwards is too late ... so I ended up doing this (found by googling,
I don't really get what happens here):

| module Webgen::SourceHandler
|   class LaTeX < Page
|     def create_node(path)
|       page = page_from_path(path)
|       path.meta_info['lang'] ||= website.config['website.lang']
|       path.ext = 'html' if path.ext == 'tex'
|       
|       page.blocks[1].content.lines do |l|
|         if l.match(/\\title\{(.*)\}/): path.meta_info['title'] = $1 end
|       end
| 
|       path.meta_info['title'].gsub!( /\\[A-Za-z]* */, ' ' )
| 
|       Base.instance_method(:create_node).bind(self).call(path) do |node|
|         node.node_info[:sh_page_node_mi] = \
            Webgen::Page.meta_info_from_data(path.io.data)
|         node.node_info[:page] = page
|       end
|     end
|   end
| end

Is there a better way to do the last bit ?

Thanks again for everyhting !

       /v

-- 
|                 |   UMPA - ENS Lyon   | M?l: vbeffara at ens-lyon.fr |
| Vincent Beffara |  46 all?e d'Italie  | T?l: (+33) 4 72 72 85 25  |
|                 | 69364 Lyon Cedex 07 | Fax: (+33) 4 72 72 84 80  |


From t_leitner at gmx.at  Thu Feb 24 09:47:24 2011
From: t_leitner at gmx.at (Thomas Leitner)
Date: Thu, 24 Feb 2011 15:47:24 +0100
Subject: [webgen-users] Pipeline for LaTeX files
In-Reply-To: 
References:  <20110216082012.14c8f869@noweto>
	 
	<20110217093459.333b748c@noweto> 
	
Message-ID: <20110224154724.4168390a@noweto>

On 2011-02-24 12:19 +0100 Vincent Beffara wrote:
> I have a ruby question though, to see if I got everything right. Page
> derives from Base, and I wanted to derive LaTeX from Page because it
> is mostly a tweak on it, just to extract one piece of metadata. But
> extracting it before calling super is overridden, and extracting it
> afterwards is too late ... so I ended up doing this (found by
> googling, I don't really get what happens here):
> 
> | module Webgen::SourceHandler
> |   class LaTeX < Page
> |     def create_node(path)
> |       page = page_from_path(path)
> |       path.meta_info['lang'] ||= website.config['website.lang']
> |       path.ext = 'html' if path.ext == 'tex'
> |       
> |       page.blocks[1].content.lines do |l|
> |         if l.match(/\\title\{(.*)\}/): path.meta_info['title'] = $1
> end |       end
> | 
> |       path.meta_info['title'].gsub!( /\\[A-Za-z]* */, ' ' )
> | 
> |       Base.instance_method(:create_node).bind(self).call(path) do
> |node| |         node.node_info[:sh_page_node_mi] = \
>             Webgen::Page.meta_info_from_data(path.io.data)
> |         node.node_info[:page] = page
> |       end
> |     end
> |   end
> | end
> 
> Is there a better way to do the last bit ?

I don't think that there is a better way to do this. I will add a TODO
item to restructure the code to make such tweaks easier!

What `Base.instance_method...` does is that it retrieves the
`create_node` method from the Webgen::Base class, ie. the actual
implementation. This returns an object of class Method. Such a Method
object can be bound to an instance (done with `bind(self)` and then
called. This allows you to directly invoke the Webgen::Base#create_node
method which would not be possible with `super(...)`. 

-- Thomas