forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brolin Empey" <brolin.em...@gmail.com>
Subject Re: using Subversion keyword substitution instead of published date in skin navstrip
Date Sat, 31 Mar 2007 01:24:44 GMT
Thanks for the suggestions.

I missed the FAQ about the CVS keywords because I was searching the
FAQ page for SVN terms.

I already knew that the "Last Published" line was written by
client-side JavaScript code.  This led me to believe that client-side
scripting was used because it was not possible to include
page-specific properties in the output of the skinning process.  I
decided to ask on this list in case my assumption was incorrect.

For now, I have settled on using the SVN "Id" keyword in the body of
each page.  This is not as elegant of a solution as having the
expansion of the "Id" keyword in the skin, since it means there is a
chance of having a page without the "Id" keyword.  However, my
solution is still better than the "Last Published" line, because the
latter always prints the current date and time on my public Web site.
This is misleading and not useful.  It is much more useful and
meaningful to me to have the date and time the source file was last
modified.

Here is what I did:

In main/webapp/skins/pelt/xslt/html/site2xhtml.xsl I used a test that
is always false to disable the JavaScript code in the "last-published"
template that writes the "Last Published" line.  I had to do this
because XML does not allow nested comments.  This worked, but the line
where "Last Published" used to be written was now too short because it
contained no characters.  I solved this by having the "last-published"
template write a non-breaking space character.

Next, I experimented with sed until I had a working regex to insert a
paragraph containing the SVN "Id" keyword at the end of the body of a
page.  I then used find + grep + xargs + sed to perform an in-place
edit of all of my site's source files.  Then I did the same to run
"svn propset" on all source files in order to enable SVN's keyword
substitution.

Next, I committed my changes and had Forrest rebuild my static Web
site.  The end result is (almost) what I wanted! :)  I would still be
interested if someone finds a way to put the "Id" keyword in the skin
(more specifically, in the footer), though.

Brolin

Mime
View raw message