Možnost vkládat jednoduché tabulky #15
authorFrantišek Kučera <franta-hg@frantovo.cz>
Thu, 05 Jan 2012 14:49:04 +0100
changeset 46c4ad66b1202e
parent 45 f52b3bb8cfcc
child 47 97c25418c0e6
Možnost vkládat jednoduché tabulky #15
vstup/css/styl.css
vstup/služby.xml
šablona/stránka.xsl
     1.1 --- a/vstup/css/styl.css	Thu Jan 05 12:21:53 2012 +0100
     1.2 +++ b/vstup/css/styl.css	Thu Jan 05 14:49:04 2012 +0100
     1.3 @@ -99,3 +99,23 @@
     1.4  	background-color: #d0d0f0;
     1.5  	border-radius: 0px 0px 4px 4px;
     1.6  }
     1.7 +
     1.8 +table {
     1.9 +    border-collapse:collapse;
    1.10 +}
    1.11 +td {
    1.12 +    border: 1px solid black;
    1.13 +    padding-top: 4px;
    1.14 +    padding-bottom: 4px;
    1.15 +    padding-left: 6px;
    1.16 +    padding-right: 6px;
    1.17 +}
    1.18 +thead tr {
    1.19 +    background: grey;
    1.20 +    color:black;
    1.21 +}
    1.22 +tbody tr:hover {
    1.23 +   background-color: silver;
    1.24 +   color:black;
    1.25 +}
    1.26 +
     2.1 --- a/vstup/služby.xml	Thu Jan 05 12:21:53 2012 +0100
     2.2 +++ b/vstup/služby.xml	Thu Jan 05 14:49:04 2012 +0100
     2.3 @@ -12,7 +12,15 @@
     2.4  		
     2.5  		<h2>Pravidelné krmení ptáků</h2>
     2.6  		<p>Fusce eu libero sit amet mauris molestie suscipit. Integer porttitor euismod luctus. Sed elementum quam et quam pharetra tincidunt. Pellentesque vitae augue quis mi blandit dapibus. Vestibulum iaculis magna sit amet nisl tristique at consectetur odio blandit. Proin aliquam lectus ac arcu condimentum tempus. Suspendisse potenti. Suspendisse porttitor euismod accumsan. Sed nibh lacus, laoreet id consequat gravida, eleifend eget lectus. Curabitur accumsan, nisi at elementum aliquam, nisl nulla volutpat lorem, ac elementum metus lacus eget lectus. Praesent odio nulla, porttitor vitae hendrerit vel, ullamcorper in velit. Sed in est ipsum, iaculis accumsan sem. Integer pretium ultrices justo a mattis. Nullam id lacus in lectus bibendum tempor. Nulla non viverra eros. Praesent scelerisque, nisi et placerat convallis, nisi nulla lobortis mauris, eu ultricies est mi ac orci. Suspendisse ullamcorper dapibus interdum. Curabitur ac metus eros, sed venenatis sapien.</p>
     2.7 -		<p>Účtováno měsíčním paušálem.</p>
     2.8 +		
     2.9 +		<m:tabulka>
    2.10 +			Velikost ptáka;Cena za jedno krmení
    2.11 +			malý;250
    2.12 +			střední;500
    2.13 +			velký;1000
    2.14 +		</m:tabulka>
    2.15 +		
    2.16 +		<p>Dodáváme pouze prvotřídní krmivo.</p>
    2.17  		
    2.18  		<m:wiki>
    2.19  Pravidelné krmení savců
    2.20 @@ -20,9 +28,9 @@
    2.21  
    2.22  Tato služba je určena především pro pakoně a slony, vhodná je ale i pro jednorožce. _Vivamus nec dictum dolor_. Aliquam et tellus dolor. Curabitur et est sapien. Sed nec neque massa. Markdown Integer luctus erat vel arcu molestie ac dapibus dolor pretium. Curabitur eget augue non ipsum pulvinar venenatis eget et lectus. Proin fringilla aliquet sapien, non luctus est lobortis vel. Nunc vehicula volutpat varius. Aliquam suscipit accumsan sollicitudin. Morbi ultricies, mauris id elementum pellentesque, nunc dolor viverra nisl, sit amet consequat velit libero at ligula. Nulla luctus rhoncus tortor nec sollicitudin. Vivamus posuere sodales ipsum, hendrerit cursus felis pharetra sit amet. Nunc interdum facilisis massa ac congue.
    2.23  
    2.24 -Aliquam erat volutpat. Quisque vitae libero est. Aliquam erat volutpat. [Integer](http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Integer.html) elementum, nisl nec lacinia facilisis, dolor tellus varius eros, sit amet facilisis sem sapien vitae nulla. Pellentesque habitant morbi tristique senectus et **netus et malesuada** fames ac turpis egestas. Integer rutrum sodales venenatis. Donec mollis aliquet enim, id venenatis urna faucibus sed. Suspendisse pharetra neque et nibh tincidunt suscipit. Morbi ut justo sit amet lectus faucibus tempor quis non libero. Aenean in dolor sem, in lacinia sem.
    2.25 +Aliquam erat volutpat. Quisque vitae libero est. Aliquam erat volutpat. [Integer](http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html) elementum, nisl nec lacinia facilisis, dolor tellus varius eros, sit amet facilisis sem sapien vitae nulla. Pellentesque habitant morbi tristique senectus et **netus et malesuada** fames ac turpis egestas. Integer rutrum sodales venenatis. Donec mollis aliquet enim, id venenatis urna faucibus sed. Suspendisse pharetra neque et nibh tincidunt suscipit. Morbi ut justo sit amet lectus faucibus tempor quis non libero. Aenean in dolor sem, in lacinia sem.
    2.26  
    2.27 -Účtováno měsíčním paušálem.
    2.28 +Dodáváme pouze prvotřídní krmivo.
    2.29  		</m:wiki>
    2.30  		
    2.31  		
     3.1 --- a/šablona/stránka.xsl	Thu Jan 05 12:21:53 2012 +0100
     3.2 +++ b/šablona/stránka.xsl	Thu Jan 05 14:49:04 2012 +0100
     3.3 @@ -214,8 +214,36 @@
     3.4      	<xsl:variable name="prostýText" select="document(concat('http://lipsum.lipsum.com/feed/xml?amount=', @odstavců, '&amp;what=paragraphs'))/feed/lipsum"/>
     3.5      	<xsl:for-each select="fn:tokenize($prostýText, '\n')">
     3.6      		<p><xsl:value-of select="."/></p>
     3.7 -    	</xsl:for-each>    	
     3.8 +    	</xsl:for-each>
     3.9      </xsl:template>
    3.10      
    3.11 +    <!--
    3.12 +    	Makro pro jednoduché tabulky
    3.13 +    -->
    3.14 +    <xsl:template match="m:tabulka">
    3.15 +    	<table>
    3.16 +    		<xsl:variable name="data" select="replace(replace(text(), '^\s+', ''),'\s+$','')"/>
    3.17 +    		<xsl:variable name="hlavička" select="substring-before($data, '&#10;')"/>
    3.18 +    		<xsl:variable name="tělo" select="substring-after($data, '&#10;')"/>
    3.19 +    		<thead>
    3.20 +    			<tr>
    3.21 +    				<xsl:for-each select="tokenize($hlavička, ';')">
    3.22 +						<td><xsl:value-of select="normalize-space(.)"/></td>
    3.23 +					</xsl:for-each>
    3.24 +    			</tr>
    3.25 +    		</thead>
    3.26 +    		<tbody>
    3.27 +				<xsl:for-each select="tokenize($tělo, '\n')">
    3.28 +					<xsl:if test="normalize-space(.)">
    3.29 +						<tr>
    3.30 +							<xsl:for-each select="tokenize(., ';')">
    3.31 +								<td><xsl:value-of select="normalize-space(.)"/></td>
    3.32 +							</xsl:for-each>
    3.33 +						</tr>
    3.34 +					</xsl:if>
    3.35 +				</xsl:for-each>
    3.36 +    		</tbody>
    3.37 +    	</table>    
    3.38 +    </xsl:template>
    3.39  
    3.40  </xsl:stylesheet>