[gnome-doc-utils/mallard: 70/87] Adding "example" block element, because I think it's useful



commit d43f919bd2237269e84d07de70f8314cc40b23a5
Author: Shaun McCance <shaunm gnome org>
Date:   Thu Dec 11 12:54:52 2008 -0600

    Adding "example" block element, because I think it's useful
---
 doc/mallard/C/mal_block.xml           |    1 +
 doc/mallard/C/mal_block_example.xml   |   34 +++++++++++++++++++++++++++++++++
 doc/mallard/C/mal_inline_cmd.xml      |   26 ++++++++++++++----------
 xslt/mallard/html/mal2html-block.xsl  |   22 +++++++++++++++++++++
 xslt/mallard/html/mal2html-inline.xsl |    2 +-
 5 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/doc/mallard/C/mal_block.xml b/doc/mallard/C/mal_block.xml
index f2834d2..30ecd1a 100644
--- a/doc/mallard/C/mal_block.xml
+++ b/doc/mallard/C/mal_block.xml
@@ -23,6 +23,7 @@
 mal_block = (
   <link xref="mal_block_code">mal_block_code</link> |
   <link xref="mal_block_comment">mal_block_comment</link> |
+  <link xref="mal_block_example">mal_block_comment</link> |
   <link xref="mal_block_figure">mal_block_figure</link> |
   <link xref="mal_block_media">mal_block_media</link> |
   <link xref="mal_block_note">mal_block_note</link> |
diff --git a/doc/mallard/C/mal_block_example.xml b/doc/mallard/C/mal_block_example.xml
new file mode 100644
index 0000000..5842f0a
--- /dev/null
+++ b/doc/mallard/C/mal_block_example.xml
@@ -0,0 +1,34 @@
+<page xmlns="http://www.gnome.org/~shaunm/mallard";
+      type="topic"
+      id="mal_block_example">
+
+<info>
+  <link type="guide" xref="mal_block#containers"/>
+  <version number="0.1" date="2008-12-21" status="stub"/>
+</info>
+
+<title>Examples</title>
+
+<synopsis><code mime="application/relax-ng-compact-syntax">
+mal_block_example = element example {
+  attribute style { xsd:NMTOKENS } ?,
+  attribute * - (mal:* | local:*) { text } *,
+
+  <link xref="mal_block">mal_block</link> +
+}
+</code></synopsis>
+
+<comment>
+  <cite date="2008-12-11"><name>Shaun McCance</name></cite>
+  <p>Add explanation, examples</p>
+</comment>
+
+
+<!-- BEGIN processing -->
+<section id="processing">
+  <title>Processing Expectations</title>
+
+</section>
+<!-- END processing -->
+
+</page>
diff --git a/doc/mallard/C/mal_inline_cmd.xml b/doc/mallard/C/mal_inline_cmd.xml
index a109615..ec7b9c9 100644
--- a/doc/mallard/C/mal_inline_cmd.xml
+++ b/doc/mallard/C/mal_inline_cmd.xml
@@ -65,10 +65,10 @@ by the user.</p>
     <item>
       <p>Typical values for the <code>mime</code> attribute include:</p>
       <table><tr>
-        <td><code>application/x-sh</code></td>
+        <td><p><code>application/x-sh</code></p></td>
         <td>Command to execute with the Bourne shell</td>
       </tr><tr>
-        <td><code>application/x-csh</code></td>
+        <td><p><code>application/x-csh</code></p></td>
         <td>Command to execute with the C shell</td>
       </tr></table>
     </item>
@@ -88,18 +88,21 @@ by the user.</p>
 <section id="examples">
   <title>Examples</title>
 
-  <section id="examples-basic">
-    <title>Basic Use</title>
+  <p>Use <code>cmd</code> to mark up a simple command to run:</p>
+
+  <example>
     <code><![CDATA[
 <p>To start <app>Totem Movie Player</app>, enter <cmd>totem</cmd> at
 the command line.</p>
 ]]></code>
     <p>To start <app>Totem Movie Player</app>, enter <cmd>totem</cmd> at the
     command line.</p>
-  </section>
+  </example>
+
+  <p>Use <code>cmd</code> with <code xref="mal_inline_var">var</code> to mark
+  up a command with a placeholder for an argument the user should supply:</p>
 
-  <section id="examples-using-var">
-    <title>Using <code>var</code></title>
+  <example>
     <code><![CDATA[
 <p>To view a file in <app>Totem Movie Player</app>, enter <cmd>totem
 <var>file</var></cmd> at the command line, replacing <var>file</var>
@@ -107,17 +110,18 @@ with the name of the file.</p>
 ]]></code>
     <p>To view a file in <app>Totem Movie Player</app>, enter <cmd>totem <var>file</var></cmd>
     at the command line, replacing <var>file</var> with the name of the file.</p>
-  </section>
+  </example>
+
+  <p>Use <code>cmd</code> to mark up command names and options:</p>
 
-  <section id="examples-for-options">
-    <title>For Options</title>
+  <example>
     <code><![CDATA[
 <p>The <cmd>-mtime</cmd> option for the <cmd>find</cmd> command allows
 you to filter files based on their modification times.</p>
 ]]></code>
     <p>The <cmd>-mtime</cmd> option for the <cmd>find</cmd> command allows you to
     filter files based on their modification times.</p>
-  </section>
+  </example>
 
 </section>
 <!-- END examples -->
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index a6af0cd..316d635 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -114,6 +114,15 @@ div.figure-contents {
 div.figure div.title { margin: 0 0 4px 0; }
 div.figure div.caption { margin: 4px 0 0 0; }
 
+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>;
+  padding-left: 1em;
+}
+
 div.synopsis {
   border-top: solid 2px;
   border-bottom: solid 2px;
@@ -221,6 +230,19 @@ div.title {
   </div>
 </xsl:template>
 
+<!-- = example = -->
+<xsl:template mode="mal2html.block.mode" match="mal:example">
+  <div>
+    <xsl:attribute name="class">
+      <xsl:text>example</xsl:text>
+      <xsl:if test="not(preceding-sibling::*)">
+        <xsl:text> first-child</xsl:text>
+      </xsl:if>
+    </xsl:attribute>
+    <xsl:apply-templates mode="mal2html.block.mode"/>
+  </div>
+</xsl:template>
+
 <!-- = figure = -->
 <xsl:template mode="mal2html.block.mode" match="mal:figure">
   <div>
diff --git a/xslt/mallard/html/mal2html-inline.xsl b/xslt/mallard/html/mal2html-inline.xsl
index 8999f59..dca2b82 100644
--- a/xslt/mallard/html/mal2html-inline.xsl
+++ b/xslt/mallard/html/mal2html-inline.xsl
@@ -47,7 +47,7 @@ Outputs the contents of an inline element
 FIXME
 -->
 <xsl:template mode="mal2html.inline.content.mode" match="node()">
-  <xsl:apply-templates/>
+  <xsl:apply-templates mode="mal2html.inline.mode"/>
 </xsl:template>
 
 



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