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
bc865e91
Commit
bc865e91
authored
Dec 12, 2016
by
bperraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update hdoc_to_pdf.ant which now includes basic FS PDF generator
parent
b708820a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
62 deletions
+157
-62
hdoc_to_pdf/hdoc_to_pdf.ant
hdoc_to_pdf/hdoc_to_pdf.ant
+148
-41
hdoc_to_pdf/prepare_hdoc.ant
hdoc_to_pdf/prepare_hdoc.ant
+0
-16
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
+9
-5
No files found.
hdoc_to_pdf/hdoc_to_pdf.ant
View file @
bc865e91
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project
name=
"hdoc_to_pdf"
basedir=
"."
default=
"convert"
>
<!--<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib.jar" />
</classpath>
</taskdef>-->
<!-- 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=
"convert"
>
<echo
message=
"The value of property of InputPath is ${InputPath}"
/>
<echo
message=
"The value of property of OutputPath is ${OutputPath}"
/>
<echo
message=
"The value of property of tmp is ${tmp}"
/>
<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"
/>
<!-- Mac target -->
<target
name=
"convertMac"
if=
"isMac"
>
<echo
message=
"The value of property of InputPath is ${InputPath}"
/>
<echo
message=
"The value of property of OutputPath is ${OutputPath}"
/>
<echo
message=
"The value of property of tmp is ${tmp}"
/>
<!-- Creation of temp dir -->
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
<sleep
seconds=
"1"
/>
<mkdir
dir=
"${tmp}"
/>
<!-- Get input hdoc file path -->
<fileset
id=
"fileset_hdoc"
dir=
"${InputPath}"
casesensitive=
"yes"
>
<include
name=
"*.hdoc"
/>
</fileset>
<pathconvert
property=
"HdocFile"
pathsep=
""
refid=
"fileset_hdoc"
/>
<echo
message=
"Executing conversion..."
/>
<!-- Unzips the hdoc to be converted-->
<unzip
dest=
"${tmp}"
src
=
"${HdocFile}"
/>
<!-- Gives all rights to avoid bugs-->
<chmod
dir=
"${tmp}"
perm=
"777"
/>
<!-- Get input hdoc file path -->
<fileset
id=
"fileset_hdoc"
dir=
"${InputPath}"
casesensitive=
"yes"
>
<include
name=
"*.hdoc"
/>
</fileset>
<pathconvert
property=
"HdocFile"
pathsep=
""
refid=
"fileset_hdoc"
/>
<echo
message=
"Executing conversion..."
/>
<!-- Unzips the hdoc to be converted-->
<unzip
dest=
"${tmp}"
src
=
"${HdocFile}"
/>
<!-- Gives all rights to avoid bugs-->
<chmod
dir=
"${tmp}"
perm=
"777"
/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt
in=
"${tmp}/META-INF/container.xml"
out=
"prepare_hdoc.ant"
style=
"xsl/find_content.xsl"
>
<param
name=
"TempRepository"
expression=
"${tmp}"
/>
...
...
@@ -45,17 +52,117 @@
<chmod
file=
"prepare_hdoc.ant"
perm=
"777"
/>
<!--launches 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"
/>
<ant
antfile=
"prepare_hdoc.ant"
/>
<!--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}/flat_hdoc.xhtml"
/>
<arg
value=
"${OutputPath}/result.pdf"
/>
</exec>
<!--temporary files and folders are deleted-->
<delete
dir=
"${tmp}"
/>
<delete
file=
"prepare_hdoc.ant"
/>
</target>
<!-- Windows target -->
<target
name=
"convertWindows"
if=
"isWindows"
>
<echo
message=
"The value of property of InputPath is ${InputPath}"
/>
<echo
message=
"The value of property of OutputPath is ${OutputPath}"
/>
<echo
message=
"The value of property of tmp is ${tmp}"
/>
<!-- Creation of temp dir -->
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
<sleep
seconds=
"1"
/>
<mkdir
dir=
"${tmp}"
/>
<!-- Get input hdoc file path -->
<fileset
id=
"fileset_hdoc"
dir=
"${InputPath}"
casesensitive=
"yes"
>
<include
name=
"*.hdoc"
/>
</fileset>
<pathconvert
property=
"HdocFile"
pathsep=
""
refid=
"fileset_hdoc"
/>
<echo
message=
"Executing conversion..."
/>
<!--launches the ANT xxx to execute the FS/Java script and get a converted PDF file in the output directory-->
<!--TODO-->
<!-- Unzips the hdoc to be converted-->
<unzip
dest=
"${tmp}"
src=
"${HdocFile}"
/>
<!-- Gives all rights to avoid bugs-->
<chmod
dir=
"${tmp}"
perm=
"777"
/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt
in=
"${tmp}/META-INF/container.xml"
out=
"prepare_hdoc.ant"
style=
"xsl/find_content.xsl"
>
<param
name=
"TempRepository"
expression=
"${tmp}"
/>
</xslt>
<chmod
file=
"prepare_hdoc.ant"
perm=
"777"
/>
<!--launches 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"
/>
<!--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}/flat_hdoc.xhtml"
/>
<arg
value=
"${OutputPath}/result.pdf"
/>
</exec>
<!--temporary files and folders are deleted-->
<delete
dir=
"${tmp}"
/>
<delete
file=
"prepare_hdoc.ant"
/>
</target>
<!-- Linux target -->
<target
name=
"convertUnix"
if=
"isUnix"
>
<echo
message=
"The value of property of InputPath is ${InputPath}"
/>
<echo
message=
"The value of property of OutputPath is ${OutputPath}"
/>
<echo
message=
"The value of property of tmp is ${tmp}"
/>
<!-- Creation of temp dir -->
<delete
dir=
"${tmp}"
failonerror=
"false"
/>
<sleep
seconds=
"1"
/>
<mkdir
dir=
"${tmp}"
/>
<!-- Get input hdoc file path -->
<fileset
id=
"fileset_hdoc"
dir=
"${InputPath}"
casesensitive=
"yes"
>
<include
name=
"*.hdoc"
/>
</fileset>
<pathconvert
property=
"HdocFile"
pathsep=
""
refid=
"fileset_hdoc"
/>
<echo
message=
"Executing conversion..."
/>
<!-- Unzips the hdoc to be converted-->
<unzip
dest=
"${tmp}"
src=
"${HdocFile}"
/>
<!-- Gives all rights to avoid bugs-->
<chmod
dir=
"${tmp}"
perm=
"777"
/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt
in=
"${tmp}/META-INF/container.xml"
out=
"prepare_hdoc.ant"
style=
"xsl/find_content.xsl"
>
<param
name=
"TempRepository"
expression=
"${tmp}"
/>
</xslt>
<chmod
file=
"prepare_hdoc.ant"
perm=
"777"
/>
<!--launches 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"
/>
<!--temporary files and folders are deleted-->
<!--<delete dir="${tmp}"/>-->
<!--<delete file="prepare_hdoc.ant"/>-->
<!--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}/flat_hdoc.xhtml"
/>
<arg
value=
"${OutputPath}/result.pdf"
/>
</exec>
<!--temporary files and folders are deleted-->
<delete
dir=
"${tmp}"
/>
<delete
file=
"prepare_hdoc.ant"
/>
</target>
</target>
</project>
hdoc_to_pdf/prepare_hdoc.ant
deleted
100755 → 0
View file @
b708820a
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns:h=
"urn:utc.fr:ics:hdoc:container"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
name=
"hdoc_to_pdf"
default=
"main"
>
<target
name=
"main"
>
<xslt
in=
"/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/content.xml"
out=
"/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/hdoc_nsless.xhtml"
style=
"xsl/ns_remover.xsl"
/>
<xslt
in=
"/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/hdoc_nsless.xhtml"
out=
"/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/flat_hdoc.xhtml"
style=
"xsl/hdoc_flattenizer.xsl"
/>
</target>
</project>
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
View file @
bc865e91
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
version=
"2.0"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
xpath-default-namespace=
"http://www.w3.org/1999/xhtml"
>
<xsl:output
method=
"text"
indent=
"yes"
/>
<xsl:template
match=
"html"
>
Hello world !
<xsl:output
method=
"xml"
indent=
"yes"
/>
<xsl:template
match=
"node()|@*"
>
<xsl:copy>
<xsl:apply-templates
select=
"node()|@*"
/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
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