Mailing List Archive

svn commit: r1538085 - in /forrest/trunk/site-author: ./ content/xdocs/ content/xdocs/docs_0_100/ resources/css/ resources/scripts/ resources/stylesheets/ skins/ skins/pelt/ skins/pelt/css/ skins/pelt/scripts/
Author: crossley
Date: Fri Nov 1 23:19:03 2013
New Revision: 1538085

URL: http://svn.apache.org/r1538085
Log:
Commence a new document (project-js-css.xml) to explain and explore techniques for additional javascript and css provided by the project.

Added:
forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml (with props)
forrest/trunk/site-author/resources/css/
forrest/trunk/site-author/resources/css/demo-js-css-1.css (with props)
forrest/trunk/site-author/resources/scripts/
forrest/trunk/site-author/resources/scripts/demo-js-css-1.js (with props)
forrest/trunk/site-author/resources/scripts/demo-js-css-2.js (with props)
forrest/trunk/site-author/resources/stylesheets/
forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl (with props)
forrest/trunk/site-author/skins/
forrest/trunk/site-author/skins/pelt/
forrest/trunk/site-author/skins/pelt/css/
forrest/trunk/site-author/skins/pelt/css/demo-js-css-2.css (with props)
forrest/trunk/site-author/skins/pelt/scripts/
forrest/trunk/site-author/skins/pelt/scripts/demo-js-css-3.js (with props)
Modified:
forrest/trunk/site-author/content/xdocs/docs_0_100/faq.xml
forrest/trunk/site-author/content/xdocs/site.xml
forrest/trunk/site-author/sitemap.xmap
forrest/trunk/site-author/skinconf.xml
forrest/trunk/site-author/status.xml

Modified: forrest/trunk/site-author/content/xdocs/docs_0_100/faq.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/content/xdocs/docs_0_100/faq.xml?rev=1538085&r1=1538084&r2=1538085&view=diff
==============================================================================
--- forrest/trunk/site-author/content/xdocs/docs_0_100/faq.xml (original)
+++ forrest/trunk/site-author/content/xdocs/docs_0_100/faq.xml Fri Nov 1 23:19:03 2013
@@ -799,7 +799,7 @@ error: datatype library "http://www.w3.o
</answer>
</faq>
<faq id="javascript">
- <question>How to include additional Javascript and CSS files?</question>
+ <question>How to include additional JavaScript and CSS files?</question>
<answer>
<p>
Place various resources (e.g. javascript, css) into the "project
@@ -809,12 +809,16 @@ error: datatype library "http://www.w3.o
</p>
<p>
Then refer to those from your source documents with URIs like
- /skin/blah.js and /skin/foo.css
+ <code>skin/blah.js</code> and <code>skin/foo.css</code>
</p>
<p>
See how this is handled in the core sitemap called
- forrest/main/webapp/resources.xmap Search for "javascript" then follow
- to the &lt;map:resource name="skin-read"&gt; section.
+ <code>resources.xmap</code>
+ </p>
+ <p>
+ There is more complete explanation and additional techniques
+ in the document
+ <a href="site:project-js-css">Using extra project JavaScript and CSS resources</a>.
</p>
</answer>
</faq>

Added: forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml (added)
+++ forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml Fri Nov 1 23:19:03 2013
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<?demo js-css?>
+<document>
+ <header>
+ <title>Using extra project JavaScript and CSS resources</title>
+ <link rel="stylesheet" type="text/css" href="../css/demo-js-css-1.css"/>
+ <link rel="stylesheet" type="text/css" href="../skin/demo-js-css-2.css"/>
+ <script src="../scripts/demo-js-css-1.js" type="text/javascript"/>
+<!-- scripts/demo-js-css-2.js is injected later by a transformer. -->
+ <script src="../skin/demo-js-css-3.js" type="text/javascript"/>
+ </header>
+ <body>
+ <section id="intro">
+ <title>Introduction</title>
+ <p>
+ There are various ways for your project to provide additional
+ JavaScript and Cascading Style Sheets.
+ The chosen <a href="site:skins">skin</a> already provides many.
+ Your project can supplement that, and provide additional capabilities
+ for your whole site or for specific pages.
+ </p>
+ <p>
+ Note that the new Dispatcher capability provides its own more powerful techniques.
+ See <a href="site:status-themes">Status of Themes: Skins and Dispatcher</a>.
+ Still, some of the techniques described below are relevant.
+ </p>
+ </section>
+ <section id="demo">
+ <title>Demonstration</title>
+ <p id="demo-js-css-1" class="demo-js-css">
+ Demonstration #1:<br/>
+ </p>
+ <p id="demo-js-css-2" class="demo-js-css">
+ Demonstration #2:<br/>
+ </p>
+ <p id="demo-js-css-3" class="demo-js-css">
+ Demonstration #3:<br/>
+ </p>
+ </section>
+ <section id="how">
+ <title>How</title>
+ <section id="overview">
+ <title>Overview</title>
+ <p>
+ The "link" and "script" elements can be added to the head section of
+ your source xml or source html documents.
+ The project sitemap can add a Transformer to inject additional
+ elements to the internal xml.
+ The "Content Aware Pipelines" can detect certain documents to apply such.
+ The sitemaps and locationmaps resolve the linked resources by searching
+ through a set of known locations in your project.
+ </p>
+ </section>
+ <fixme author="open">
+ Add explanations of each.
+ </fixme>
+ <p>
+ ####
+ </p>
+ </section>
+ </body>
+</document>

Propchange: forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml
------------------------------------------------------------------------------
svn:eol-style = native

Propchange: forrest/trunk/site-author/content/xdocs/docs_0_100/project-js-css.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml

Modified: forrest/trunk/site-author/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/content/xdocs/site.xml?rev=1538085&r1=1538084&r2=1538085&view=diff
==============================================================================
--- forrest/trunk/site-author/content/xdocs/site.xml (original)
+++ forrest/trunk/site-author/content/xdocs/site.xml Fri Nov 1 23:19:03 2013
@@ -268,6 +268,7 @@
<!-- FIXME: Needed to avoid moving files -->
<catalog href="catalog.html"/>
<project-sitemap href="project-sitemap.html"/>
+ <project-js-css href="project-js-css.html"/>
<!-- FIXME: i don't understand what the previous FIXME means. Why do we need those entries without labels? -->
<!-- Insert all instructional documentation here -->
<your-project label="Using Forrest" href="your-project.html">
@@ -291,6 +292,8 @@
<sitemap-explain label="Sitemaps explained" href="../sitemap-explain.html"/>
<custom-html-source label="Custom html source" href="howto-custom-html-source.html"/>
<project-sitemapRef label="Project sitemap" href="site:project-sitemap"/>
+ <project-js-css-ref label="Project JS and CSS" href="site:project-js-css"
+ description="Use extra JavaScript and CSS in your project"/>
<editcss label="Edit CSS (WYSIWYG)" href="howto-editcss.html"/>
<pdf-tab label="Create tab PDF" href="howto-pdf-tab.html"
description="Generate one pdf-document for all pages of a tab"/>

Added: forrest/trunk/site-author/resources/css/demo-js-css-1.css
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/resources/css/demo-js-css-1.css?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/resources/css/demo-js-css-1.css (added)
+++ forrest/trunk/site-author/resources/css/demo-js-css-1.css Fri Nov 1 23:19:03 2013
@@ -0,0 +1,10 @@
+.demo-js-css {
+ padding: 0.3em;
+ background-color: lightgrey;
+ border-style: double;
+ border-width: 0.5em;
+}
+#demo-js-css-1 { border-color: red; }
+#demo-js-css-2 { border-color: blue; }
+#demo-js-css-3 { border-color: green; }
+#demo-js-css-1:after { content: "; from first CSS resources"; }

Propchange: forrest/trunk/site-author/resources/css/demo-js-css-1.css
------------------------------------------------------------------------------
svn:eol-style = native

Added: forrest/trunk/site-author/resources/scripts/demo-js-css-1.js
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/resources/scripts/demo-js-css-1.js?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/resources/scripts/demo-js-css-1.js (added)
+++ forrest/trunk/site-author/resources/scripts/demo-js-css-1.js Fri Nov 1 23:19:03 2013
@@ -0,0 +1,10 @@
+window.onload = function() {
+ appendText1();
+ appendText2();
+ appendText3();
+}
+function appendText1() {
+ var extraTextNode = document.createTextNode("from first JS resources");
+ var theElement = document.getElementById("demo-js-css-1");
+ theElement.appendChild(extraTextNode);
+}

Propchange: forrest/trunk/site-author/resources/scripts/demo-js-css-1.js
------------------------------------------------------------------------------
svn:eol-style = native

Added: forrest/trunk/site-author/resources/scripts/demo-js-css-2.js
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/resources/scripts/demo-js-css-2.js?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/resources/scripts/demo-js-css-2.js (added)
+++ forrest/trunk/site-author/resources/scripts/demo-js-css-2.js Fri Nov 1 23:19:03 2013
@@ -0,0 +1,5 @@
+function appendText2() {
+ var extraTextNode = document.createTextNode("; from second JS resources");
+ var theElement = document.getElementById("demo-js-css-1");
+ theElement.appendChild(extraTextNode);
+}

Propchange: forrest/trunk/site-author/resources/scripts/demo-js-css-2.js
------------------------------------------------------------------------------
svn:eol-style = native

Added: forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl (added)
+++ forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl Fri Nov 1 23:19:03 2013
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:import href="lm://transform.xml.copyover.helper"/>
+ <xsl:template match="header">
+ <header>
+ <xsl:apply-templates/>
+ <script src="../scripts/demo-js-css-2.js" type="text/javascript"/>
+ </header>
+ </xsl:template>
+</xsl:stylesheet>

Propchange: forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl
------------------------------------------------------------------------------
svn:eol-style = native

Propchange: forrest/trunk/site-author/resources/stylesheets/demo-js-css.xsl
------------------------------------------------------------------------------
svn:mime-type = text/plain

Modified: forrest/trunk/site-author/sitemap.xmap
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/sitemap.xmap?rev=1538085&r1=1538084&r2=1538085&view=diff
==============================================================================
--- forrest/trunk/site-author/sitemap.xmap (original)
+++ forrest/trunk/site-author/sitemap.xmap Fri Nov 1 23:19:03 2013
@@ -16,6 +16,36 @@
limitations under the License.
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <map:components>
+ <map:actions>
+ <map:action logger="sitemap.action.sourcetype" name="sourcetype" src="org.apache.forrest.sourcetype.SourceTypeAction">
+<!--
+ These actions are additional sourcetype demonstrations.
+ See the main definitions at main/webapp/forrest.xmap
+-->
+ <sourcetype name="demo-js-css">
+ <processing-instruction target="demo" data="js-css"/>
+ </sourcetype>
+ </map:action>
+ </map:actions>
+ <map:selectors default="parameter">
+ <map:selector logger="sitemap.selector.parameter" name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
+ </map:selectors>
+ </map:components>
+ <map:resources>
+ <map:resource name="transform-to-document">
+ <map:act type="sourcetype" src="{src}">
+ <map:select type="parameter">
+ <map:parameter name="parameter-selector-test" value="{sourcetype}" />
+ <map:when test="demo-js-css">
+ <map:generate src="{properties:content.xdocs}{../../1}.xml" />
+ <map:transform src="{properties:resources.stylesheets}/demo-js-css.xsl" />
+ <map:serialize type="xml-document"/>
+ </map:when>
+ </map:select>
+ </map:act>
+ </map:resource>
+ </map:resources>
<map:pipelines>
<map:pipeline>
<map:match pattern="forrest-issues.xml">
@@ -34,6 +64,11 @@
</map:when>
</map:select>
</map:match>
+ <map:match pattern="**.xml">
+ <map:call resource="transform-to-document">
+ <map:parameter name="src" value="{properties:content.xdocs}{1}.xml" />
+ </map:call>
+ </map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>

Modified: forrest/trunk/site-author/skinconf.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/skinconf.xml?rev=1538085&r1=1538084&r2=1538085&view=diff
==============================================================================
--- forrest/trunk/site-author/skinconf.xml (original)
+++ forrest/trunk/site-author/skinconf.xml Fri Nov 1 23:19:03 2013
@@ -155,6 +155,7 @@ See main/fresh-site/src/documentation/sk
#footer a { color: #0F3660; }
#footer a:visited { color: #009999; }
.copyright { font-size: 0.8em }
+#demo-js-css-2:after { content: "from extra-css via skinconf.xml configuration"; }
</extra-css>
<colors>
<!-- These values are used for the generated CSS files. -->

Added: forrest/trunk/site-author/skins/pelt/css/demo-js-css-2.css
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/skins/pelt/css/demo-js-css-2.css?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/skins/pelt/css/demo-js-css-2.css (added)
+++ forrest/trunk/site-author/skins/pelt/css/demo-js-css-2.css Fri Nov 1 23:19:03 2013
@@ -0,0 +1 @@
+#demo-js-css-3:after { content: "; from second CSS resources"; }

Propchange: forrest/trunk/site-author/skins/pelt/css/demo-js-css-2.css
------------------------------------------------------------------------------
svn:eol-style = native

Added: forrest/trunk/site-author/skins/pelt/scripts/demo-js-css-3.js
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/skins/pelt/scripts/demo-js-css-3.js?rev=1538085&view=auto
==============================================================================
--- forrest/trunk/site-author/skins/pelt/scripts/demo-js-css-3.js (added)
+++ forrest/trunk/site-author/skins/pelt/scripts/demo-js-css-3.js Fri Nov 1 23:19:03 2013
@@ -0,0 +1,5 @@
+function appendText3() {
+ var extraTextNode = document.createTextNode("from third JS resources");
+ var theElement = document.getElementById("demo-js-css-3");
+ theElement.appendChild(extraTextNode);
+}

Propchange: forrest/trunk/site-author/skins/pelt/scripts/demo-js-css-3.js
------------------------------------------------------------------------------
svn:eol-style = native

Modified: forrest/trunk/site-author/status.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/status.xml?rev=1538085&r1=1538084&r2=1538085&view=diff
==============================================================================
--- forrest/trunk/site-author/status.xml (original)
+++ forrest/trunk/site-author/status.xml Fri Nov 1 23:19:03 2013
@@ -154,6 +154,11 @@
<link href="site:upgrading_010">upgrading to v0.10-dev</link>
</action>
<!-- 2013-11 -->
+ <action context="docs" type="add" dev="DC">
+ Add a demonstration of various techniques for
+ <link href="site:project-js-css">Using extra project JavaScript and CSS resources</link>.
+ This also explains how to inject and locate the various resources.
+ </action>
<action context="code" type="update" dev="DC">
For "skins", removed the "body onload=init()" from the internal xml.
This was used by the fontsize.js script, which actually had