Edit attributes in wysiwyg editor
[redakcja.git] / redakcja / static / xsl / wl2html_client.xsl
index 6dd5080..8be6e22 100644 (file)
         </div>
     </xsl:template>
 
         </div>
     </xsl:template>
 
+    <xsl:template match="nota_red">
+        <xsl:param name="mixed" />
+        <div>
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="false()" />
+            </xsl:apply-templates>
+        </div>
+    </xsl:template>
+
     <!--
         Tagi obejmujące tekst dedykacji (styl wieloakapitowy bądź wielostrofowy):
         <dedykacja> tekst-dedykacji </dedykacja>
     <!--
         Tagi obejmujące tekst dedykacji (styl wieloakapitowy bądź wielostrofowy):
         <dedykacja> tekst-dedykacji </dedykacja>
     -->
     <xsl:template match="motto">
         <xsl:param name="mixed" />
     -->
     <xsl:template match="motto">
         <xsl:param name="mixed" />
-        <div class="motto_container">
+        <div class="motto_container" data-pass-thru="true">
         <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:apply-templates select="child::node()">
         <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:apply-templates select="child::node()">
     -->
     <xsl:template match="sekcja_swiatlo">
         <xsl:param name="mixed" />
     -->
     <xsl:template match="sekcja_swiatlo">
         <xsl:param name="mixed" />
-        <br><xsl:call-template name="standard-attributes" /></br>
+        <hr><xsl:call-template name="standard-attributes" /></hr>
     </xsl:template>
 
     <xsl:template match="sekcja_asterysk">
         <xsl:param name="mixed" />
     </xsl:template>
 
     <xsl:template match="sekcja_asterysk">
         <xsl:param name="mixed" />
-        <hr><xsl:call-template name="standard-attributes" /></hr>
+        <p><xsl:call-template name="standard-attributes" /></p>
     </xsl:template>
 
     <xsl:template match="separator_linia">
     </xsl:template>
 
     <xsl:template match="separator_linia">
 
     <xsl:template match="zastepnik_wersu">
         <xsl:param name="mixed" />
 
     <xsl:template match="zastepnik_wersu">
         <xsl:param name="mixed" />
-        <hr><xsl:call-template name="standard-attributes" /></hr>
+        <span>
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
+        </span>
     </xsl:template>
 
     <!--
     </xsl:template>
 
     <!--
         </span>
     </xsl:template>
 
         </span>
     </xsl:template>
 
+    <!--
+        **************************
+           MATERIAŁY EDUKACYJNE
+        **************************
+    -->
+
+    <!--
+        Listy
+    -->
+    <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>
+
+    <!--
+        Słowniczek
+    -->
+    <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>
+
+    <!--
+        Tabela
+    -->
+
+    <xsl:template match="wiersz">
+      <span>
+        <xsl:call-template name="standard-attributes" />
+        <xsl:apply-templates select="child::node()">
+         <xsl:with-param name="mixed" select="true()" />
+        </xsl:apply-templates>
+      </span>
+    </xsl:template>
+
+
+    <xsl:template match="kol">
+      <span>
+            <xsl:call-template name="standard-attributes" />
+           <div x-editable="true" x-node="kol-inside" x-pass-thru="true">
+              <xsl:apply-templates select="child::node()">
+               <xsl:with-param name="mixed" select="true()" />
+              </xsl:apply-templates>
+           </div>
+      </span>
+    </xsl:template>
+
+
+    <!--
+        Obraz
+    -->
+    <xsl:template match="obraz">
+      <img x-node="obraz" src="http://i.imgur.com/{@name}.jpg" class="obraz">
+            <xsl:call-template name="standard-attributes" />
+      </img>
+    </xsl:template>
+
+    <!--
+        Semantyczne pudełka
+    -->
+    <xsl:template match="pomoce|forma|czas|opis|kol-inside">
+      <span x-editable="true">
+            <xsl:call-template name="standard-attributes" />
+            <xsl:apply-templates select="child::node()">
+              <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
+      </span>
+    </xsl:template>
+
+
 
     <!--
         ****************
 
     <!--
         ****************
         <!-- <xsl:value-of select="." /> -->
         <xsl:param name="mixed" />
         <xsl:choose>
         <!-- <xsl:value-of select="." /> -->
         <xsl:param name="mixed" />
         <xsl:choose>
-            <xsl:when test="normalize-space(.) = ''" />
+            <xsl:when test="normalize-space(.) = ''">
+                <xsl:value-of select="." />
+            </xsl:when>
             <xsl:when test="not($mixed)">
                <span x-node="out-of-flow-text" class="out-of-flow-text" x-editable="true">
                        <xsl:value-of select="." />
             <xsl:when test="not($mixed)">
                <span x-node="out-of-flow-text" class="out-of-flow-text" x-editable="true">
                        <xsl:value-of select="." />
        
        <!-- 
                Earlier versions of html2wl introduced a BUG, that 'causes "out-of-flow-text" tag to appear.
        
        <!-- 
                Earlier versions of html2wl introduced a BUG, that 'causes "out-of-flow-text" tag to appear.
-               Instead of marking it as "unknown", just pass thru it
+               Instead of marking it as "unknown", just pass thru it.
+               Keep a pass-thru span for out-of-flow box editing
        -->
        -->
-       <xsl:template match="out-of-flow-text">
-               <xsl:param name="mixed" />
-               <xsl:apply-templates select="child::node()">
-                <xsl:with-param name="mixed" select="$mixed" />
-            </xsl:apply-templates>
-       </xsl:template> 
+    <xsl:template match="out-of-flow-text">
+        <span data-pass-thru="true">
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="false()" />
+            </xsl:apply-templates>        
+        </span>
+    </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>        
                        </xsl:choose>               
         </xsl:for-each>
     </xsl:template>
                        </xsl:choose>               
         </xsl:for-each>
     </xsl:template>
-    
-</xsl:stylesheet>
\ No newline at end of file
+
+    <xsl:template match="alien">
+            <span class="alien" x-pass-thru="true">
+                <xsl:apply-templates select="node()">
+                    <xsl:with-param name="mixed" select="true()" />
+                </xsl:apply-templates>
+            </span>
+    </xsl:template>
+
+    <xsl:template match="comment()">
+        <xsl:comment><xsl:value-of select="."/></xsl:comment>
+    </xsl:template>
+</xsl:stylesheet>