optim_to_hdoc.ant 2.71 KB
Newer Older
1
<?xml version="1.0" encoding="UTF-8"?>
Ivan D'halluin's avatar
Ivan D'halluin committed
2
<project basedir="." name="optim_to_hdoc">
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  
  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
  
  <property name="in" location="${basedir}/input"/>
  <property name="out" location="${basedir}/output"/>
  <property name="tmp" location="${basedir}/tmp"/>
  <property name="xsl" location="${basedir}/xsl"/>
  <property name="lib" location="${basedir}/lib"/>
  <property name="log" location="${basedir}/log"/>
  
  <delete dir="${tmp}" failonerror="false"/>
  <mkdir dir="${tmp}"/>
  <delete dir="${out}" failonerror="false"/>
  <mkdir dir="${out}"/>
  <delete dir="${log}" failonerror="false"/>
  <mkdir dir="${log}"/>
  <mkdir dir="${tmp}/extract"/>
  <mkdir dir="${tmp}/internationalisation"/>
  
  <echo message="Extract files..."/>
  
  <for param="archive">
    <path>
      <fileset dir="${in}" includes="*"/>
    </path>
    <sequential>
      <local name="archive_name"/>
      <basename property="archive_name" file="@{archive}"/>
      <unzip src="@{archive}" dest="${tmp}/extract/${archive_name}"></unzip>
    </sequential>
  </for>
  
  <echo message="Internationalize files..."/>
36

37 38 39 40 41 42 43 44 45 46 47
  <xslt useImplicitFileset="false" destdir="${tmp}/internationalisation" style="${xsl}/internalisation.xsl">
    <param name="currentDir" expression="."/>
    <fileset dir="${tmp}/extract">
      <!-- only converting the root files -->
      <include name="*/*.paper"/>
      <include name="*/*.section"/>
      <include name="*/*.website"/>
      <include name="*/*.slideshow"/>
      <include name="*/*.webpage"/>
    </fileset>
  </xslt>
48

49 50 51
  <echo message="Convert to hdoc..."/>
  
  <xslt basedir="${tmp}/internationalisation" destdir="${out}" style="${xsl}/optim_to_hdoc.xsl"/>
Ivan D'halluin's avatar
Ivan D'halluin committed
52 53
  
  
54

55 56 57 58 59 60 61 62 63 64 65 66 67
  <echo message="Copy ressources files..."/>

  <copy todir="${out}">
    <fileset dir="${tmp}/extract">
      <!-- only copying resources files -->
      <exclude name="*/*.paper"/>
      <exclude name="*/*.section"/>
      <exclude name="*/*.website"/>
      <exclude name="*/*.slideshow"/>
      <exclude name="*/*.webpage"/>
    </fileset>
  </copy>
  
Ivan D'halluin's avatar
Ivan D'halluin committed
68
  <!--<for param="folder">
Ivan D'halluin's avatar
Ivan D'halluin committed
69 70 71 72 73 74 75 76 77 78 79
    <path>
      <dirset dir="${out}" includes="*"/>
    </path>
    <sequential>
      <local name="folder_name"/>
      <basename property="folder_name" file="@{folder}"/>
      <copy todir="@{folder}">
        <fileset dir="${tmp}/extract">
        </fileset>
      </copy>
    </sequential>
Ivan D'halluin's avatar
Ivan D'halluin committed
80
  </for>-->
Ivan D'halluin's avatar
Ivan D'halluin committed
81
  
82 83 84 85 86 87 88 89 90
  <echo message="Zip result..."/>
 
  <for param="folder">
    <path>
      <dirset dir="${out}" includes="*"/>
    </path>
    <sequential>
      <local name="folder_name"/>
      <basename property="folder_name" file="@{folder}"/>
Ivan D'halluin's avatar
Ivan D'halluin committed
91
      <zip destfile="${out}/${folder_name}.hdoc" basedir="@{folder}" ></zip>
92 93
    </sequential>
  </for>
94 95
    
</project>