incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1182991 - /incubator/public/trunk/site-author/stylesheets/site.vsl
Date Thu, 13 Oct 2011 17:12:40 GMT
Author: sebb
Date: Thu Oct 13 17:12:39 2011
New Revision: 1182991

URL: http://svn.apache.org/viewvc?rev=1182991&view=rev
Log:
Make internal site links relative in menus
Use <h[2-5] id="anchor"> instead of <h[2-5]><A name="anchor" to better distinguish
anchors from links

Modified:
    incubator/public/trunk/site-author/stylesheets/site.vsl

Modified: incubator/public/trunk/site-author/stylesheets/site.vsl
URL: http://svn.apache.org/viewvc/incubator/public/trunk/site-author/stylesheets/site.vsl?rev=1182991&r1=1182990&r2=1182991&view=diff
==============================================================================
--- incubator/public/trunk/site-author/stylesheets/site.vsl (original)
+++ incubator/public/trunk/site-author/stylesheets/site.vsl Thu Oct 13 17:12:39 2011
@@ -127,38 +127,17 @@ $note
 #else
 #set ($heading = "")
 #end
+## add id="anchor" as link target rather than <a name="anchor">
+#set ($tmp = "$!section.getAttributeValue('id')")
+#if ($tmp != "")#set ($id=" id='$tmp'")#else#set ($id="")#end
 #if ($level == 1)
-<h2><img src="$relativePath/images/redarrow.gif" />
-#if ($section.getAttributeValue("id"))
-   <a name="$section.getAttributeValue("id")">$heading</a>
-#else
-   $heading
-#end
-</h2>
+<h2$id><img src="$relativePath/images/redarrow.gif" />$heading</h2>
 #elseif ($level == 2)
-<h3>
-#if ($section.getAttributeValue("id"))
-   <a name="$section.getAttributeValue("id")">$heading</a>
-#else
-   $heading
-#end
-</h3>
+<h3$id>$heading</h3>
 #elseif ($level == 3)
-<h4>
-#if ($section.getAttributeValue("id"))
-   <a name="$section.getAttributeValue("id")">$heading</a>
-#else
-   $heading
-#end
-</h4>
+<h4$id>$heading</h4>
 #else
-<h5> 
-#if ($section.getAttributeValue("id")) 
-   <a name="$section.getAttributeValue("id")">$heading</a> 
-#else 
-   $heading 
-#end 
-</h5> 
+<h5$id>$heading</h5> 
 #end
 <div class="section-content">
 ## output the section-level children with transformers
@@ -215,15 +194,21 @@ href="$title.getAttributeValue("href")">
 #set ($menus = $project.selectNodes("body/projects")) 
 #foreach ( $menu in $menus ) 
 #set ($title = $menu.getChild("title")) 
-#if ($title.getAttributeValue("href")) 
+## Convert site-absolute links to site-relative
+#set ( $href = "$!title.getAttributeValue('href')" )
+#if ($href != "") 
+#if ($href.startsWith("/"))
+#set ($href = "$relativePath$href")
+#end
       <div class="menuheader"><a 
-href="$title.getAttributeValue("href")">$menu.getChildText("title")</a></div>

+href="$href">$menu.getChildText("title")</a></div> 
 #else 
       <div class="menuheader">$menu.getChildText("title")</div>
 #end 
     <menu compact="compact">
     #foreach ( $item in $menu.getChildren("li") ) 
-      $item 
+## much simpler than descending the tree here
+      $item.toString().replaceAll("<a href=\"/","<a href=\"${relativePath}/") 
     #end 
     #foreach ( $item in $menu.getChildren("p") ) 
       $item 



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message