# HG changeset patch # User František Kučera <franta-hg@frantovo.cz> # Date 1301855950 -7200 # Node ID 78a8dd1eeb2b9ef35d914840ff9c8309c323086e # Parent 4e70453a027fbb5c20501c10a73e57ebaea18e9a statický obsah a úloha pro čištění diff -r 4e70453a027f -r 78a8dd1eeb2b build.xml --- a/build.xml Sun Apr 03 20:12:33 2011 +0200 +++ b/build.xml Sun Apr 03 20:39:10 2011 +0200 @@ -10,9 +10,9 @@ <target name="generuj" description="Vygeneruje kompletní web." depends="kompiluj-funkce,stránky,agregace"> </target> - <target name="stránky" description="Vygeneruje XHTML webové stránky."> + <target name="stránky" description="Vygeneruje samotné XHTML webové stránky." depends="statický-obsah"> <xslt basedir="${vstup}" destdir="${výstup}" includes="*.xml" extension=".xhtml" style="${šablona}/stránka.xsl"> - <param name="konfigurák" expression="../${vstup}/web.conf"/> + <param name="konfigurák" expression="../${vstup}/"/> <classpath location="/usr/share/java/saxonb-9.0.jar"/> <classpath location="${funkce}"/> <factory name="net.sf.saxon.TransformerFactoryImpl"> @@ -21,7 +21,7 @@ </xslt> </target> - <target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml"> + <target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml."> <!-- TODO: sloučit, zjednodušit, parametrizovat --> <!-- Atom --> @@ -53,7 +53,7 @@ </target> - <target name="kompiluj-funkce" description=""> + <target name="kompiluj-funkce" description="Přeloží funkce napsané v Javě."> <mkdir dir="${funkce}"/> <javac srcdir="${šablona}/funkce/src" @@ -62,4 +62,17 @@ </javac> </target> + <target name="statický-obsah" description="Kopíruje JS, CSS, obrázky atd."> + <copy todir="${výstup}"> + <fileset dir="${vstup}" excludes="*.xml,*.inc,web.conf"/> + </copy> + </target> + + <target name="čisti" description="Smaže vygenerovaný obsah."> + <delete includeemptydirs="true"> + <fileset dir="${výstup}" includes="**/*"/> + <fileset dir="${funkce}" includes="**/*"/> + </delete> + </target> + </project> diff -r 4e70453a027f -r 78a8dd1eeb2b vstup/css/styl.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vstup/css/styl.css Sun Apr 03 20:39:10 2011 +0200 @@ -0,0 +1,1 @@ + diff -r 4e70453a027f -r 78a8dd1eeb2b vstup/js/javascript.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vstup/js/javascript.js Sun Apr 03 20:39:10 2011 +0200 @@ -0,0 +1,1 @@ + diff -r 4e70453a027f -r 78a8dd1eeb2b šablona/stránka.xsl --- a/šablona/stránka.xsl Sun Apr 03 20:12:33 2011 +0200 +++ b/šablona/stránka.xsl Sun Apr 03 20:39:10 2011 +0200 @@ -13,12 +13,13 @@ encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/> - - <xsl:param name="konfigurák"/> + + <!-- Vstupní adresář: --> + <xsl:param name="vstup" select="'../vstup/'"/> <!-- Celý dokument: --> <xsl:template match="/"> - <xsl:variable name="konfigurace" select="document($konfigurák)"/> + <xsl:variable name="konfigurace" select="document(concat($vstup, 'web.conf'))"/> <html> <head> <title><xsl:value-of select="g:stránka/g:nadpis"/></title> @@ -28,7 +29,7 @@ <xsl:apply-templates select="$konfigurace/g:web/g:css"/> </head> <body> - <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/> + <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví.inc')))/g:stránka/h:text/node()"/> <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1> <xsl:apply-templates select="g:stránka/h:text/node()"/> <ul id="nabídka"> @@ -42,7 +43,7 @@ </li> </xsl:for-each> </ul> - <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/> + <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí.inc')))/g:stránka/h:text/node()"/> </body> </html> </xsl:template> @@ -55,6 +56,7 @@ </xsl:element> </xsl:template> + <!-- Odkazy na JavaScript a kaskádové styly --> <xsl:template match="g:web/g:js"> <script src="{text()}" type="text/javascript" /> </xsl:template>