[yelp-xsl] Added "center" and "button" style hints to links



commit a5e052acd6d46228538b1145a86e60367843b651
Author: Shaun McCance <shaunm gnome org>
Date:   Wed Jun 19 14:24:47 2013 -0400

    Added "center" and "button" style hints to links

 xslt/common/html.xsl                 |    1 +
 xslt/mallard/html/mal2html-links.xsl |   74 ++++++++++++++++++++++++++++++++++
 xslt/mallard/html/mal2html-page.xsl  |   19 +++++++-
 3 files changed, 91 insertions(+), 3 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index f990eea..90917c7 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -896,6 +896,7 @@ div.contents + div.desc { margin: 0.2em 0 0 0; }
 pre.contents {
   padding: 0.5em 1em 0.5em 1em;
 }
+div.links-center { text-align: center; }
 div.links .desc { color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>; }
 div.links > div.inner > div.region > div.desc { font-style: italic; }
 div.links ul { margin: 0; padding: 0; }
diff --git a/xslt/mallard/html/mal2html-links.xsl b/xslt/mallard/html/mal2html-links.xsl
index f691657..bb8565e 100644
--- a/xslt/mallard/html/mal2html-links.xsl
+++ b/xslt/mallard/html/mal2html-links.xsl
@@ -99,6 +99,9 @@ parameter will be used if provided.
       <xsl:if test="$expander">
         <xsl:text> ui-expander</xsl:text>
       </xsl:if>
+      <xsl:if test="contains($style, ' center ')">
+        <xsl:text> links-center</xsl:text>
+      </xsl:if>
     </xsl:attribute>
     <xsl:call-template name="mal2html.ui.expander.data">
       <xsl:with-param name="node" select="$node"/>
@@ -176,6 +179,14 @@ parameter will be used if provided.
               <xsl:with-param name="nodesc" select="$nodesc"/>
             </xsl:call-template>
           </xsl:when>
+          <xsl:when test="contains($style, ' button ')">
+            <xsl:call-template name="_mal2html.links.button">
+              <xsl:with-param name="node" select="$node"/>
+              <xsl:with-param name="links" select="$links"/>
+              <xsl:with-param name="role" select="$role"/>
+              <xsl:with-param name="nodesc" select="$nodesc"/>
+            </xsl:call-template>
+          </xsl:when>
           <xsl:when test="contains($style, ' heading ')">
             <xsl:call-template name="_mal2html.links.heading">
               <xsl:with-param name="node" select="$node"/>
@@ -987,6 +998,69 @@ when determining which links to output.
 </xsl:template>
 
 
+<!--#* _mal2html.links.button -->
+<xsl:template name="_mal2html.links.button">
+  <xsl:param name="node"/>
+  <xsl:param name="links"/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="nodesc" select="false()"/>
+  <xsl:for-each select="$links">
+    <xsl:sort data-type="number" select="@groupsort"/>
+    <xsl:sort select="mal:title[ type = 'sort']"/>
+    <xsl:variable name="link" select="."/>
+    <xsl:variable name="xref" select="@xref"/>
+    <xsl:for-each select="$mal.cache">
+      <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
+      <div class="link-button {$link/@class}">
+        <xsl:for-each select="$link/@*">
+          <xsl:if test="starts-with(name(.), 'data-')">
+            <xsl:copy-of select="."/>
+          </xsl:if>
+        </xsl:for-each>
+        <a>
+          <xsl:attribute name="href">
+            <xsl:call-template name="mal.link.target">
+              <xsl:with-param name="node" select="$node"/>
+              <xsl:with-param name="xref" select="$target/@id"/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:call-template name="mal.link.tooltip">
+              <xsl:with-param name="node" select="$node"/>
+              <xsl:with-param name="xref" select="$target/@id"/>
+              <xsl:with-param name="role" select="$role"/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <span class="title">
+            <xsl:call-template name="mal.link.content">
+              <xsl:with-param name="node" select="$node"/>
+              <xsl:with-param name="xref" select="$target/@id"/>
+              <xsl:with-param name="role" select="$role"/>
+            </xsl:call-template>
+            <xsl:call-template name="mal2html.editor.badge">
+              <xsl:with-param name="target" select="$target"/>
+            </xsl:call-template>
+          </span>
+          <xsl:if test="not($nodesc) and $target/mal:info/mal:desc">
+            <span class="linkdiv-dash">
+              <xsl:text> &#x2014; </xsl:text>
+            </span>
+            <span class="desc">
+              <xsl:variable name="desc">
+                <xsl:apply-templates mode="mal2html.inline.mode"
+                                     select="$target/mal:info/mal:desc[1]/node()"/>
+              </xsl:variable>
+              <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode"
+                                   select="exsl:node-set($desc)"/>
+            </span>
+          </xsl:if>
+        </a>
+      </div>
+    </xsl:for-each>
+  </xsl:for-each>
+</xsl:template>
+
+
 <!--#* _mal2html.links.heading -->
 <xsl:template name="_mal2html.links.heading">
   <xsl:param name="node" select="$node"/>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index f8d5704..35d8aec 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -899,7 +899,11 @@ are processed in %{mal2html.block.mode}.
     </xsl:call-template>
   </xsl:param>
 <xsl:text>
-span.link-button a {
+div.link-button {
+  font-size: 1.2em;
+  font-weight: bold;
+}
+.link-button a {
   display: inline-block;
   background-color: </xsl:text>
     <xsl:value-of select="$color.blue_border"/><xsl:text>;
@@ -914,14 +918,23 @@ span.link-button a {
   -webkit-border-radius: 2px;
   border-radius: 2px;
 }
-span.link-button a:visited {
+.link-button a:visited {
   color: </xsl:text>
     <xsl:value-of select="$color.background"/><xsl:text>;
 }
-span.link-button a:hover {
+.link-button a:hover {
   text-decoration: none;
   color: </xsl:text>
     <xsl:value-of select="$color.background"/><xsl:text>;
+  box-shadow: 1px 1px 1px </xsl:text>
+    <xsl:value-of select="$color.blue_border"/><xsl:text>;
+}
+div.link-button a .desc {
+  display: block;
+  font-weight: normal;
+  font-size: 0.83em;
+  color: </xsl:text>
+    <xsl:value-of select="$color.gray_background"/><xsl:text>;
 }
 div.floatleft {
   float: left;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]