Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
8d2b49a3
Commit
8d2b49a3
authored
Dec 29, 2015
by
Jean Vintache
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factor for-loop (see main target) and handle jing errors
parent
76315f26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
83 deletions
+87
-83
etherpad_to_hdoc/etherpad_to_hdoc.ant
etherpad_to_hdoc/etherpad_to_hdoc.ant
+87
-83
No files found.
etherpad_to_hdoc/etherpad_to_hdoc.ant
View file @
8d2b49a3
...
...
@@ -2,9 +2,9 @@
<project
basedir=
"."
name=
"myantce"
default=
"main"
>
<property
file=
"etherpad_to_hdoc.properties"
/>
<!-- 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
>
<taskdef
resource=
"net/sf/antcontrib/antlib.xml"
/
>
<taskdef
name=
"htmlcleaner"
classname=
"org.htmlcleaner.HtmlCleanerForAnt"
/
>
<taskdef
name=
"jing"
classname=
"com.thaiopensource.relaxng.util.JingTask"
/
>
<target
name=
"start"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
...
...
@@ -14,101 +14,105 @@
<delete
dir=
"${log}"
failonerror=
"false"
/>
<mkdir
dir=
"${log}"
/>
</target>
<target
name=
"clean-tmp"
>
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
<mkdir
dir=
"${tmp}"
/>
</target>
<!-- Apply Xslt -->
<target
name=
"apply-xslt"
>
<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}/html2xhtmlv1.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad2.xhtml"
out=
"${tmp}/${properName}/tmpPad3.xhtml"
style=
"${xsl}/html2xhtmlv2.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad3.xhtml"
out=
"${tmp}/${properName}/tmpPad4.xhtml"
style=
"${xsl}/html2xhtml3.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad4.xhtml"
out=
"${tmp}/${properName}/tozip/content.xml"
style=
"${xsl}/xhtml2hdoc.xsl"
/>
</sequential>
</for>
<!-- clean html file (html -> xhtml) -->
<htmlcleaner
src=
"${in}/${fileName}"
dest=
"${tmp}/pad-clean.xml"
/>
<!-- calls for pad-clean.xml internally -->
<xslt
in=
"${xsl}/html2xhtml.xsl"
out=
"${tmp}/${properName}/tmpPad.xhtml"
style=
"${xsl}/html2xhtml.xsl"
/>
<delete
file=
"${tmp}/pad-clean.xml"
></delete>
<xslt
in=
"${tmp}/${properName}/tmpPad.xhtml"
out=
"${tmp}/${properName}/tmpPad2.xhtml"
style=
"${xsl}/html2xhtmlv1.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad2.xhtml"
out=
"${tmp}/${properName}/tmpPad3.xhtml"
style=
"${xsl}/html2xhtmlv2.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad3.xhtml"
out=
"${tmp}/${properName}/tmpPad4.xhtml"
style=
"${xsl}/html2xhtml3.xsl"
/>
<xslt
in=
"${tmp}/${properName}/tmpPad4.xhtml"
out=
"${tmp}/${properName}/tozip/content.xml"
style=
"${xsl}/xhtml2hdoc.xsl"
/>
</target>
<!-- Builds Hdoc structure -->
<target
name=
"construct_hdoc"
>
<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>
<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"
/>
</target>
<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>
<jing
file=
"${tmp}/${properName}/tozip/content.xml"
rngfile=
"${schema}/xhtml/hdoc1-xhtml.rng"
/>
</target>
<!-- Zip Hdoc container -->
<target
name=
"zip"
>
<zip
basedir=
"${tmp}/${properName}/tozip/"
destfile=
"${out}/${properName}.hdoc"
/>
</target>
<target
name=
"main"
>
<antcall
target=
"start"
/>
<for
param=
"inputPad"
>
<path>
<fileset
dir=
"${in}"
includes=
"*.html"
/>
<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"
/>
<local
name=
"padFileName"
/>
<basename
property=
"padFileName"
file=
"@{inputPad}"
/>
<local
name=
"properFileName"
/>
<basename
property=
"properFileName"
file=
"@{inputPad}"
suffix=
".html"
/>
<echo>
============ Processing pad : ${properFileName} ============
</echo>
<antcall
target=
"apply-xslt"
>
<param
name=
"fileName"
value=
"${padFileName}"
/>
<param
name=
"properName"
value=
"${properFileName}"
/>
</antcall>
<antcall
target=
"construct_hdoc"
>
<param
name=
"properName"
value=
"${properFileName}"
/>
</antcall>
<trycatch>
<try>
<!-- schema verification -->
<antcall
target=
"jing-hdoc"
>
<param
name=
"properName"
value=
"${properFileName}"
/>
</antcall>
<!-- zip hdoc if the schema is verified -->
<antcall
target=
"zip"
>
<param
name=
"properName"
value=
"${properFileName}"
/>
</antcall>
<!-- delete tmp files if everything went fine -->
<delete
dir=
"${tmp}/${properFileName}"
failonerror=
"false"
/>
</try>
<catch>
<echo>
WARNING
</echo>
<echo>
${properFileName} : the outptut doesn't match the hdoc schema
</echo>
<echo>
see the Jing log above and the tmp files
</echo>
</catch>
</trycatch>
</sequential>
</for>
</target>
<target
name=
"main"
>
<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
</project>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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