forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdupoiri...@apache.org
Subject svn commit: r354793 - in /forrest/trunk: main/webapp/resources/chaperon/grammars/ main/webapp/resources/chaperon/stylesheets/ whiteboard/plugins/org.apache.forrest.plugin.output.themer/resources/themes/common/html/
Date Wed, 07 Dec 2005 16:34:42 GMT
Author: cdupoirieux
Date: Wed Dec  7 08:34:33 2005
New Revision: 354793

URL: http://svn.apache.org/viewcvs?rev=354793&view=rev
Log:
Add the ability to "escape" mailto addresses or links in order to avoid they are automatically
rewritten by forrest.
If a link or an address must appear in the text of the site, but the user does not need a
real link he can prefix both by '\' character.
Examples :
- \xxx.yyy@zzz.www will not be rewritten as a mailto link but just like text - without the
\ -
This corrects the http://issues.apache.org/jira/browse/FOR-743



Modified:
    forrest/trunk/main/webapp/resources/chaperon/grammars/link.xlex
    forrest/trunk/main/webapp/resources/chaperon/stylesheets/pattern2link.xsl
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.themer/resources/themes/common/html/siteinfo-feedback.ft

Modified: forrest/trunk/main/webapp/resources/chaperon/grammars/link.xlex
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/resources/chaperon/grammars/link.xlex?rev=354793&r1=354792&r2=354793&view=diff
==============================================================================
--- forrest/trunk/main/webapp/resources/chaperon/grammars/link.xlex (original)
+++ forrest/trunk/main/webapp/resources/chaperon/grammars/link.xlex Wed Dec  7 08:34:33 2005
@@ -19,6 +19,10 @@
  <!-- (([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? -->
  <lexeme symbol="link">
   <concat>
+   <concat minOccurs="0" maxOccurs="1">
+     <cstring content="\"/>
+   </concat>
+   <group>
    <concat>
     <cclass maxOccurs="*">
      <cinterval min="A" max="Z"/>
@@ -64,6 +68,7 @@
      <cset content="._-:/?#"/>
     </cclass>
    </concat>
+   </group>
   </concat>
  </lexeme>
 
@@ -152,6 +157,9 @@
  <lexeme symbol="email">
   <concat>
    <concat>
+    <concat minOccurs="0" maxOccurs="1">
+     <cstring content="\"/>
+    </concat>
     <group>
      <cclass maxOccurs="*">
       <cinterval min="A" max="Z"/>

Modified: forrest/trunk/main/webapp/resources/chaperon/stylesheets/pattern2link.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/resources/chaperon/stylesheets/pattern2link.xsl?rev=354793&r1=354792&r2=354793&view=diff
==============================================================================
--- forrest/trunk/main/webapp/resources/chaperon/stylesheets/pattern2link.xsl (original)
+++ forrest/trunk/main/webapp/resources/chaperon/stylesheets/pattern2link.xsl Wed Dec  7 08:34:33
2005
@@ -21,16 +21,32 @@
     xmlns:lex="http://chaperon.sourceforge.net/schema/lexemes/2.0">
 
  <xsl:template match="lex:lexeme[@symbol='link']">
-  <a href="{@text}">
-   <xsl:value-of select="@text"/>
-  </a>
+   <xsl:choose>
+  <!-- it is possible to disable link writing by prefixing by '\' -->
+    <xsl:when test="not( starts-with( @text, '\') )">
+      <a href="{@text}">
+       <xsl:value-of select="@text"/>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="lex:group[2]"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
  </xsl:template>
 
  <xsl:template match="lex:lexeme[@symbol='email']">
-  <a href="mailto:{@text}">
-   <xsl:value-of select="lex:group[2]"/> at
-   <xsl:value-of select="lex:group[3]"/>
-  </a>
+  <xsl:choose>
+  <!-- it is possible to disable link writing by prefixing by '\' -->
+    <xsl:when test="not( starts-with( @text, '\') )">
+      <a href="mailto:{@text}">
+        <xsl:value-of select="lex:group[2]"/> at <xsl:value-of select="lex:group[3]"/>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="lex:group[2]"/>@<xsl:value-of select="lex:group[3]"/>
+    </xsl:otherwise>
+  </xsl:choose>
  </xsl:template>
 
  <xsl:template match="lex:lexeme[@symbol='cssurl']">

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.themer/resources/themes/common/html/siteinfo-feedback.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.themer/resources/themes/common/html/siteinfo-feedback.ft?rev=354793&r1=354792&r2=354793&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.themer/resources/themes/common/html/siteinfo-feedback.ft
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.themer/resources/themes/common/html/siteinfo-feedback.ft
Wed Dec  7 08:34:33 2005
@@ -19,14 +19,24 @@
 <forrest:contract name="siteinfo-feedback" type="nugget" 
   xmlns:forrest="http://apache.org/forrest/templates/1.0">
   <description>
-    <p>siteinfo-feedback<br/> The feedback element will be used to construct
a 
+    <p>The feedback element will be used to construct a 
       feedback link in the page appending: &lt;a href="@href">{@to}&lt;/a>
</p>
+    <div class="note">
+      <div class="label">Beware the link rewritting !</div>
+      <div class="content">
+        <p>Forrest recognise links or e-mail address in the text of the site and automatically
converts them into real links or mailto.<br/>
+        if the <em>to</em> attribute is of the following form : <code>\xxx.yyy@zzz.www</code>
it is recognised as a mailto link and will be converted too.<br/>
+        </p>
+        <p>To avoid this, you can <em>escape</em> the conversion by prefixing
the email adress by the '\' character : <strong>\</strong><code>\xxx.yyy@zzz.www</code>
will not be converted.<br/>
+        (Note that none of the previous examples are rewritten because we used the '\' character
in the source !).</p>
+      </div>
+    </div>
   </description>
   <usage><![CDATA[<forrest:contract name="siteinfo-feedback">
   <forrest:properties contract="siteinfo-feedback">
     <forrest:property name="siteinfo-feedback">
-      <feedback to="webmaster@foo.com"
-        href="mailto:webmaster@foo.com?subject=Feedback&#160;" >
+      <feedback to="\webmaster@foo.com"
+        href="\mailto:webmaster@foo.com?subject=Feedback&#160;" >
         Send feedback about the website to:
       </feedback>
     </forrest:property>



Mime
View raw message