[yelp-xsl/wip/api-1-0] mal2html-api: Adaptive mobile-friendly C synopses



commit 4180b3c9ec4f63d2f84724a65fe66af124fd8935
Author: Shaun McCance <shaunm gnome org>
Date:   Wed Mar 21 08:44:09 2012 -0400

    mal2html-api: Adaptive mobile-friendly C synopses

 test/api/c_func3.page               |   12 ++++
 xslt/mallard/html/mal2html-api.xsl  |  113 ++++++++++++++++++++++++-----------
 xslt/mallard/html/mal2html-page.xsl |    3 +
 3 files changed, 93 insertions(+), 35 deletions(-)
---
diff --git a/test/api/c_func3.page b/test/api/c_func3.page
index 3108a44..3c80d3c 100644
--- a/test/api/c_func3.page
+++ b/test/api/c_func3.page
@@ -9,6 +9,18 @@
       <api:type><link xref="c_type1" role="api:name"/></api:type>
     </api:returns>
     <api:name>function_3</api:name>
+    <api:arg>
+      <api:type>type1</api:type>
+      <api:name>arg1</api:name>
+    </api:arg>
+    <api:arg>
+      <api:type>type2</api:type>
+      <api:name>arg2</api:name>
+    </api:arg>
+    <api:arg>
+      <api:type>type3</api:type>
+      <api:name>arg3</api:name>
+    </api:arg>
   </api:function>
   <link type="guide" xref="index" group="c"/>
 </info>
diff --git a/xslt/mallard/html/mal2html-api.xsl b/xslt/mallard/html/mal2html-api.xsl
index 338d6aa..17413b2 100644
--- a/xslt/mallard/html/mal2html-api.xsl
+++ b/xslt/mallard/html/mal2html-api.xsl
@@ -207,15 +207,20 @@ an #{api:function} element in its #{info}.
     </xsl:variable>
     <xsl:variable name="tab" select="$mal2html.api.tab.c.func - string-length($type)"/>
     <xsl:copy-of select="$type"/>
-    <xsl:choose>
-      <xsl:when test="$tab > 1">
-        <xsl:value-of select="str:padding($tab)"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>&#x000A;</xsl:text>
-        <xsl:value-of select="str:padding($mal2html.api.tab.c.func)"/>
-      </xsl:otherwise>
-    </xsl:choose>
+    <span class="if-if if__not-target-mobile">
+      <xsl:choose>
+        <xsl:when test="$tab > 1">
+          <xsl:value-of select="str:padding($tab)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&#x000A;</xsl:text>
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.func)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
+    <span class="if-if if__target-mobile">
+      <xsl:text>&#x000A;</xsl:text>
+    </span>
     <xsl:variable name="name">
       <xsl:apply-templates mode="mal2html.inline.mode" select="$function/api:name/node()"/>
     </xsl:variable>
@@ -234,22 +239,40 @@ an #{api:function} element in its #{info}.
       </xsl:attribute>
       <xsl:copy-of select="$name"/>
     </a>
-    <xsl:variable name="paren" select="$mal2html.api.tab.c.args -
-                                       $mal2html.api.tab.c.func -
-                                       string-length($name)"/>
-    <xsl:choose>
-      <xsl:when test="$paren > 1">
-        <xsl:value-of select="str:padding($paren)"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>&#x000A;</xsl:text>
-        <xsl:value-of select="str:padding($mal2html.api.tab.c.args)"/>
-      </xsl:otherwise>
-    </xsl:choose>
+    <span class="if-if if__not-target-mobile">
+      <xsl:variable name="paren" select="$mal2html.api.tab.c.args -
+                                         $mal2html.api.tab.c.func -
+                                         string-length($name)"/>
+      <xsl:choose>
+        <xsl:when test="$paren > 1">
+          <xsl:value-of select="str:padding($paren)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&#x000A;</xsl:text>
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.args)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
+    <span class="if-if if__target-mobile">
+      <xsl:variable name="paren" select="$mal2html.api.tab.c.func -
+                                         string-length($name)"/>
+      <xsl:choose>
+        <xsl:when test="$paren > 1">
+          <xsl:value-of select="str:padding($paren)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&#x000A;</xsl:text>
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.func)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
     <xsl:text>(</xsl:text>
     <xsl:for-each select="$function/api:arg">
       <xsl:if test="position() != 1">
-        <xsl:value-of select="str:padding($mal2html.api.tab.c.args + 1)"/>
+        <span class="if-if if__not-target-mobile">
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.args - $mal2html.api.tab.c.func)"/>
+        </span>
+        <xsl:value-of select="str:padding($mal2html.api.tab.c.func + 1)"/>
       </xsl:if>
       <xsl:apply-templates mode="mal2html.inline.mode" select="api:type/node()"/>
       <xsl:if test="api:type and (
@@ -337,27 +360,47 @@ system, this template formats signals for GObject APIs.
       <xsl:apply-templates mode="mal2html.inline.mode" select="node()"/>
     </xsl:for-each>
     <xsl:text>&#x000A;</xsl:text>
-    <xsl:value-of select="str:padding($mal2html.api.tab.c.func)"/>
+    <span class="if-if if__not-target-mobile">
+      <xsl:value-of select="str:padding($mal2html.api.tab.c.func - 1)"/>
+    </span>
+    <xsl:text> </xsl:text>
     <xsl:variable name="type">
       <xsl:apply-templates mode="mal2html.inline.mode" select="$signal/api:returns/api:type/node()"/>
     </xsl:variable>
-    <xsl:variable name="paren" select="$mal2html.api.tab.c.args -
+    <xsl:copy-of select="$type"/>
+    <span class="if-if if__not-target-mobile">
+      <xsl:variable name="paren" select="$mal2html.api.tab.c.args -
                                          $mal2html.api.tab.c.func -
                                          string-length($type)"/>
-    <xsl:copy-of select="$type"/>
-    <xsl:choose>
-      <xsl:when test="$paren > 1">
-        <xsl:value-of select="str:padding($paren)"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>&#x000A;</xsl:text>
-        <xsl:value-of select="str:padding($mal2html.api.tab.c.args)"/>
-      </xsl:otherwise>
-    </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="$paren > 1">
+          <xsl:value-of select="str:padding($paren)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&#x000A;</xsl:text>
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.args)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
+    <span class="if-if if__target-mobile">
+      <xsl:variable name="paren" select="$mal2html.api.tab.c.func - string-length($type) - 1"/>
+      <xsl:choose>
+        <xsl:when test="$paren > 1">
+          <xsl:value-of select="str:padding($paren)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&#x000A;</xsl:text>
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.args)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </span>
     <xsl:text>(</xsl:text>
     <xsl:for-each select="$signal/api:arg">
       <xsl:if test="position() != 1">
-        <xsl:value-of select="str:padding($mal2html.api.tab.c.args + 1)"/>
+        <span class="if-if if__not-target-mobile">
+          <xsl:value-of select="str:padding($mal2html.api.tab.c.args - $mal2html.api.tab.c.func)"/>
+        </span>
+        <xsl:value-of select="str:padding($mal2html.api.tab.c.func + 1)"/>
       </xsl:if>
       <xsl:apply-templates mode="mal2html.inline.mode" select="api:type/node()"/>
       <xsl:if test="api:type and (
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 584d78c..c0fb0a4 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -1174,11 +1174,14 @@ span.gloss-desc {
 .if-choose > .if-when { display: none; }
 .if-choose > .if-else { display: block; }
 .if-if.if__not-target-mobile { display: block; }
+span.if-if.if__not-target-mobile { display: inline; }
 .if-choose.if__not-target-mobile > .if-when { display: block; }
 .if-choose.if__not-target-mobile > .if-else { display: none; }
 @media only screen and (max-width: 400px) {
   .if-if.if__target-mobile { display: block; }
+  span.if-if.if__target-mobile { display: inline; }
   .if-if.if__not-target-mobile { display: none; }
+  span.if-if.if__not-target-mobile { display: none; }
   .if-choose.if__target-mobile > .if-when { display: block; }
   .if-choose.if__target-mobile > .if-else { display: none; }
   .if-choose.if__not-target-mobile > .if-when { display: none; }



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