Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
c6e3ac77
Commit
c6e3ac77
authored
Dec 28, 2015
by
Jean Vintache
Browse files
ant script handles multiple files in input, and names the output hdoc files accordingly
parent
90e63253
Changes
2
Hide whitespace changes
Inline
Side-by-side
etherpad_to_hdoc/etherpad_to_hdoc.ant
View file @
c6e3ac77
<?xml version="1.0" encoding="UTF-8"?>
<project
basedir=
"."
name=
"myantce"
default=
"main"
>
<property
file=
"etherpad_to_hdoc.properties"
/>
<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>
<!-- import classes -->
<taskdef
resource=
"net/sf/antcontrib/antlib.xml"
></taskdef>
<taskdef
name=
"htmlcleaner"
classname=
"org.htmlcleaner.HtmlCleanerForAnt"
></taskdef>
<taskdef
name=
"jing"
classname=
"com.thaiopensource.relaxng.util.JingTask"
></taskdef>
<target
name=
"start"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
...
...
@@ -30,55 +22,92 @@
<!-- Apply Xslt -->
<target
name=
"apply-xslt"
>
<htmlcleaner
src=
"${in}/pad.html"
dest=
"${tmp}/pad-clean.xml"
/>
<xslt
in=
"${xsl}/html2xhtml.xsl"
out=
"${tmp}/tmpPad.xhtml"
style=
"${xsl}/html2xhtml.xsl"
/>
<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"
/>
<for
param=
"inputPad"
>
<path>
<fileset
dir=
"${in}"
includes=
"*.html"
/>
</path>
<sequential>
<local
name=
"padFileName"
/>
<basename
property=
"padFileName"
file=
"@{inputPad}"
/>
<local
name=
"properName"
/>
<basename
property=
"properName"
file=
"@{inputPad}"
suffix=
".html"
/>
<htmlcleaner
src=
"${in}/${padFileName}"
dest=
"${tmp}/pad-clean.xml"
/>
<xslt
in=
"${xsl}/html2xhtml.xsl"
out=
"${tmp}/${properName}/tmpPad.xhtml"
style=
"${xsl}/html2xhtml.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad.xhtml"
out=
"${tmp}/${properName}/tmpPad2.xhtml"
style=
"${xsl}/html2xhtmlv2.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad2.xhtml"
out=
"${tmp}/${properName}/tmpPad3.xhtml"
style=
"${xsl}/html2xhtml3.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad3.xhtml"
out=
"${tmp}/${properName}/tozip/content.xml"
style=
"${xsl}/xhtml2hdoc.xsl"
/>
</sequential>
</for>
</target>
<!-- Builds Hdoc structure -->
<target
name=
"construct_hdoc"
>
<mkdir
dir=
"${tmp}/tozip/"
/>
<mkdir
dir=
"${tmp}/META-INF/"
/>
<mkdir
dir=
"${tmp}/tozip/META-INF"
/>
<mkdir
dir=
"${tmp}/META-INF"
/>
<!-- container -->
<touch
file=
"${tmp}/META-INF/container.xml"
/>
<echoxml
file=
"${tmp}/META-INF/container.xml"
>
<container
version=
"1.0"
>
<rootfiles>
<rootfile
full-path=
"${rootfilename}"
media-type=
"text/xml"
/>
</rootfiles>
</container>
</echoxml>
<xslt
in=
"${tmp}/META-INF/container.xml"
out=
"${tmp}/tozip/META-INF/container.xml"
style=
"${xsl}/addNamespaceToContainer.xsl"
/>
<!-- mimetype -->
<touch
file=
"${tmp}/mimetype"
/>
<echo
message=
"application/x-hdoc+zip"
file=
"${tmp}/tozip/mimetype"
/>
<for
param=
"inputPad"
>
<path>
<fileset
dir=
"${in}"
includes=
"*.html"
/>
</path>
<sequential>
<local
name=
"properName"
/>
<basename
property=
"properName"
file=
"@{inputPad}"
suffix=
".html"
/>
<mkdir
dir=
"${tmp}/${properName}/tozip/"
/>
<mkdir
dir=
"${tmp}/${properName}/META-INF/"
/>
<mkdir
dir=
"${tmp}/${properName}/tozip/META-INF"
/>
<!-- container -->
<touch
file=
"${tmp}/${properName}/META-INF/container.xml"
/>
<echoxml
file=
"${tmp}/${properName}/META-INF/container.xml"
>
<container
version=
"1.0"
>
<rootfiles>
<rootfile
full-path=
"${rootfilename}"
media-type=
"text/xml"
/>
</rootfiles>
</container>
</echoxml>
<xslt
in=
"${tmp}/${properName}/META-INF/container.xml"
out=
"${tmp}/${properName}/tozip/META-INF/container.xml"
style=
"${xsl}/addNamespaceToContainer.xsl"
/>
<!-- mimetype -->
<touch
file=
"${tmp}/${properName}/mimetype"
/>
<echo
message=
"application/x-hdoc+zip"
file=
"${tmp}/${properName}/tozip/mimetype"
/>
</sequential>
</for>
</target>
<target
name=
"jing-hdoc"
>
<jing
file=
"${tmp}/tozip/content.xml"
rngfile=
"schema/xhtml/hdoc1-xhtml.rng"
></jing>
<echo>
content.xml respecte le schema hdoc1-xhtml.rng
</echo>
<target
name=
"jing-hdoc"
>
<for
param=
"inputPad"
keepgoing=
"true"
>
<path>
<fileset
dir=
"${in}"
includes=
"*.html"
/>
</path>
<sequential>
<local
name=
"properName"
/>
<basename
property=
"properName"
file=
"@{inputPad}"
suffix=
".html"
/>
<jing
file=
"${tmp}/${properName}/tozip/content.xml"
rngfile=
"${schema}/xhtml/hdoc1-xhtml.rng"
/>
</sequential>
</for>
</target>
<!-- Zip Hdoc container -->
<target
name=
"zip"
>
<zip
basedir=
"${tmp}/tozip/"
destfile=
"${out}/output.hdoc"
/>
<for
param=
"inputPad"
>
<path>
<fileset
dir=
"${in}"
includes=
"*.html"
/>
</path>
<sequential>
<local
name=
"properName"
/>
<basename
property=
"properName"
file=
"@{inputPad}"
suffix=
".html"
/>
<zip
basedir=
"${tmp}/${properName}/tozip/"
destfile=
"${out}/${properName}.hdoc"
/>
</sequential>
</for>
</target>
<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
>
<antcall
target=
"clean-tmp"
></antcall
>
<antcall
target=
"start"
/
>
<antcall
target=
"apply-xslt"
/
>
<antcall
target=
"construct_hdoc"
/
>
<antcall
target=
"jing-hdoc"
/
>
<antcall
target=
"zip"
/
>
<antcall
target=
"clean-tmp"
/
>
</target>
</project>
\ No newline at end of file
etherpad_to_hdoc/etherpad_to_hdoc.properties
View file @
c6e3ac77
...
...
@@ -4,5 +4,6 @@ tmp = ${basedir}/tmp
xsl
=
${basedir}/xsl
lib
=
${basedir}/lib
log
=
${basedir}/log
schema
=
${basedir}/schema
rootfilename
=
content.xml
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment