Geometric shapes in PDF.
[librarian.git] / src / librarian / xslt / book2html.xslt
index 7576413..f540b49 100644 (file)
                                <xsl:value-of select="$css" />
                        </xsl:attribute>
                </link>
                                <xsl:value-of select="$css" />
                        </xsl:attribute>
                </link>
+               <style>
+                 .ilustr.prawo img {
+                 float: right;
+                 }
+                 .ilustr.lewo img {
+                 float: left;
+                 }
+                 .ilustr.srodek {
+                 text-align: center;
+                 }
+                 .ilustr .stop {
+                 clear: both;
+                 }
+                 .ilustr.oblew .stop {
+                 clear: none;
+                 }
+
+                  .ilustr.oblew img {
+                    margin-bottom: 1em;
+                  }
+                  .ilustr.oblew.lewo img {
+                    margin-right: 2em;
+                    }
+                    .ilustr.oblew.prawo img {
+                    margin-left: 2em;
+                    }
+
+
+                    .ilustr img {
+                    min-width: 200px !important;
+                    }
+                    @media screen and (max-width: 320px) {
+                    .ilustr img {
+                    width: 100% !important;
+                    min-width: auto !important;
+                    }
+                    .ilustr.lewo img {
+                    float: none;
+                    }
+                    .ilustr.prawo img {
+                    float:none;
+                    }
+                    .ilustr.oblew.prawo img {
+                    margin-left: 0;
+                    }
+                    .ilustr.oblew.lewo img{
+                    margin-right: 0;
+                    }
+                    .ilustr .stop {
+                   clear: none;
+                    }
+
+                    }
+               </style>
            </head>
             <body>
               <xsl:call-template name="book-text" />
            </head>
             <body>
               <xsl:call-template name="book-text" />
                                 </p>
                             </xsl:when>
                             <xsl:otherwise>
                                 </p>
                             </xsl:when>
                             <xsl:otherwise>
-                                <xsl:apply-templates select="text()|*" mode="inline" />
+                              <xsl:apply-templates />
+                              <p>
+                                <xsl:if test="name()='pa'"> [przypis autorski]</xsl:if>
+                                <xsl:if test="name()='pt'"> [przypis tĹ‚umacza]</xsl:if>
+                                <xsl:if test="name()='pr'"> [przypis redakcyjny]</xsl:if>
+                                <xsl:if test="name()='pe'"> [przypis edytorski]</xsl:if>
+                              </p>
                             </xsl:otherwise>
                         </xsl:choose>
                     </div>
                             </xsl:otherwise>
                         </xsl:choose>
                     </div>
 </xsl:template>
 
 <xsl:template match="ilustr">
 </xsl:template>
 
 <xsl:template match="ilustr">
+  <div>
+
+    <xsl:attribute name="class">
+      <xsl:text>ilustr </xsl:text>
+      <xsl:value-of select="@wyrownanie"/>
+      <xsl:if test="@oblew">
+        <xsl:text> oblew</xsl:text>
+      </xsl:if>
+    </xsl:attribute>
+    
     <img>
     <img>
-        <xsl:attribute name="src">
-            <xsl:value-of select="$gallery" /><xsl:value-of select="@src" />
-        </xsl:attribute>
-        <xsl:attribute name="alt">
-            <xsl:value-of select="@alt" />
-        </xsl:attribute>
-        <xsl:attribute name="title">
-            <xsl:value-of select="@alt" />
+      <xsl:attribute name="src">
+        <xsl:value-of select="@src" />
+      </xsl:attribute>
+      <xsl:attribute name="srcset">
+        <xsl:value-of select="@srcset" />
+      </xsl:attribute>
+      <xsl:attribute name="sizes">
+        (min-width: 718px) 600px,
+        (min-width: 600px) calc(100vw - 118px),
+        (min-width: 320px) calc(100vw - 75px),
+        (min-width: 15em) calc(100wv - 60px),
+        calc(100wv - 40px)
+      </xsl:attribute>
+      <xsl:attribute name="alt">
+        <xsl:value-of select="@alt" />
+      </xsl:attribute>
+      <xsl:attribute name="title">
+        <xsl:value-of select="@alt" />
+      </xsl:attribute>
+
+      <xsl:if test="@szer">
+        <xsl:attribute name="style">
+          <xsl:text>width: </xsl:text>
+          <xsl:value-of select="@szer"/>
         </xsl:attribute>
         </xsl:attribute>
+      </xsl:if>
     </img>
     </img>
+
+    <div class="stop"></div>
+  </div>
 </xsl:template>
 
 <xsl:template match="animacja">
 </xsl:template>
 
 <xsl:template match="animacja">
 
 <!-- Other inline tags -->
 <xsl:template match="mat" mode="inline">
 
 <!-- Other inline tags -->
 <xsl:template match="mat" mode="inline">
-    <math xmlns="http://www.w3.org/1998/Math/MathML"><xsl:copy-of select="*" /></math>
+    <math xmlns="http://www.w3.org/1998/Math/MathML"><xsl:copy-of select="*|text()" /></math>
 </xsl:template>
 
 <xsl:template match="didask_tekst" mode="inline">
 </xsl:template>
 
 <xsl:template match="didask_tekst" mode="inline">
     <em class="person"><xsl:apply-templates mode="inline" /></em>
 </xsl:template>
 
     <em class="person"><xsl:apply-templates mode="inline" /></em>
 </xsl:template>
 
+<xsl:template match="www" mode="inline">
+    <a target="_blank">
+        <xsl:attribute name="href">
+            <xsl:value-of select="text()"/>
+        </xsl:attribute>
+        <xsl:apply-templates mode="inline" />
+    </a>
+</xsl:template>
 
 <!-- ============================================== -->
 <!-- = STANDALONE TAGS                            = -->
 
 <!-- ============================================== -->
 <!-- = STANDALONE TAGS                            = -->
         <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" />
 </xsl:template>
 
         <a name="{concat('sec', count(ancestor-or-self::*[last()-2]/preceding-sibling::*) + 1)}" />
 </xsl:template>
 
+<xsl:template match="numeracja">
+       <span class="numeracja">
+               <xsl:attribute name="data-start">
+                       <xsl:value-of select="@start" />
+               </xsl:attribute>
+       </span>
+</xsl:template>
+
 </xsl:stylesheet>
 </xsl:stylesheet>