Changeset 53:7403128a8e0a

Show
Ignore:
Timestamp:
01/07/12 00:14:27 (12 years ago)
Author:
František Kučera <franta-hg@…>
Branch:
default
Message:

Makro pro odkazy #16 – Trac, Seznam, Google, RFC

Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • vstup/zdrojáky.xml

    r52 r53  
    88                 
    99                <p>Zde je malá ukázka našich zdrojových kódů. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mi nisl, tincidunt in viverra vitae, pharetra nec urna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Integer gravida gravida convallis. Phasellus erat ligula, vestibulum vel commodo ac, fringilla quis lorem. Morbi a massa a ligula tincidunt mattis et et felis. Vivamus a quam nulla, at vulputate nisi. Duis gravida placerat luctus. Phasellus vehicula lobortis arcu vitae hendrerit. Maecenas ut molestie elit. Aliquam erat volutpat. Curabitur sed euismod nisl. Mauris molestie tristique nulla, eu pellentesque sem tincidunt non.</p> 
    10                 <p>Morbi et magna a ligula pulvinar posuere. Pellentesque sit amet sem sed orci convallis tincidunt sed sed nisl. Aenean id nibh lorem, eget tempor mauris. Duis diam dui, ullamcorper quis iaculis eget, blandit non dolor. Vestibulum pretium lorem aliquet libero tristique vehicula. Quisque sit amet odio risus, sed tincidunt augue. Proin tincidunt eros eu sem sodales sit amet sollicitudin libero vestibulum. Proin sed nunc elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam mollis, nisl ut sodales sodales, quam lacus elementum magna, nec blandit leo enim id odio. Integer risus leo, sagittis vitae vestibulum vitae, elementum eu eros.     </p> 
     10                <p>Morbi et magna a ligula pulvinar posuere. Pellentesque sit amet sem <m:a href="odkazy" title="Ukázka odkazů">sed orci</m:a> convallis tincidunt sed sed nisl. Aenean id nibh lorem, eget tempor mauris. Duis diam dui, ullamcorper quis iaculis eget, blandit non dolor. Vestibulum pretium lorem aliquet libero tristique vehicula. Quisque sit amet odio risus, sed tincidunt augue. Proin tincidunt eros eu sem sodales sit amet sollicitudin libero vestibulum. Proin sed nunc elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam mollis, nisl ut sodales sodales, quam lacus elementum magna, nec blandit leo enim id odio. Integer risus leo, sagittis vitae vestibulum vitae, elementum eu eros.      </p> 
    1111                 
    1212                <h2>C++</h2> 
  • šablona/makra/odkazy.xsl

    r51 r53  
    55        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    66        exclude-result-prefixes="m"> 
    7     
    8     <!-- 
    9         Makro pro převod interních odkazů: 
    10                 - doplnění správné přípony 
    11                 - URL kódování znaků 
    12     --> 
    13     <xsl:template match="m:a"> 
    14         <a> 
    15                 <xsl:copy-of select="@*"/> 
    16                 <xsl:attribute name="href"> 
    17                         <xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/> 
    18                 </xsl:attribute> 
    19                 <xsl:apply-templates/> 
    20         </a> 
    21     </xsl:template> 
    22      
     7 
     8        <!-- 
     9                Odkazy 
     10                ****** 
     11                Slouží hlavně k vkládání odkazů na jiné stránky v rámci webu. 
     12                * 
     13                @href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami 
     14                @typ jiné typy odkazů (výchozí jsou interní odkazy v rámci webu) 
     15        --> 
     16        <xsl:template match="m:a"> 
     17                <a> 
     18                        <xsl:copy-of select="@*"/> 
     19                        <xsl:attribute name="href"> 
     20                                <xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/> 
     21                        </xsl:attribute> 
     22                        <xsl:apply-templates/> 
     23                </a> 
     24        </xsl:template> 
     25 
     26        <!-- 
     27                Trac – wiki 
     28                *********** 
     29                Odkazy na Trac našeho generátoru. 
     30                @href nečíselné parametry vedou do wiki 
     31        --> 
     32        <xsl:template match="m:a[@typ='trac' and not(number(@href))]"> 
     33                <xsl:call-template name="vložOdkaz"> 
     34                        <xsl:with-param name="url" select=" 
     35                                concat( 
     36                                        'https://trac.frantovo.cz/xml-web-generator/wiki/',  
     37                                        replace(encode-for-uri(@href), '%2F', '/') 
     38                                )"/> 
     39                </xsl:call-template>             
     40        </xsl:template> 
     41         
     42        <!-- 
     43                Trac – úkoly 
     44                ************ 
     45                Odkazy na Trac našeho generátoru. 
     46                @href číselné parametry vedou na úkoly 
     47        --> 
     48        <xsl:template match="m:a[@typ='trac' and number(@href)]"> 
     49                <xsl:call-template name="vložOdkaz"> 
     50                        <xsl:with-param name="url" select=" 
     51                                concat( 
     52                                        'https://trac.frantovo.cz/xml-web-generator/ticket/',  
     53                                        @href 
     54                                )"/> 
     55                </xsl:call-template> 
     56        </xsl:template> 
     57 
     58        <!--  
     59                Seznam.cz 
     60                ********* 
     61                Vyhledávání pomocí Seznamu 
     62        --> 
     63        <xsl:template match="m:a[@typ='seznam']"> 
     64                <xsl:call-template name="vložOdkaz"> 
     65                        <xsl:with-param name="url" select="concat('http://search.seznam.cz/?q=', encode-for-uri(@href))"/> 
     66                </xsl:call-template> 
     67        </xsl:template> 
     68 
     69        <!--  
     70                Google.com 
     71                ********** 
     72                Vyhledávání pomocí Googlu 
     73        --> 
     74        <xsl:template match="m:a[@typ='google']"> 
     75                <xsl:call-template name="vložOdkaz"> 
     76                        <xsl:with-param name="url" select="concat('https://encrypted.google.com/search?q=', encode-for-uri(@href))"/> 
     77                </xsl:call-template>     
     78        </xsl:template> 
     79         
     80        <!--  
     81                Request for comments 
     82                ******************** 
     83                Internetové standardy – RFC 
     84        --> 
     85        <xsl:template match="m:a[@typ='rfc']"> 
     86                <xsl:call-template name="vložOdkaz"> 
     87                        <xsl:with-param name="url" select="concat('https://tools.ietf.org/html/rfc', @href)"/> 
     88                </xsl:call-template> 
     89        </xsl:template> 
     90         
     91         
     92        <xsl:template name="vložOdkaz"> 
     93                <xsl:param name="url"/> 
     94                <a> 
     95                        <xsl:copy-of select="@*"/> 
     96                        <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute> 
     97                        <xsl:apply-templates/> 
     98                </a>             
     99        </xsl:template> 
     100 
    23101</xsl:stylesheet>