Tables show up in visual editor, and cells are editable
[redakcja.git] / redakcja / static / xsl / wl2html_client.xsl
index 4f64291..a476c70 100644 (file)
         </span>
     </xsl:template>
 
         </span>
     </xsl:template>
 
+    <xsl:template match="lista">
+      <xsl:variable name="listtag">
+       <xsl:choose>
+         <xsl:when test="@typ='num' or @typ='alfa'">ol</xsl:when>
+         <xsl:when test="@typ='punkt' or @typ='slowniczek' or @typ='czytelnia'">ul</xsl:when>
+         <xsl:otherwise>ul</xsl:otherwise>
+       </xsl:choose>
+      </xsl:variable>
+      <xsl:element name="{$listtag}">
+        <xsl:call-template name="standard-attributes" />
+        <xsl:apply-templates select="child::node()">
+          <xsl:with-param name="mixed" select="true()" />
+        </xsl:apply-templates> 
+      </xsl:element>
+    </xsl:template>
+
+
+    <xsl:template match="punkt[../@typ='slowniczek']">
+      <dl x-node="punkt" class="punkt">
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>     
+      </dl>
+    </xsl:template>
+
+    <xsl:template match="punkt[../@typ!='slowniczek']">
+      <li x-editable="true" x-node="punkt" class="punkt">
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>     
+      </li>
+    </xsl:template>
+
+
+    <xsl:template match="definiendum">
+      <dt x-editable="true" x-node="definiendum" class="definiendum">
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
+      </dt>
+    </xsl:template>
+
+    <xsl:template match="definiens">
+      <dd x-editable="true" x-node="definiendum" class="definiendum">
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
+      </dd>
+    </xsl:template>
+
+
+    <xsl:template match="tabela">
+      <table x-node="tabela" class="tabela">
+        <xsl:call-template name="standard-attributes" />
+       <tbody x-pass-thru="true">
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
+       </tbody>
+      </table>
+    </xsl:template>
+
+    <xsl:template match="wiersz">
+      <tr x-node="wiersz" class="wiersz">
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
+      </tr>
+    </xsl:template>
+
+
+    <xsl:template match="kol">
+      <td x-pass-thru="true">
+           <div x-editable="true" x-node="kol" class="kol">
+             <!-- this wrapper div is necessary for 
+                  relative element to appear correctly
+                  here it's a 'edit' button -->
+            <xsl:call-template name="standard-attributes" />
+              <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+              </xsl:apply-templates>
+           </div>
+      </td>
+    </xsl:template>
+
+
+
 
     <!--
         ****************
 
     <!--
         ****************
 
     <xsl:template match="*">
         <span class="unknown-tag" x-node="{name()}">
 
     <xsl:template match="*">
         <span class="unknown-tag" x-node="{name()}">
+            <xsl:call-template name="standard-attributes" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>        
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>