forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin <>
Subject alternate stylesheet switching in Forrest
Date Wed, 26 Oct 2005 17:20:46 GMT
Thought I'd have another go at what I called "theme switching" but this
time with the pelt skin/view using corner images and doing things within
Forrest. No Perl script to (a) generate the stylesheets from data
structures and (b) use another Perl script to generate a library of sets
of corner images in different color themes. Each alternate stylesheet
needs it's own set of themed corner images. 

I was sucessful in using Forrest to solve the two parts of the problem
(a) & (b) above. They work independantly but not together. I have tried
but *failed* in this and understanding what I can do with Forrest.

Here are my ideas so far:

  <theme name="">
    <color name="header"    value="#294563"/>
    <color name="tab-selected" value="#4a6d8c" link="#0F3660"
vlink="#0F3660" hlink="#000066"/>
<!-- like skinconf but change ^^^^ to hot shades of red -->
  <theme name="">
    <color name="header"    value="#294563"/>
    <color name="tab-selected" value="#00ff00" link="#0F3660"
vlink="#0F3660" hlink="#000066"/>
<!-- like skinconf but change ^^^^ to cool shades of blue -->

Requests in the form of **skin/view.theme.css ie:

will be matched in resouces.xmap [1] and call template
'view.theme.css.xslt' with a theme parameter ie: theme =
'' or '' and the style sheets will
be generated.

view.theme.css.xslt is like profile.css.xslt but using
themeconfig.xml data and dealing with corner images.

As each alternate stylesheet uses a differnet set of colors
matching a url in all style sheets of the form

#header .round-top-left-small {
background: url(images/rc-t-l-5-1header-2searchbox-3searchbox.png) 0 0

won't work as header/searchbox will need to come from a different
color theme in each style sheet

So 'view.theme.css.xslt' inserts the hex color values from
themeconfig.xml rather than names ie:

#header .round-top-left-small {
background: url(images/rc-t-l-5-X294563-X4a6d8c-X4a6d8c.png) 0 0 no-

Requests in the form skin/images**/*c-*-*-*-X*-X*-X*.png
will be matched in resources.xmap [2] and call 'rcX.svg.xslt'
etc. modified to use hex values.


Run "forrest site" and the link crawler matches the style sheet
requests in the view file
and they are generated correctly. Game Over :(

Doh! I was expecting the link crawler to then parse the url corner
image requests and generated the png from svg as normal.

I can't understand this. If a static css file is requested it goes
through pipelines and serialized and the corner image links are
crawled and generated? Why can't I do this with a generated css?

I must be missing something, can someone help here? Thanks.



Well all is not lost I could run forrest site twice :(
a) forrest site to generate the css files
b) copy them from build/site/skin to src/documentation/skins/css/
c) forrest site to generate the corner images


         <map:match pattern="**skin/*.*.css"> <!-- eg: -->
             <map:call resource="theme-read">
                 <map:parameter name="path" value="css" />
                 <map:parameter name="name" value="{2}.{3}" />
                 <map:parameter name="mime-type" value="text/css" />
     <map:resource name="theme-read">
        <map:select type="exists">
          <map:when test="{project:skins-dir}{path}/{name}.css">
            <map:call resource="read-linked-text">
              <map:parameter name="path" value="{project:skins-
dir}{path}/{name}.css" />
          <map:when test="{project:skins-
            <map:call resource="theme-transform">
              <map:parameter name="path" value="{project:skins-
dir}{path}/view.theme.css.xslt" />
              <map:parameter name="name" value="{name}" />
              <map:parameter name="mime-type" value="{mime-type}" />
            <map:read src=".err./{path}/{name}.css" mime-type="{mime-
type}" />

      <map:resource name="theme-transform">
        <map:generate src="cocoon://themeconfig.xml" />
        <map:transform src="{path}">
           <map:parameter name="theme" value="{name}" />
        <map:serialize type="text" mime-type="{mime-type}"/>

         <map:match pattern="skin/images**/*c-*-*-*-X*-X*-X*.png">
           <map:call resource="read-svg2png-corner-resource">
             <map:parameter name="path" value="images/{1}" />
             <map:parameter name="name" value="{2}cX" />
             <map:parameter name="orientation-tb" value="{3}"/>
             <map:parameter name="orientation-lr" value="{4}"/>
             <map:parameter name="size" value="{5}"/>
             <map:parameter name="bg-color-name" value="{6}"/>
             <map:parameter name="stroke-color-name" value="{7}"/>
             <map:parameter name="fg-color-name" value="{8}"/>

View raw message