etherpad_to_hdoc.ant 3.1 KB
Newer Older
1 2
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="main">
3
    <property file="etherpad_to_hdoc.properties"/>
4

5 6 7 8 9 10 11 12 13 14 15 16
    <taskdef name="htmlcleaner" classname="org.htmlcleaner.HtmlCleanerForAnt">
        <classpath>
            <pathelement location="lib/htmlcleaner-2.16.jar"/>
        </classpath>
    </taskdef>
    
    <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
        <classpath>
            <pathelement location="lib/jing.jar"/>
        </classpath>
    </taskdef>

17 18 19 20 21 22 23 24
    <target name="start">
        <delete dir="${tmp}" failonerror="false"/>
        <mkdir dir="${tmp}"/>
        <delete dir="${out}" failonerror="false"/>
        <mkdir dir="${out}"/>
        <delete dir="${log}" failonerror="false"/>
        <mkdir dir="${log}"/>
    </target>
25
    
26 27 28 29
    <target name="clean-tmp">
        <delete dir="${tmp}" failonerror="false"/>
        <mkdir dir="${tmp}"/>
    </target>
qaomia's avatar
qaomia committed
30

31 32
    <!-- Apply Xslt -->
    <target name="apply-xslt">
33 34
        <htmlcleaner src="${in}/pad.html" dest="${tmp}/pad-clean.xml"/>
        <xslt in="${xsl}/html2xhtml.xsl" out="${tmp}/tmpPad.xhtml" style="${xsl}/html2xhtml.xsl" />
35 36 37 38
        <xslt in="${tmp}/tmpPad.xhtml" out="${tmp}/tmpPad2.xhtml" style="${xsl}/html2xhtmlv2.xsl" />
        <!-- a priori la tâche suivante ne sert à rien -->
        <xslt in="${tmp}/tmpPad2.xhtml" out="${tmp}/tmpPad3.xhtml" style="${xsl}/html2xhtml3.xsl" />
        <xslt in="${tmp}/tmpPad3.xhtml" out="${tmp}/tozip/content.xml" style="${xsl}/xhtml2hdoc.xsl" />
39
    </target>
40
    
41 42 43
    <!-- Builds Hdoc structure -->
    <target name="construct_hdoc">
        <mkdir dir="${tmp}/tozip/" />
44
        <mkdir dir="${tmp}/META-INF/" />
45
        <mkdir dir="${tmp}/tozip/META-INF" />
46
        <mkdir dir="${tmp}/META-INF" />
47
        
48
        <!-- container -->
49 50
        <touch file="${tmp}/META-INF/container.xml" />
        <echoxml file="${tmp}/META-INF/container.xml">
51 52 53 54 55 56
            <container version="1.0">
                <rootfiles>
                    <rootfile full-path="${rootfilename}" media-type="text/xml" />
                </rootfiles>
            </container>
        </echoxml>
57
        <xslt in="${tmp}/META-INF/container.xml" out="${tmp}/tozip/META-INF/container.xml" style="${xsl}/addNamespaceToContainer.xsl"/>
58
        
59 60 61 62
        <!-- mimetype -->
        <touch file="${tmp}/mimetype" />
        <echo message="application/x-hdoc+zip" file="${tmp}/tozip/mimetype" />
    </target>
63
    
64
    <target name="jing-hdoc">        
65 66
        <jing file="${tmp}/tozip/content.xml" rngfile="schema/xhtml/hdoc1-xhtml.rng"></jing>
        <echo>content.xml respecte le schema hdoc1-xhtml.rng</echo>
Jean Vintache's avatar
Jean Vintache committed
67
        
68
    </target>
Jean Vintache's avatar
Jean Vintache committed
69
    
70 71 72 73
    <!-- Zip Hdoc container -->
    <target name="zip">
        <zip basedir="${tmp}/tozip/" destfile="${out}/output.hdoc" />
    </target>
74
    
75 76 77 78 79 80
    <target name="main">
        <antcall target="start"></antcall>
        <antcall target="apply-xslt"></antcall>
        <antcall target="construct_hdoc"></antcall>
        <antcall target="jing-hdoc"></antcall>
        <antcall target="zip"></antcall>
81
        <antcall target="clean-tmp"></antcall>
82
    </target>
qaomia's avatar
qaomia committed
83
    
84
</project>