[Templates] printable versions of pages

Nic Gibson nicg@noslogan.org
Wed, 8 Nov 2006 00:27:39 +0000


--Apple-Mail-1--45134024
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


On Nov 7, 2006, at 23:23, Dustin Frazier wrote:

> I have a 150+ page static website that I built using TT2 and  
> ttree.  No raw Perl except for a couple of formatting macros in a  
> pre-processing template.  I'm trying to add a feature to every page  
> which links to a printable version of the page, in this case, the  
> main content of the page without the surrounding navigation menus,  
> header, footer, etc.  I would obviously like each printable page  
> built from the same template as its corresponding web page.
>
> I'm wondering if there's a "standard" way that people solve this  
> using ttree.  Since the printable pages will reference images,  
> styles, links, etc. in common with the main pages, ideally the  
> printable version of each page will live in the same directory as  
> it's source page.  I was hoping to use the "suffix" config  
> parameter of ttree to create something like foo.html and foo_p.html  
> for each page, but it looks like you can only manipulate the  
> characters after the dot.
>
> My current solution is to 1) create a separate ttree.cfg file that  
> adds a new lib directory before the normal ones which holds  
> simplified versions of my page wrapper template (and header,  
> footer, etc.); 2) use ".html" for the main pages and ".htm" for the  
> printable pages, again via the two different ttree.cfg files and  
> different "suffix" configs.  Seems like a bit of a hack, and it's  
> also a little confusing keeping the subtly different filenames  
> straight.
>
> Other solutions I've thought of but haven't tried:
>
> - use a non-standard file extension for the printable pages and  
> configure Apache to serve them up as HTML
> - build a separate tree of printable pages that (somehow) still  
> reference images in the right place
> - put printable pages in subdirectories relative to their source  
> page and again deal with the image references
>
> Is there another more elegant solution that I'm missing?
>
> Dustin
>


I may be unhelpful but... does your static website use css? If so,  
could you do this by using a print media css file and exactly the  
same html? That's the approach we tend to use (display: none is  
helpful here)


cheers

nic
--Apple-Mail-1--45134024
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; "><BR><DIV><DIV>On Nov 7, 2006, at =
23:23, Dustin Frazier wrote:</DIV><BR =
class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite">  =
<DIV><SPAN class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">I =
have a 150+ page static website that I built using TT2 and ttree.=A0 No =
raw Perl except for a couple of formatting macros in a pre-processing =
template.=A0 I'm trying to add a feature to every page which links to a =
printable version of the page, in this case, the main content of the =
page without the surrounding navigation menus, header, footer, etc.=A0 I =
would obviously like each printable page built from the same template as =
its corresponding web page.</FONT></SPAN></DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">I'm =
wondering if there's a "standard" way that people solve this using =
ttree.=A0 Since the printable pages will reference images, styles, =
links, etc. in common with the main pages, ideally the printable version =
of each page will live in the same directory as it's source page.=A0 I =
was hoping to use the "suffix" config parameter of ttree to create =
something like foo.html and foo_p.html for each page, but it looks like =
you can only manipulate the characters after the =
dot.</FONT></SPAN></DIV> <DIV><SPAN class=3D"624410823-07112006"><FONT =
face=3D"Arial" size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">My current =
solution is to 1) create a separate ttree.cfg file that adds a new lib =
directory before the normal ones which holds simplified versions of my =
page wrapper template (and header, footer, etc.); 2) use ".html" for the =
main pages and ".htm" for the printable pages, again via the two =
different ttree.cfg files and different "suffix" configs.=A0 Seems like =
a bit of a hack, and it's also a little confusing keeping the subtly =
different filenames straight.</FONT></SPAN></DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">Other =
solutions I've thought of but haven't tried:</FONT></SPAN></DIV> =
<DIV><SPAN class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">- use a =
non-standard file extension for the printable pages and configure Apache =
to serve them up as HTML</FONT></SPAN></DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">- build a =
separate tree of printable pages that (somehow) still reference images =
in the right place</FONT></SPAN></DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">- put =
printable pages in subdirectories relative to their source page and =
again deal with the image references</FONT></SPAN></DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" size=3D"2">Is there =
another more elegant solution that I'm missing?</FONT></SPAN></DIV> =
<DIV><SPAN class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2"></FONT></SPAN>=A0</DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2">Dustin</FONT></SPAN></DIV> <DIV><SPAN =
class=3D"624410823-07112006"><FONT face=3D"Arial" =
size=3D"2"></FONT></SPAN>=A0</DIV></BLOCKQUOTE></DIV><BR><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>I may be unhelpful but... =
does your static website use css? If so, could you do this by using a =
print media css file and exactly the same html? That's the approach we =
tend to use (display: none is helpful here)</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>cheers</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>nic</DIV></BODY></HTML>=

--Apple-Mail-1--45134024--