| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <!-- |
|---|
| 3 | XML Web generátor – program na generování webových stránek |
|---|
| 4 | Copyright © 2012 František Kučera (frantovo.cz) |
|---|
| 5 | |
|---|
| 6 | This program is free software: you can redistribute it and/or modify |
|---|
| 7 | it under the terms of the GNU General Public License as published by |
|---|
| 8 | the Free Software Foundation, either version 3 of the License, or |
|---|
| 9 | (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | This program is distributed in the hope that it will be useful, |
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | GNU General Public License for more details. |
|---|
| 15 | |
|---|
| 16 | You should have received a copy of the GNU General Public License |
|---|
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | --> |
|---|
| 19 | <project name="xhtml-web" basedir="." default="generuj"> |
|---|
| 20 | |
|---|
| 21 | <loadproperties srcfile="build.uživatelské.properties"/> |
|---|
| 22 | <loadproperties srcfile="build.properties"/> |
|---|
| 23 | |
|---|
| 24 | <!-- Používané adresáře – např. zde můžete vstup a výstup nasměrovat do jiného verzovaného úložiště --> |
|---|
| 25 | <property name="vstup" value="vstup"/> |
|---|
| 26 | <property name="výstup" value="výstup"/> |
|---|
| 27 | <property name="šablona" value="šablona"/> |
|---|
| 28 | <property name="seznamMaker" value="${šablona}/.makra-seznam.xsl"/> |
|---|
| 29 | <property name="temp" value="temp"/> |
|---|
| 30 | <property name="funkce" value="${šablona}/funkce/build/classes"/> |
|---|
| 31 | <property name="čára" value="----------------------------------------------------------------"/> |
|---|
| 32 | |
|---|
| 33 | <property name="vstupníPřípona" value=".xml"/> |
|---|
| 34 | <property name="výstupníPřípona" value=".xhtml"/> |
|---|
| 35 | |
|---|
| 36 | <target name="generuj" description="Vygeneruje kompletní web." depends="licence,agregace,stránky"/> |
|---|
| 37 | |
|---|
| 38 | <target name="stránky" description="Vygeneruje samotné XHTML webové stránky." depends="statický-obsah,syntaxe,kompiluj-funkce,makra"> |
|---|
| 39 | <xslt basedir="${vstup}" destdir="${výstup}" includes="*${vstupníPřípona}" extension="${výstupníPřípona}" style="${šablona}/stránka.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 40 | <param name="podporaZaostalýchProhlížečů" expression="false"/> |
|---|
| 41 | <param name="vstupníPřípona" expression="${vstupníPřípona}"/> |
|---|
| 42 | <param name="výstupníPřípona" expression="${výstupníPřípona}"/> |
|---|
| 43 | <classpath location="${xslt.jar}"/> |
|---|
| 44 | <classpath location="${funkce}"/> |
|---|
| 45 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 46 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 47 | </factory> |
|---|
| 48 | </xslt> |
|---|
| 49 | </target> |
|---|
| 50 | |
|---|
| 51 | <target name="syntaxe" description="Vygeneruje CSS styl pro zvýrazňování syntaxe" depends="kompiluj-funkce"> |
|---|
| 52 | <xslt in="${vstup}/web.conf" out="${výstup}/css/syntaxe.css" style="${šablona}/syntaxe.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 53 | <classpath location="${xslt.jar}"/> |
|---|
| 54 | <classpath location="${funkce}"/> |
|---|
| 55 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 56 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 57 | </factory> |
|---|
| 58 | </xslt> |
|---|
| 59 | </target> |
|---|
| 60 | |
|---|
| 61 | <target name="makra" description="Vygeneruje seznam maker podle souborů v příslušných složkách" depends="kompiluj-funkce"> |
|---|
| 62 | <xslt in="${vstup}/web.conf" out="${seznamMaker}" style="${šablona}/makra.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 63 | <classpath location="${xslt.jar}"/> |
|---|
| 64 | <classpath location="${funkce}"/> |
|---|
| 65 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 66 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 67 | </factory> |
|---|
| 68 | </xslt> |
|---|
| 69 | </target> |
|---|
| 70 | |
|---|
| 71 | <target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml." depends="kompiluj-funkce"> |
|---|
| 72 | <!-- TODO: sloučit, zjednodušit, parametrizovat --> |
|---|
| 73 | |
|---|
| 74 | <!-- Atom --> |
|---|
| 75 | <xslt in="${vstup}/web.conf" out="${výstup}/atom.xml" style="${šablona}/atom.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 76 | <param name="vstupníPřípona" expression="${vstupníPřípona}"/> |
|---|
| 77 | <param name="výstupníPřípona" expression="${výstupníPřípona}"/> |
|---|
| 78 | <classpath location="${xslt.jar}"/> |
|---|
| 79 | <classpath location="${funkce}"/> |
|---|
| 80 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 81 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 82 | </factory> |
|---|
| 83 | </xslt> |
|---|
| 84 | |
|---|
| 85 | <!-- RSS --> |
|---|
| 86 | <xslt in="${výstup}/atom.xml" out="${výstup}/rss.xml" style="${šablona}/rss.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 87 | <classpath location="${xslt.jar}"/> |
|---|
| 88 | <classpath location="${funkce}"/> |
|---|
| 89 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 90 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 91 | </factory> |
|---|
| 92 | </xslt> |
|---|
| 93 | |
|---|
| 94 | <!-- Sitemap.xml --> |
|---|
| 95 | <xslt in="${výstup}/atom.xml" out="${výstup}/sitemap.xml" style="${šablona}/sitemap.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 96 | <classpath location="${xslt.jar}"/> |
|---|
| 97 | <classpath location="${funkce}"/> |
|---|
| 98 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 99 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 100 | </factory> |
|---|
| 101 | </xslt> |
|---|
| 102 | |
|---|
| 103 | <!-- Seznam stránek --> |
|---|
| 104 | <xslt in="${výstup}/atom.xml" out="${vstup}/.seznam.xml" style="${šablona}/seznam.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"> |
|---|
| 105 | <classpath location="${xslt.jar}"/> |
|---|
| 106 | <classpath location="${funkce}"/> |
|---|
| 107 | <factory name="net.sf.saxon.TransformerFactoryImpl"> |
|---|
| 108 | <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> |
|---|
| 109 | </factory> |
|---|
| 110 | </xslt> |
|---|
| 111 | |
|---|
| 112 | </target> |
|---|
| 113 | |
|---|
| 114 | <target name="kompiluj-funkce" description="Přeloží funkce napsané v Javě."> |
|---|
| 115 | <mkdir dir="${funkce}"/> |
|---|
| 116 | <javac |
|---|
| 117 | srcdir="${šablona}/funkce/src" |
|---|
| 118 | destdir="${funkce}" |
|---|
| 119 | includeAntRuntime="no"> |
|---|
| 120 | </javac> |
|---|
| 121 | </target> |
|---|
| 122 | |
|---|
| 123 | <target name="statický-obsah" description="Kopíruje JS, CSS, obrázky atd."> |
|---|
| 124 | <copy todir="${výstup}"> |
|---|
| 125 | <fileset dir="${vstup}" excludes="*.xml,makra/**,*.inc,web.conf"/> |
|---|
| 126 | </copy> |
|---|
| 127 | </target> |
|---|
| 128 | |
|---|
| 129 | <target name="čisti" description="Smaže vygenerovaný obsah."> |
|---|
| 130 | <delete includeemptydirs="true"> |
|---|
| 131 | <fileset dir="${výstup}" includes="**/*"/> |
|---|
| 132 | <fileset dir="${funkce}" includes="**/*"/> |
|---|
| 133 | <fileset file="${seznamMaker}"/> |
|---|
| 134 | </delete> |
|---|
| 135 | </target> |
|---|
| 136 | |
|---|
| 137 | <target name="prohlédni" description="Otevře vygenerované stránky ve www prohlížeči."> |
|---|
| 138 | <exec executable="x-www-browser" os="Linux"> |
|---|
| 139 | <arg value="${výstup}/index${výstupníPřípona}"/> |
|---|
| 140 | </exec> |
|---|
| 141 | </target> |
|---|
| 142 | |
|---|
| 143 | <target name="dokumentace" description="Sestaví dokumentaci"> |
|---|
| 144 | <javadoc destdir="dokumentace/javadoc" linksource="true" windowtitle="XML Web generátor – javadoc"> |
|---|
| 145 | <fileset dir="šablona/funkce/src"/> |
|---|
| 146 | </javadoc> |
|---|
| 147 | </target> |
|---|
| 148 | |
|---|
| 149 | <target name="licence"> |
|---|
| 150 | <echo>${čára} |
|---|
| 151 | XML Web generátor Copyright © 2012 František Kučera (frantovo.cz) |
|---|
| 152 | This program comes with ABSOLUTELY NO WARRANTY; |
|---|
| 153 | This is free software, and you are welcome to redistribute it |
|---|
| 154 | under certain conditions; type ‚ant licence-gpl‘ for details. |
|---|
| 155 | ${čára}</echo> |
|---|
| 156 | </target> |
|---|
| 157 | |
|---|
| 158 | <target name="licence-gpl"> |
|---|
| 159 | <loadfile property="licence.txt" srcFile="licence/licence.txt"/> |
|---|
| 160 | <loadfile property="gpl-3.0.txt" srcFile="licence/gpl-3.0.txt"/> |
|---|
| 161 | <echo>${čára}</echo> |
|---|
| 162 | <echo>${licence.txt}</echo> |
|---|
| 163 | <echo>${čára}</echo> |
|---|
| 164 | <echo>${gpl-3.0.txt}</echo> |
|---|
| 165 | <echo>${čára}</echo> |
|---|
| 166 | </target> |
|---|
| 167 | |
|---|
| 168 | </project> |
|---|
| 169 | |
|---|