Skip to content
GitLab
Menu
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
f12613a9
Commit
f12613a9
authored
Dec 17, 2016
by
bperraud
Browse files
Add of the call of our userdefined-FS-class, ant and xsl reworked accordingly
parent
ef049977
Changes
3
Hide whitespace changes
Inline
Side-by-side
hdoc_to_pdf/hdoc_to_pdf.ant
View file @
f12613a9
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project
name=
"hdoc_to_pdf"
basedir=
"."
default=
"main"
>
<!-- OS properties -->
<condition
property=
"isMac"
>
<os
family=
"mac"
/>
</condition>
<condition
property=
"isWindows"
>
<os
family=
"windows"
/>
</condition>
<condition
property=
"isUnix"
>
<os
family=
"unix"
/>
</condition>
<!-- Arguments properties -->
<property
name=
"InputPath"
location=
"input"
/>
<property
name=
"OutputPath"
location=
"output"
/>
<property
name=
"tmp"
location=
"${basedir}/tmp"
/>
<property
name=
"OutputPdfPath"
location=
"${OutputPath}/result.pdf"
/>
<target
name=
"main"
depends=
"convertMac, convertWindows, convertUnix"
>
<!--temporary files and folders are deleted-->
<!--<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>-->
</target>
<!-- Mac target -->
<target
name=
"convertMac"
if=
"isMac"
depends=
"hdocPreparation"
>
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec
executable=
"java"
>
<arg
value=
"-cp"
/>
<arg
value=
"lib/core-renderer.jar:lib/iText-2.0.8.jar"
/>
<arg
value=
"org.xhtmlrenderer.simple.PDFRenderer"
/>
<arg
value=
"${tmp}/final.xhtml"
/>
<arg
value=
"${OutputPath}/result.pdf"
/>
</exec>
</target>
<!-- Windows target -->
<target
name=
"convertWindows"
if=
"isWindows"
depends=
"hdocPreparation"
>
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec
executable=
"java"
>
<arg
value=
"-cp"
/>
<arg
value=
"lib/core-renderer.jar;lib/iText-2.0.8.jar"
/>
<arg
value=
"org.xhtmlrenderer.simple.PDFRenderer"
/>
<arg
value=
"${tmp}/final.xhtml"
/>
<arg
value=
"${OutputPath}/result.pdf"
/>
</exec>
</target>
<!-- Linux target -->
<target
name=
"convertUnix"
if=
"isUnix"
>
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec
executable=
"java"
>
<arg
value=
"-cp"
/>
<arg
value=
"lib/core-renderer.jar:lib/iText-2.0.8.jar"
/>
<arg
value=
"org.xhtmlrenderer.simple.PDFRenderer"
/>
<arg
value=
"${tmp}/final.xhtml"
/>
<arg
value=
"${OutputPath}/result.pdf"
/>
</exec>
<property
name=
"OutputFileName"
location=
"${OutputPath}/result.pdf"
/>
<target
name=
"main"
depends=
"hdocPreparation"
>
<exec
executable=
"java"
>
<arg
value=
"-jar"
/>
<arg
value=
"lib/MyPDFGenerator.jar"
/>
<arg
value=
"${dirpath}/final.xhtml"
/>
<arg
value=
"${OutputFileName}"
/>
</exec>
<!-- Temporary files and folders are deleted -->
<!--
<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>
<delete file="my.properties"/>
-->
</target>
...
...
@@ -87,15 +49,18 @@
<!-- Gives all rights to avoid bugs-->
<chmod
dir=
"${tmp}"
perm=
"777"
/>
<!--
l
aunches the XSLT find_content to retrieve the content path-->
<!--
L
aunches the XSLT find_content to retrieve the content path
-->
<xslt
in=
"${tmp}/META-INF/container.xml"
out=
"prepare_hdoc.ant"
classpath=
"./lib/saxon9he.jar"
style=
"xsl/find_content.xsl"
>
<param
name=
"BaseDirectory"
expression=
"${basedir}"
/>
<param
name=
"TempDirectory"
expression=
"${tmp}"
/>
</xslt>
<chmod
file=
"prepare_hdoc.ant"
perm=
"777"
/>
<!--
l
aunches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion -->
<!--
L
aunches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion -->
<ant
antfile=
"prepare_hdoc.ant"
/>
<!-- Recover of the dirpath property extracted through find_content.xsl execution -->
<property
file=
"${basedir}/my.properties"
/>
</target>
</project>
hdoc_to_pdf/xsl/find_content.xsl
View file @
f12613a9
...
...
@@ -43,18 +43,13 @@
<copy
file=
"{$BaseDirectory}/css/main.css"
tofile=
"{$dirpath}/main.css"
/>
<xslt
in=
"{$TempDirectory}/{$path}"
out=
"{$TempDirectory}/hdoc_nsless.xhtml"
style=
"xsl/ns_remover.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$TempDirectory}/hdoc_nsless.xhtml"
out=
"{$TempDirectory}/flat_hdoc.xhtml"
style=
"xsl/hdoc_flattenizer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$TempDirectory}/flat_hdoc.xhtml"
out=
"{$dirpath}/final.xhtml"
style=
"xsl/last_transformer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<!--TODO include the PDF generation part to hdoc_to_pdf.ant -->
<mkdir
dir=
"output"
/>
<exec
executable=
"java"
>
<arg
value=
"-jar"
/>
<arg
value=
"lib/MyPDFGenerator.jar"
/>
<arg
value=
"{$dirpath}/final.xhtml"
/>
<arg
value=
"output/result.pdf"
/>
</exec>
<xslt
in=
"{$TempDirectory}/{$path}"
out=
"{$dirpath}/hdoc_nsless.xhtml"
style=
"xsl/ns_remover.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/hdoc_nsless.xhtml"
out=
"{$dirpath}/flat_hdoc.xhtml"
style=
"xsl/hdoc_flattenizer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<xslt
in=
"{$dirpath}/flat_hdoc.xhtml"
out=
"{$dirpath}/final.xhtml"
style=
"xsl/last_transformer.xsl"
classpath=
"./lib/saxon9he.jar"
/>
<propertyfile
file=
"{$BaseDirectory}/my.properties"
>
<entry
key=
"dirpath"
value=
"{$dirpath}"
/>
</propertyfile>
</xsl:matching-substring>
</xsl:analyze-string>
...
...
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
View file @
f12613a9
...
...
@@ -2,10 +2,10 @@
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
version=
"2.0"
xpath-default-namespace=
"http://www.w3.org/1999/xhtml"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns=
"http://www.w3.org/1999/xhtml"
>
xpath-default-namespace=
"http://www.w3.org/1999/xhtml"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xmlns=
"http://www.w3.org/1999/xhtml"
>
<xsl:output
method=
"xml"
indent=
"yes"
/>
...
...
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