[gnome-doc-utils/mallard] [mal2html] Using old theme system, work on notes



commit 4ec5cfebd8094092be3daa7db7dc87e9e911ee3e
Author: Shaun McCance <shaunm gnome org>
Date:   Mon May 18 11:17:46 2009 -0500

    [mal2html] Using old theme system, work on notes
    
    When I started the mallard stylesheets, I did a different theme.xsl.
    I'm not wholly convinced of its benefits anymore, and I don't feel
    like dealing with the pain of completing it and moving the DocBook
    stylesheets over right now.
---
 xslt/mallard/html/mal2html-block.xsl  |  137 ++++++++++++++++++++------------
 xslt/mallard/html/mal2html-css.xsl    |  140 +++++++--------------------------
 xslt/mallard/html/mal2html-inline.xsl |   31 ++------
 xslt/mallard/html/mal2html.xsl        |    2 +-
 xslt/mallard/html/mal2xhtml.xsl       |    2 +-
 5 files changed, 120 insertions(+), 192 deletions(-)

diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index 3116d81..dbe9968 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -40,10 +40,7 @@ div.title {
   margin: 0 0 0.2em 0;
   font-weight: bold;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
 }
 div.desc { margin: 0 0 0.2em 0; }
 div.desc-listing, div.desc-synopsis { font-style: italic; }
@@ -52,74 +49,70 @@ pre.code {
   <!-- FIXME: theme -->
   background: url(mallard-icon-code.png) no-repeat top right;
   border: solid 2px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   padding: 0.5em 1em 0.5em 1em;
 }
 div.example {
   border-left: solid 4px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   padding-left: 1em;
 }
 div.figure {
   margin-left: 1.72em;
   padding: 4px;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
 }
 div.figure-contents {
   margin: 0;
   padding: 0.5em 1em 0.5em 1em;
   text-align: center;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text"/><xsl:text>;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.background"/><xsl:text>;
 }
-div.listing-contents {
+div.listing-contents { margin: 0; padding: 0; }
+div.note {
+  padding: 0.5em 6px 0.5em 6px;
+  border-top: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+  border-bottom: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
+}
+div.note-inner {
   margin: 0;
+  min-height: </xsl:text><xsl:value-of select="$theme.icon.admon.size"/><xsl:text>px;
+  padding-left: </xsl:text>
+    <xsl:value-of select="$theme.icon.admon.size + 12"/><xsl:text>px;
+  background-position: left top;
+  background-repeat: no-repeat;
+  background-image: url("</xsl:text>
+    <xsl:value-of select="$theme.icon.admon.note"/><xsl:text>");
 }
+div.note-advanced div.note-inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icon.admon.tip"/><xsl:text>"); }
+div.note-bug div.note-inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icon.admon.bug"/><xsl:text>"); }
+div.note-tip div.note-inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icon.admon.tip"/><xsl:text>"); }
+div.note-warning div.note-inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icon.admon.warning"/><xsl:text>"); }
+div.note-contents { margin: 0; padding: 0; }
 pre.screen {
   padding: 0.5em 1em 0.5em 1em;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
   border: solid 2px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
 }
 div.synopsis-contents {
   margin: 0;
@@ -127,15 +120,9 @@ div.synopsis-contents {
   border-top: solid 2px;
   border-bottom: solid 2px;
   border-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'blue-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
 }
 div.synopsis pre.code {
   background: none;
@@ -314,6 +301,50 @@ FIXME
   </div>
 </xsl:template>
 
+<!-- = note = -->
+<xsl:template mode="mal2html.block.mode" match="mal:note">
+  <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+  <xsl:variable name="notestyle">
+    <xsl:choose>
+      <xsl:when test="contains(concat(' ', @style, ' '), ' advanced ')">
+        <xsl:text>advanced</xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(concat(' ', @style, ' '), ' bug ')">
+        <xsl:text>bug</xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(concat(' ', @style, ' '), ' tip ')">
+        <xsl:text>tip</xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(concat(' ', @style, ' '), ' warning ')">
+        <xsl:text>warning</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+  <div>
+    <xsl:attribute name="class">
+      <xsl:text>note</xsl:text>
+      <xsl:if test="normalize-space($notestyle) != ''">
+        <xsl:value-of select="concat(' note-', $notestyle)"/>
+      </xsl:if>
+      <xsl:if test="$first_child">
+        <xsl:text> first-child</xsl:text>
+      </xsl:if>
+    </xsl:attribute>
+    <div class="note-inner">
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+      <div class="note-contents">
+        <xsl:for-each select="mal:*[not(self::mal:title)
+                              and ($mal2html.editor_mode or not(self::mal:comment)
+                              or processing-instruction('mal2html.show_comment'))]">
+          <xsl:apply-templates mode="mal2html.block.mode" select=".">
+            <xsl:with-param name="first_child" select="position() = 1"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </div>
+    </div>
+  </div>
+</xsl:template>
+
 <!-- = info = -->
 <xsl:template mode="mal2html.block.mode" match="mal:info"/>
 
diff --git a/xslt/mallard/html/mal2html-css.xsl b/xslt/mallard/html/mal2html-css.xsl
index 39d570a..e62ae72 100644
--- a/xslt/mallard/html/mal2html-css.xsl
+++ b/xslt/mallard/html/mal2html-css.xsl
@@ -91,10 +91,7 @@ body {
   direction: </xsl:text><xsl:call-template name="l10n.direction"/><xsl:text>;
   margin: 0px;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
   padding: 12px;
   min-height: 100%;
 }
@@ -104,17 +101,11 @@ div, pre, p, li { margin: 1em 0 0 0; padding: 0; }
 a {
   text-decoration: none;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'link'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.link"/><xsl:text>;
 }
 a:visited {
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'link-visited'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.link_visited"/><xsl:text>;
 }
 a:hover { text-decoration: underline; }
 
@@ -125,24 +116,15 @@ div.body {
   min-height: 20em;
   -moz-border-radius: 6px;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.background"/><xsl:text>;
 }
 div.copyrights {
   max-width: 48em;
   text-align: center;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
 }
 div.section { margin-top: 2.4em; clear: both; }
 div.section div.section { margin-top: 1.72em; margin-left: 1.72em; }
@@ -150,15 +132,9 @@ div.section div.section div.section { margin-top: 1.44em; }
 div.header {
   margin: 0;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
   border-bottom: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
 }
 h1 {
   font-size: 1.44em;
@@ -174,10 +150,7 @@ div.autolinks ul { margin: 0; padding: 0; }
 div.autolinks div.title { margin: 1em 0 0 1em; }
 div.autolinks div.title span {
   border-bottom: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
 }
 li.autolink { margin: 0.5em 0 0 0; padding: 0 0 0 1em; list-style-type: none; }
 
@@ -193,32 +166,20 @@ div.pagelink {
   padding: 0.5em;
   -moz-border-radius: 6px;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.background"/><xsl:text>;
 }
 div.pagelink:hover {
   border-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'blue-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'blue-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.blue_background"/><xsl:text>;
 }
 div.pagelinksep {
   margin: 0.5em;
   list-style-type: none;
   max-width: 24em;
   border-bottom: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
 }
 </xsl:text>
 <xsl:call-template name="mal2html.css.editor"/>
@@ -246,40 +207,22 @@ FIXME
 <xsl:template name="mal2html.css.editor">
 <xsl:text>
 body.status-stub { background-color:  </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
 body.status-draft { background-color:  </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
 body.status-incomplete { background-color:  </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
 body.status-review { background-color:  </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'yellow-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>; }
 div.version {
   margin: 0 0 1em 0;
   padding: 0.5em 1em 0.5em 1em;
   max-width: 48em;
   -moz-border-radius: 6px;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'yellow-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
 }
 div.version p.version { margin-top: 0.2em; }
 div.pagelink div.title span.status {
@@ -288,56 +231,29 @@ div.pagelink div.title span.status {
   padding-left: 0.2em;
   padding-right: 0.2em;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.red_border"/><xsl:text>;
 }
 div.pagelink div.title span.status-stub { background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
 div.pagelink div.title span.status-draft { background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
 div.pagelink div.title span.status-incomplete { background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
 div.pagelink div.title span.status-review { background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'yellow-background'"/>
-  </xsl:call-template>
-  <xsl:text>; }
+  <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>; }
 div.pagelink div.desc {
   margin-top: 0.2em;
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
 }
 div.comment {
   padding: 0.5em;
   border: solid 2px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.red_border"/><xsl:text>;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'red-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.red_background"/><xsl:text>;
 }
 div.comment div.comment {
   margin: 1em 0 0 1em;
diff --git a/xslt/mallard/html/mal2html-inline.xsl b/xslt/mallard/html/mal2html-inline.xsl
index cadfa6b..036b1f4 100644
--- a/xslt/mallard/html/mal2html-inline.xsl
+++ b/xslt/mallard/html/mal2html-inline.xsl
@@ -100,10 +100,7 @@ span.app { font-style: italic; }
 span.cmd {
   font-family: monospace;
   background-color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-background'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
   padding: 0 0.2em 0 0.2em;
 }
 span.code { font-family: monospace; }
@@ -111,39 +108,23 @@ span.em { font-style: italic; }
 span.email { color: red; }
 span.file { font-family: monospace; }
 span.gui, span.guiseq { color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
-}
+  <xsl:value-of select="$theme.color.text_light"/><xsl:text>; }
 span.input { font-family: monospace; }
 span.key {
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
   border: solid 1px </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'gray-border'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
   padding: 0 0.2em 0 0.2em;
 }
 span.keyseq {
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
 }
 span.output { font-family: monospace; }
 pre.screen span.output {
   color: </xsl:text>
-  <xsl:call-template name="theme.get_color">
-    <xsl:with-param name="id" select="'text-light'"/>
-  </xsl:call-template>
-  <xsl:text>;
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
 }
 pre.screen span.output-error {
 <!-- FIXME: theme -->
diff --git a/xslt/mallard/html/mal2html.xsl b/xslt/mallard/html/mal2html.xsl
index 21e46d0..441c57b 100644
--- a/xslt/mallard/html/mal2html.xsl
+++ b/xslt/mallard/html/mal2html.xsl
@@ -49,7 +49,7 @@ REMARK: Describe this module
 <xsl:include href="mal2html-page.xsl"/>
 <xsl:include href="mal2html-table.xsl"/>
 
-<xsl:include href="theme.xsl"/>
+<xsl:include href="../../common/theme.xsl"/>
 <xsl:include href="util.xsl"/>
 
 <!-- FIXME -->
diff --git a/xslt/mallard/html/mal2xhtml.xsl b/xslt/mallard/html/mal2xhtml.xsl
index 5a94063..df7a07d 100644
--- a/xslt/mallard/html/mal2xhtml.xsl
+++ b/xslt/mallard/html/mal2xhtml.xsl
@@ -43,7 +43,7 @@ REMARK: Describe this module
 <xsl:include href="mal2html-page.xsl"/>
 <xsl:include href="mal2html-table.xsl"/>
 
-<xsl:include href="theme.xsl"/>
+<xsl:include href="../../common/theme.xsl"/>
 <xsl:include href="util.xsl"/>
 
 <!-- FIXME -->



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