Thread: [Rest2web-develop] Multiple templates, same content
Brought to you by:
mjfoord
From: Donald J. W. <don...@hp...> - 2006-02-23 00:58:21
|
Hello, I'm attempting to use rest2web to completely redesign our website (hpinkjet.sf.net) to be more easily updated and managed. One requirement that I have is that I need to be able to create 2 separate sets of HTML pages that have a completely different look-and-feel (one for the website and one to be included in our tarball that will eventually be converted to PDF). I currently see no way to pass-in or otherwise externally influence the template that will be used during a run of r2w.py since it is specified statically, with the content, in the restindex. The only way I can see to do this is to copy the first template in place, run r2w with one config file and then overwrite the template file and run r2w again with a second config file (to be able to change the output directory). Is there a more elegant way to accomplish this? Can I make the template programmable/dynamic in some way using the <# #> blocks? Thanks for this great tool, Don |
From: Fuzzyman <fuz...@vo...> - 2006-02-23 09:24:03
|
Donald J. Welch wrote: > Hello, > I'm attempting to use rest2web to completely redesign our website > (hpinkjet.sf.net) to be more easily updated and managed. > > One requirement that I have is that I need to be able to create 2 > separate sets of HTML pages that have a completely different > look-and-feel (one for the website and one to be included in our tarball > that will eventually be converted to PDF). > > I currently see no way to pass-in or otherwise externally influence the > template that will be used during a run of r2w.py since it is specified > statically, with the content, in the restindex. The only way I can see > to do this is to copy the first template in place, run r2w with one > config file and then overwrite the template file and run r2w again with > a second config file (to be able to change the output directory). > > Is there a more elegant way to accomplish this? Can I make the template > programmable/dynamic in some way using the <# #> blocks? > > I have a similar situation to you, for rest2web, Firedrop and Movable Python I have one template for the online version (replete with adverts), and another template for the docs bundled with the distributions. I currently run rest2web and copy the files. Then I rename 'template.txt' to '_template.txt' and the second template I rename to 'template.txt', then run rest2web again. The alternative would be to change a single line in the main restindex. The easiest way to do this would be with a batch file or shell script that does the two pass process. Alternatively, what mechanism would you *like* me to build into rest2web ? I have in mind to allow the setting of uservalues in the *config file*. This will allow plugins to access global values for a site. Then your template could check for this value and either include an external file or do other magic depending on the value. You could then just create two config files for the two different builds (also specifying different target locations). For the moment a shell script that renames the template file is the easiest solution, but the other way may be possible at some point in the future. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Thanks for this great tool, > > Don > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Rest2web-develop mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/rest2web-develop > > |
From: Peter B. <pe...@pe...> - 2006-02-23 11:09:00
|
On Thursday 23 February 2006 09:23, Fuzzyman wrote: > Alternatively, what mechanism would you *like* me to build into rest2web ? How about a command-line option to set the restindex filename rest2web looks for? Peter -- Quake II build tools: http://peter-b.co.uk/ v2sw6YShw7$ln5pr6ck3ma8u6/8Lw3+2m0l7Ci6e4+8t4Eb8Aen5+6g6Pa2Xs5MSr5p4 hackerkey.com |
From: Fuzzyman <fuz...@vo...> - 2006-02-23 11:14:33
|
Peter Brett wrote: > On Thursday 23 February 2006 09:23, Fuzzyman wrote: > > >> Alternatively, what mechanism would you *like* me to build into rest2web ? >> > > How about a command-line option to set the restindex filename rest2web looks > for? > > Do you mean the *template* filename ? Allowing the over-riding of a single restindex option through the command line is kookie but probably acceptable. It would also only work for sites with a single template. As it's a situation I'm in myself, and probably not uncommon, finding the most elegant solution would be good.A GUI front end would make this easier of course, but probably not an option beloved of everyone anyway (so a command line/config file solution as well would be good). Alternatively the *template* could probably already check the command line arguments. This would break if I added any other command line arguments. At the moment the first argument is always the config file, but no other command line options are used. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Peter > > |
From: Peter B. <pe...@pe...> - 2006-02-23 11:49:55
|
On Thursday 23 February 2006 11:13, Fuzzyman wrote: > Alternatively the *template* could probably already check the command > line arguments. This would break if I added any other command line > arguments. At the moment the first argument is always the config file, > but no other command line options are used. > What about having a special argument, e.g. '--' after which all remaining arguments are passed to the template? Either that or a '--template-args=<string>'... Peter -- Quake II build tools: http://peter-b.co.uk/ v2sw6YShw7$ln5pr6ck3ma8u6/8Lw3+2m0l7Ci6e4+8t4Eb8Aen5+6g6Pa2Xs5MSr5p4 hackerkey.com |
From: Fuzzyman <fuz...@vo...> - 2006-02-23 13:44:19
|
Peter Brett wrote: > On Thursday 23 February 2006 11:13, Fuzzyman wrote: > > >> Alternatively the *template* could probably already check the command >> line arguments. This would break if I added any other command line >> arguments. At the moment the first argument is always the config file, >> but no other command line options are used. >> >> > > What about having a special argument, e.g. '--' after which all remaining > arguments are passed to the template? Either that or a > '--template-args=<string>'... > We have to decide whether the best thing is to pass an option to specify a different file for the template or a value that the template can use to decide what to do. The disadvantage of the second is that you end up with conditional code inside your template, and possibly having to duplicate your html, all inside '<# ... #>' tags. Alternatively you could in your main 'template.txt', just load another file I suppose. The disadvantage of the first is that it means specifying a global value for something that can be set on individual files. Not necessarily a disadvantage - just not so orthogonal. How about : '--template-file=<path>' ? Would be easy enough to implement, and can be overridden for individual files or directories in the restindex. I still intend to implement global values in the config file - so it would be possible to customize that way *anyway*. Maybe a way of passing in uservalues via the command line would be a good thing to implement at the same time. That way you can implement whatever run-time 'switches' you want in templates or content. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Peter > > |
From: Peter B. <pe...@pe...> - 2006-02-23 17:50:24
|
On Thursday 23 February 2006 13:43, Fuzzyman wrote: > Peter Brett wrote: > > On Thursday 23 February 2006 11:13, Fuzzyman wrote: > >> Alternatively the *template* could probably already check the command > >> line arguments. This would break if I added any other command line > >> arguments. At the moment the first argument is always the config file, > >> but no other command line options are used. > > > > What about having a special argument, e.g. '--' after which all remaining > > arguments are passed to the template? Either that or a > > '--template-args=<string>'... > > [...] > > How about : > > '--template-file=<path>' > > ? > > Would be easy enough to implement, and can be overridden for individual > files or directories in the restindex. > Can we have --template-args=<string> _as_well_? I've already thought of some excellent uses for it. I don't see any direct problems with putting it in - if users want to do bizarre conditional logic in their template, why the hell not? Peter :) -- Quake II build tools: http://peter-b.co.uk/ v2sw6YShw7$ln5pr6ck3ma8u6/8Lw3+2m0l7Ci6e4+8t4Eb8Aen5+6g6Pa2Xs5MSr5p4 hackerkey.com |
From: Michael F. <fuz...@vo...> - 2006-02-23 23:11:30
|
Peter Brett wrote: > On Thursday 23 February 2006 13:43, Fuzzyman wrote: > >> Peter Brett wrote: >> >>> On Thursday 23 February 2006 11:13, Fuzzyman wrote: >>> >>>> Alternatively the *template* could probably already check the command >>>> line arguments. This would break if I added any other command line >>>> arguments. At the moment the first argument is always the config file, >>>> but no other command line options are used. >>>> >>> What about having a special argument, e.g. '--' after which all remaining >>> arguments are passed to the template? Either that or a >>> '--template-args=<string>'... >>> >> [...] >> >> How about : >> >> '--template-file=<path>' >> >> ? >> >> Would be easy enough to implement, and can be overridden for individual >> files or directories in the restindex. >> >> > > Can we have --template-args=<string> _as_well_? I've already thought of some > excellent uses for it. I don't see any direct problems with putting it in - > if users want to do bizarre conditional logic in their template, why the hell > not? > Ok, but [part of..] my proposal is more *general*. I propose to allow the setting of 'uservalues' (note the plural) from the command line. These can be used for whatever you want - including conditional logic in the templates. :-) I haven't decided on the syntax, but it's going to be a couple of weeks before I can implement this. rest2web is gradually climbing to the top of my 'todo' list. Now if only a Firedrop user didn't keep adding features, I'd be free to work on rest2web. *sigh* All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Peter :) > > |
From: Michael F. <fuz...@gm...> - 2006-03-31 18:50:24
|
On 23/02/06, Donald J. Welch <don...@hp...> wrote: > > Hello, > I'm attempting to use rest2web to completely redesign our website > (hpinkjet.sf.net) to be more easily updated and managed. Hello Donald, I'm finally doing some updates on rest2web. Is the current website ( http://hplip.sourceforge.net/ ) built with rest2web ? Hopefully I will soon be able to implement some of the features we discussed. Michael Foord One requirement that I have is that I need to be able to create 2 > separate sets of HTML pages that have a completely different > look-and-feel (one for the website and one to be included in our tarball > that will eventually be converted to PDF). > > I currently see no way to pass-in or otherwise externally influence the > template that will be used during a run of r2w.py since it is specified > statically, with the content, in the restindex. The only way I can see > to do this is to copy the first template in place, run r2w with one > config file and then overwrite the template file and run r2w again with > a second config file (to be able to change the output directory). > > Is there a more elegant way to accomplish this? Can I make the template > programmable/dynamic in some way using the <# #> blocks? > > Thanks for this great tool, > > Don > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > Rest2web-develop mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/rest2web-develop > -- http://www.Voidspace.org.uk The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fictio= n and more. --- http://www.Voidspace.org.uk/python/index.shtml Python utilities, modules and apps. Including Nanagram, Dirwatcher and more. --- http://www.fuchsiashockz.co.uk http://groups.yahoo.com/group/void-shockz --- Everyone has talent. What is rare is the courage to follow talent to the dark place where it leads. -Erica Jong Ambition is a poor excuse for not having sense enough to be lazy. -Milan Kundera |
From: Marc <Ma...@ro...> - 2006-04-01 06:56:59
|
On Fri, 31 Mar 2006 19:43:48 +0100 Michael Foord <fuz...@gm...> wrote: > > Date: > Fri, 31 Mar 2006 19:43:48 +0100 > From: > Michael Foord <fuz...@gm...> > Subject: > Re: [Rest2web-develop] Multiple templates, same content > To: > res...@li... > Reply-To: > res...@li... > On 23/02/06, Donald J. Welch <don...@hp...> wrote: > Hello, > I'm attempting to use rest2web to completely redesign our website > (hpinkjet.sf.net) to be more easily updated and managed. > Hello Donald, > I'm finally doing some updates on rest2web. Is the current website ( http://hplip.sourceforge.net/ ) built with rest2web ? > Hopefully I will soon be able to implement some of the features we discussed. > Michael Foord > > One requirement that I have is that I need to be able to create 2 > separate sets of HTML pages that have a completely different > look-and-feel (one for the website and one to be included in our tarball > that will eventually be converted to PDF). > I currently see no way to pass-in or otherwise externally influence the > template that will be used during a run of r2w.py since it is specified > statically, with the content, in the restindex. The only way I can see > to do this is to copy the first template in place, run r2w with one > config file and then overwrite the template file and run r2w again with > a second config file (to be able to change the output directory). > Is there a more elegant way to accomplish this? Can I make the template > programmable/dynamic in some way using the <# #> blocks? > Thanks for this great tool, > Don > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Rest2web-develop mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/rest2web-develop > -- > http://www.Voidspace.org.uk > The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fiction and more. > --- > http://www.Voidspace.org.uk/python/index.shtml > Python utilities, modules and apps. > Including Nanagram, Dirwatcher and more. > --- > http://www.fuchsiashockz.co.uk > http://groups.yahoo.com/group/void-shockz > --- > Everyone has talent. What is rare is the courage to follow talent > to the dark place where it leads. -Erica Jong > Ambition is a poor excuse for not having sense enough to be lazy. > -Milan Kundera Hi, Where do I find the new version of rest2web Thanks, Marc |