libis-format 1.0.4 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +5 -1
  3. data/.travis.yml +43 -25
  4. data/README.md +2 -2
  5. data/base/Dockerfile +35 -0
  6. data/base/Dockerfile.alpine +20 -0
  7. data/base/Dockerfile.rvm +56 -0
  8. data/base/rework_path +20 -0
  9. data/docker_cfg.yml +1 -0
  10. data/lib/libis/format.rb +12 -3
  11. data/lib/libis/format/cli/convert.rb +4 -4
  12. data/lib/libis/format/config.rb +15 -10
  13. data/lib/libis/format/converter/audio_converter.rb +3 -37
  14. data/lib/libis/format/converter/base.rb +22 -8
  15. data/lib/libis/format/converter/chain.rb +3 -3
  16. data/lib/libis/format/converter/image_assembler.rb +82 -0
  17. data/lib/libis/format/converter/image_converter.rb +20 -138
  18. data/lib/libis/format/converter/image_splitter.rb +84 -0
  19. data/lib/libis/format/converter/image_watermarker.rb +261 -0
  20. data/lib/libis/format/converter/jp2_converter.rb +2 -2
  21. data/lib/libis/format/converter/office_converter.rb +2 -2
  22. data/lib/libis/format/converter/pdf_assembler.rb +66 -0
  23. data/lib/libis/format/converter/pdf_converter.rb +10 -134
  24. data/lib/libis/format/converter/pdf_metadata.rb +82 -0
  25. data/lib/libis/format/converter/pdf_optimizer.rb +67 -0
  26. data/lib/libis/format/converter/pdf_protecter.rb +147 -0
  27. data/lib/libis/format/converter/pdf_selecter.rb +83 -0
  28. data/lib/libis/format/converter/pdf_splitter.rb +70 -0
  29. data/lib/libis/format/converter/pdf_watermarker_header.rb +71 -0
  30. data/lib/libis/format/converter/pdf_watermarker_image.rb +76 -0
  31. data/lib/libis/format/converter/pdf_watermarker_text.rb +93 -0
  32. data/lib/libis/format/converter/spreadsheet_converter.rb +2 -2
  33. data/lib/libis/format/converter/video_converter.rb +1 -1
  34. data/lib/libis/format/identifier.rb +3 -3
  35. data/lib/libis/format/info.rb +27 -0
  36. data/lib/libis/format/library.rb +147 -0
  37. data/lib/libis/format/tool.rb +4 -1
  38. data/lib/libis/format/tool/droid.rb +2 -2
  39. data/lib/libis/format/tool/extension_identification.rb +4 -4
  40. data/lib/libis/format/tool/ffmpeg.rb +1 -1
  41. data/lib/libis/format/tool/fido.rb +1 -1
  42. data/lib/libis/format/tool/fop_pdf.rb +1 -1
  43. data/lib/libis/format/tool/identification_tool.rb +6 -6
  44. data/lib/libis/format/tool/office_to_pdf.rb +1 -1
  45. data/lib/libis/format/tool/pdf_merge.rb +4 -4
  46. data/lib/libis/format/tool/{pdf_copy.rb → pdf_metadata.rb} +6 -6
  47. data/lib/libis/format/tool/pdf_protect.rb +47 -0
  48. data/lib/libis/format/tool/pdf_select.rb +47 -0
  49. data/lib/libis/format/tool/pdf_split.rb +5 -5
  50. data/lib/libis/format/tool/pdf_to_pdfa.rb +1 -2
  51. data/lib/libis/format/tool/pdf_watermark.rb +47 -0
  52. data/lib/libis/format/tool/pdfa_validator.rb +3 -4
  53. data/lib/libis/format/tool/spreadsheet_to_ods.rb +2 -1
  54. data/lib/libis/format/version.rb +1 -1
  55. data/lib/libis/format/yaml_loader.rb +71 -0
  56. data/libis-format.gemspec +5 -4
  57. data/tools/PdfTool.jar +0 -0
  58. data/tools/bcpkix-jdk15on-167.jar +0 -0
  59. data/tools/bcprov-jdk15on-167.jar +0 -0
  60. data/tools/fop/build/fop.jar +0 -0
  61. data/tools/fop/conf/fop.xconf +466 -0
  62. data/tools/fop/fop +258 -0
  63. data/tools/fop/fop.bat +75 -0
  64. data/tools/fop/fop.cmd +31 -0
  65. data/tools/fop/fop.js +341 -0
  66. data/tools/fop/lib/README.txt +243 -0
  67. data/tools/fop/lib/avalon-framework-api-4.3.1.jar +0 -0
  68. data/tools/fop/lib/avalon-framework-impl-4.3.1.jar +0 -0
  69. data/tools/fop/lib/avalon-framework.LICENSE.txt +175 -0
  70. data/tools/fop/lib/avalon-framework.NOTICE.TXT +11 -0
  71. data/tools/fop/lib/batik-all-1.10.jar +0 -0
  72. data/tools/fop/lib/batik.LICENSE.txt +201 -0
  73. data/tools/fop/lib/batik.NOTICE.txt +18 -0
  74. data/tools/fop/lib/commons-io-1.3.1.jar +0 -0
  75. data/tools/fop/lib/commons-io.LICENSE.txt +203 -0
  76. data/tools/fop/lib/commons-io.NOTICE.txt +6 -0
  77. data/tools/fop/lib/commons-logging-1.0.4.jar +0 -0
  78. data/tools/fop/lib/commons-logging.LICENSE.txt +202 -0
  79. data/tools/fop/lib/commons-logging.NOTICE.txt +3 -0
  80. data/tools/fop/lib/fontbox-2.0.7.jar +0 -0
  81. data/tools/fop/lib/serializer-2.7.2.jar +0 -0
  82. data/tools/fop/lib/serializer.LICENSE.txt +201 -0
  83. data/tools/fop/lib/serializer.NOTICE.txt +15 -0
  84. data/tools/fop/lib/xalan-2.7.2.jar +0 -0
  85. data/tools/fop/lib/xalan.BCEL.LICENSE.txt +52 -0
  86. data/tools/fop/lib/xalan.LICENSE.txt +202 -0
  87. data/tools/fop/lib/xalan.NOTICE.txt +44 -0
  88. data/tools/fop/lib/xalan.regexp.LICENSE.txt +52 -0
  89. data/tools/fop/lib/xalan.runtime.LICENSE.txt +20 -0
  90. data/tools/fop/lib/xerces.LICENSE.txt +56 -0
  91. data/tools/fop/lib/xercesImpl-2.9.1.jar +0 -0
  92. data/tools/fop/lib/xercesImpl.LICENSE.txt +201 -0
  93. data/tools/fop/lib/xercesImpl.NOTICE.txt +14 -0
  94. data/tools/fop/lib/xml-apis-1.3.04.jar +0 -0
  95. data/tools/fop/lib/xml-apis-ext-1.3.04.jar +0 -0
  96. data/tools/fop/lib/xml-apis-ext.LICENSE.dom-documentation.txt +73 -0
  97. data/tools/fop/lib/xml-apis-ext.LICENSE.dom-software.txt +61 -0
  98. data/tools/fop/lib/xml-apis-ext.LICENSE.sac.html +75 -0
  99. data/tools/fop/lib/xml-apis-ext.LICENSE.txt +202 -0
  100. data/tools/fop/lib/xml-apis-ext.NOTICE.txt +16 -0
  101. data/tools/fop/lib/xml-apis-ext.README.dom.txt +56 -0
  102. data/tools/fop/lib/xml-apis.LICENSE-SAX.html +17 -0
  103. data/tools/fop/lib/xml-apis.LICENSE.DOM-documentation.html +74 -0
  104. data/tools/fop/lib/xml-apis.LICENSE.DOM-software.html +66 -0
  105. data/tools/fop/lib/xml-apis.LICENSE.txt +201 -0
  106. data/tools/fop/lib/xml-apis.NOTICE.txt +13 -0
  107. data/tools/fop/lib/xmlgraphics-commons-2.3.jar +0 -0
  108. data/tools/fop/lib/xmlgraphics-commons.LICENSE.txt +202 -0
  109. data/tools/fop/lib/xmlgraphics-commons.NOTICE.txt +5 -0
  110. data/tools/pdfbox/pdfbox-app-2.0.13.jar +0 -0
  111. data/tools/pdfbox/{pdfbox-app-1.8.10.jar → preflight-app-2.0.13.jar} +0 -0
  112. metadata +86 -246
  113. data/lib/libis/format/type_database.rb +0 -134
  114. data/lib/libis/format/type_database_impl.rb +0 -120
  115. data/spec/converter_audio_spec.rb +0 -66
  116. data/spec/converter_fop_spec.rb +0 -37
  117. data/spec/converter_image_spec.rb +0 -166
  118. data/spec/converter_office_spec.rb +0 -84
  119. data/spec/converter_pdf_spec.rb +0 -30
  120. data/spec/converter_repository_spec.rb +0 -97
  121. data/spec/converter_spreadsheet_spec.rb +0 -39
  122. data/spec/converter_video_spec.rb +0 -97
  123. data/spec/converter_xsl_spec.rb +0 -56
  124. data/spec/data/Cevennes2.bmp +0 -0
  125. data/spec/data/Cevennes2.jp2 +0 -0
  126. data/spec/data/Cevennes2.ppm +0 -22492
  127. data/spec/data/NikonRaw-CameraRaw.TIF +0 -0
  128. data/spec/data/NikonRaw-CaptureOne.tif +0 -0
  129. data/spec/data/audio/carlin_disappointed.aac +0 -0
  130. data/spec/data/audio/carlin_disappointed.ac3 +0 -0
  131. data/spec/data/audio/carlin_disappointed.aiff +0 -0
  132. data/spec/data/audio/carlin_disappointed.au +0 -0
  133. data/spec/data/audio/carlin_disappointed.flac +0 -0
  134. data/spec/data/audio/carlin_disappointed.m4a +0 -0
  135. data/spec/data/audio/carlin_disappointed.mka +0 -0
  136. data/spec/data/audio/carlin_disappointed.mp3 +0 -0
  137. data/spec/data/audio/carlin_disappointed.ogg +0 -0
  138. data/spec/data/audio/carlin_disappointed.ra +0 -0
  139. data/spec/data/audio/carlin_disappointed.voc +0 -0
  140. data/spec/data/audio/carlin_disappointed.wav +0 -0
  141. data/spec/data/audio/carlin_disappointed.wma +0 -0
  142. data/spec/data/audio/greensleeves.aac +0 -0
  143. data/spec/data/audio/greensleeves.ac3 +0 -0
  144. data/spec/data/audio/greensleeves.aiff +0 -0
  145. data/spec/data/audio/greensleeves.au +0 -0
  146. data/spec/data/audio/greensleeves.flac +0 -0
  147. data/spec/data/audio/greensleeves.m4a +0 -0
  148. data/spec/data/audio/greensleeves.mka +0 -0
  149. data/spec/data/audio/greensleeves.mp3 +0 -0
  150. data/spec/data/audio/greensleeves.ogg +0 -0
  151. data/spec/data/audio/greensleeves.ra +0 -0
  152. data/spec/data/audio/greensleeves.voc +0 -0
  153. data/spec/data/audio/greensleeves.wav +0 -0
  154. data/spec/data/audio/greensleeves.wma +0 -0
  155. data/spec/data/audio/king_nonviolence.aac +0 -0
  156. data/spec/data/audio/king_nonviolence.ac3 +0 -0
  157. data/spec/data/audio/king_nonviolence.aiff +0 -0
  158. data/spec/data/audio/king_nonviolence.au +0 -0
  159. data/spec/data/audio/king_nonviolence.flac +0 -0
  160. data/spec/data/audio/king_nonviolence.m4a +0 -0
  161. data/spec/data/audio/king_nonviolence.mka +0 -0
  162. data/spec/data/audio/king_nonviolence.mp3 +0 -0
  163. data/spec/data/audio/king_nonviolence.ogg +0 -0
  164. data/spec/data/audio/king_nonviolence.ra +0 -0
  165. data/spec/data/audio/king_nonviolence.voc +0 -0
  166. data/spec/data/audio/king_nonviolence.wav +0 -0
  167. data/spec/data/audio/king_nonviolence.wma +0 -0
  168. data/spec/data/audio/top_gun_secret.aac +0 -0
  169. data/spec/data/audio/top_gun_secret.ac3 +0 -0
  170. data/spec/data/audio/top_gun_secret.aiff +0 -0
  171. data/spec/data/audio/top_gun_secret.au +0 -0
  172. data/spec/data/audio/top_gun_secret.flac +0 -0
  173. data/spec/data/audio/top_gun_secret.m4a +0 -0
  174. data/spec/data/audio/top_gun_secret.mka +0 -0
  175. data/spec/data/audio/top_gun_secret.mp3 +0 -0
  176. data/spec/data/audio/top_gun_secret.ogg +0 -0
  177. data/spec/data/audio/top_gun_secret.ra +0 -0
  178. data/spec/data/audio/top_gun_secret.voc +0 -0
  179. data/spec/data/audio/top_gun_secret.wav +0 -0
  180. data/spec/data/audio/top_gun_secret.wma +0 -0
  181. data/spec/data/multipage.tif +0 -0
  182. data/spec/data/multipage.tif.jp2 +0 -0
  183. data/spec/data/test-ead.xml +0 -392
  184. data/spec/data/test-jpg.tif +0 -0
  185. data/spec/data/test-lzw.tif +0 -0
  186. data/spec/data/test-options.jpg +0 -0
  187. data/spec/data/test-options.png +0 -0
  188. data/spec/data/test.bmp +0 -0
  189. data/spec/data/test.doc +0 -0
  190. data/spec/data/test.docx +0 -0
  191. data/spec/data/test.gif +0 -0
  192. data/spec/data/test.jpg +0 -0
  193. data/spec/data/test.ods +0 -0
  194. data/spec/data/test.odt +0 -0
  195. data/spec/data/test.pdf +0 -0
  196. data/spec/data/test.pdf.tif +0 -0
  197. data/spec/data/test.png +0 -0
  198. data/spec/data/test.ps +0 -8631
  199. data/spec/data/test.psd +0 -0
  200. data/spec/data/test.rtf +0 -1455
  201. data/spec/data/test.tif +0 -0
  202. data/spec/data/test.txt +0 -12
  203. data/spec/data/test.xcf +0 -0
  204. data/spec/data/test.xls +0 -0
  205. data/spec/data/test.xlsx +0 -0
  206. data/spec/data/test.xml +0 -4
  207. data/spec/data/test_pdfa.pdf +0 -0
  208. data/spec/data/video/SampleVideo_1080x720_2mb.flv +0 -0
  209. data/spec/data/video/SampleVideo_1080x720_2mb.mkv +0 -0
  210. data/spec/data/video/SampleVideo_1080x720_2mb.mp4 +0 -0
  211. data/spec/data/video/SampleVideo_176x144_2mb.3gp +0 -0
  212. data/spec/data/video/SampleVideo_320x240_2mb.3gp +0 -0
  213. data/spec/data/video/SampleVideo_360x240_2mb.flv +0 -0
  214. data/spec/data/video/SampleVideo_360x240_2mb.mkv +0 -0
  215. data/spec/data/video/SampleVideo_360x240_2mb.mp4 +0 -0
  216. data/spec/data/video/copyright.png +0 -0
  217. data/spec/data/xml/134476_ead.XML +0 -1
  218. data/spec/data/xml/134476_ead.pdf +0 -0
  219. data/spec/data/xml/134476_fo.XML +0 -383
  220. data/spec/data/xml/134476_raw.XML +0 -141
  221. data/spec/data/xml/ead2fo_pdf.xsl +0 -1453
  222. data/spec/data/xml/header_nolink_pdf.xsl +0 -120
  223. data/spec/data/xml/lookupLists.xsl +0 -488
  224. data/spec/data/xml/scope_eadToHTML.xsl +0 -2376
  225. data/spec/data/xml/scope_xmlToEAD_dom.xsl +0 -952
  226. data/spec/identifier_spec.rb +0 -161
  227. data/spec/spec_helper.rb +0 -58
  228. data/spec/test_types.yml +0 -12
  229. data/spec/type_database_spec.rb +0 -140
  230. data/tools/bcpkix-jdk15on-1.49.jar +0 -0
  231. data/tools/bcprov-jdk15on-1.49.jar +0 -0
  232. data/tools/pdfbox/preflight-app-1.8.10.jar +0 -0
data/tools/fop/fop ADDED
@@ -0,0 +1,258 @@
1
+ #! /bin/sh
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ # Shell script to run FOP, adapted from the Jakarta-Ant project.
19
+
20
+ rpm_mode=true
21
+ fop_exec_args=
22
+ no_config=false
23
+ fop_exec_debug=false
24
+ show_help=false
25
+ for arg in "$@" ; do
26
+ if [ "$arg" = "--noconfig" ] ; then
27
+ no_config=true
28
+ elif [ "$arg" = "--execdebug" ] ; then
29
+ fop_exec_debug=true
30
+ elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then
31
+ show_help=true
32
+ fop_exec_args="$fop_exec_args -h"
33
+ else
34
+ if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then
35
+ show_help=true
36
+ fi
37
+ fop_exec_args="$fop_exec_args \"$arg\""
38
+ fi
39
+ done
40
+
41
+ # Source/default fop configuration
42
+ if $no_config ; then
43
+ rpm_mode=false
44
+ else
45
+ # load system-wide fop configuration
46
+ if [ -f "/etc/fop.conf" ] ; then
47
+ . /etc/fop.conf
48
+ fi
49
+
50
+ # load user fop configuration
51
+ if [ -f "$HOME/.fop/fop.conf" ] ; then
52
+ . $HOME/.fop/fop.conf
53
+ fi
54
+ if [ -f "$HOME/.foprc" ] ; then
55
+ . "$HOME/.foprc"
56
+ fi
57
+
58
+ # provide default configuration values
59
+ if [ -z "$rpm_mode" ] ; then
60
+ rpm_mode=false
61
+ fi
62
+ if [ -z "$usejikes" ] ; then
63
+ usejikes=$use_jikes_default
64
+ fi
65
+ fi
66
+
67
+ # Setup Java environment in rpm mode
68
+ if $rpm_mode ; then
69
+ if [ -f /usr/share/java-utils/java-functions ] ; then
70
+ . /usr/share/java-utils/java-functions
71
+ set_jvm
72
+ set_javacmd
73
+ fi
74
+ fi
75
+
76
+ # OS specific support. $var _must_ be set to either true or false.
77
+ cygwin=false;
78
+ darwin=false;
79
+ case "`uname`" in
80
+ CYGWIN*) cygwin=true ;;
81
+ Darwin*) darwin=true
82
+ if [ -z "$JAVA_HOME" ] ; then
83
+ if [ -x '/usr/libexec/java_home' ] ; then
84
+ JAVA_HOME=`/usr/libexec/java_home`
85
+ elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
86
+ JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
87
+ fi
88
+ fi
89
+ ;;
90
+ esac
91
+
92
+ if [ -z "$FOP_HOME" -o ! -d "$FOP_HOME" ] ; then
93
+ ## resolve links - $0 may be a link to fop's home
94
+ PRG="$0"
95
+ progname=`basename "$0"`
96
+
97
+ # need this for relative symlinks
98
+ while [ -h "$PRG" ] ; do
99
+ ls=`ls -ld "$PRG"`
100
+ link=`expr "$ls" : '.*-> \(.*\)$'`
101
+ if expr "$link" : '/.*' > /dev/null; then
102
+ PRG="$link"
103
+ else
104
+ PRG=`dirname "$PRG"`"/$link"
105
+ fi
106
+ done
107
+
108
+ FOP_HOME=`dirname "$PRG"`
109
+
110
+ # make it fully qualified
111
+ FOP_HOME=`cd "$FOP_HOME" && pwd`
112
+ fi
113
+
114
+ # For Cygwin, ensure paths are in UNIX format before anything is touched
115
+ if $cygwin ; then
116
+ [ -n "$FOP_HOME" ] &&
117
+ FOP_HOME=`cygpath --unix "$FOP_HOME"`
118
+ [ -n "$JAVA_HOME" ] &&
119
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
120
+ fi
121
+
122
+ if [ "$OS" = "Windows_NT" ] ; then
123
+ pathSepChar=";"
124
+ else
125
+ pathSepChar=":"
126
+ fi
127
+
128
+ if [ -z "$JAVACMD" ] ; then
129
+ if [ -n "$JAVA_HOME" ] ; then
130
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
131
+ # IBM's JDK on AIX uses strange locations for the executables
132
+ JAVACMD="$JAVA_HOME/jre/sh/java"
133
+ else
134
+ JAVACMD="$JAVA_HOME/bin/java"
135
+ fi
136
+ else
137
+ JAVACMD=`which java 2> /dev/null `
138
+ if [ -z "$JAVACMD" ] ; then
139
+ JAVACMD=java
140
+ fi
141
+ fi
142
+ fi
143
+
144
+ if [ ! -x "$JAVACMD" ] ; then
145
+ echo "Error: JAVA_HOME is not defined correctly."
146
+ echo " We cannot execute $JAVACMD"
147
+ exit 1
148
+ fi
149
+
150
+ if [ -n "$CLASSPATH" ] ; then
151
+ LOCALCLASSPATH=$CLASSPATH
152
+ fi
153
+
154
+ # add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
155
+ LOCALCLASSPATH=${FOP_HOME}/build/fop.jar${pathSepChar}${FOP_HOME}/build/fop-sandbox.jar${pathSepChar}${FOP_HOME}/build/fop-hyph.jar${pathSepChar}$LOCALCLASSPATH
156
+
157
+ # add in the dependency .jar files, which reside in $FOP_HOME/lib
158
+ OLD_IFS=$IFS
159
+ IFS="
160
+ "
161
+ DIRLIBS=${FOP_HOME}/*/*.jar
162
+ for i in ${DIRLIBS}
163
+ do
164
+ # if the directory is empty, then it will return the input string
165
+ # this is stupid, so case for it
166
+ if [ "$i" != "${DIRLIBS}" ] ; then
167
+ if [ -z "$LOCALCLASSPATH" ] ; then
168
+ LOCALCLASSPATH=$i
169
+ else
170
+ LOCALCLASSPATH="$i"${pathSepChar}$LOCALCLASSPATH
171
+ fi
172
+ fi
173
+ done
174
+ IFS=$OLD_IFS
175
+
176
+ # add in user-defined hyphenation JARs
177
+ if [ -n "$FOP_HYPHENATION_PATH" ] ; then
178
+ LOCALCLASSPATH=$LOCALCLASSPATH${pathSepChar}$FOP_HYPHENATION_PATH
179
+ fi
180
+
181
+ # For Cygwin, switch paths to appropriate format before running java
182
+ # For PATHs convert to unix format first, then to windows format to ensure
183
+ # both formats are supported. Probably this will fail on directories with ;
184
+ # in the name in the path. Let's assume that paths containing ; are more
185
+ # rare than windows style paths on cygwin.
186
+ if $cygwin; then
187
+ if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
188
+ format=mixed
189
+ else
190
+ format=windows
191
+ fi
192
+ FOP_HOME=`cygpath --$format "$FOP_HOME"`
193
+ LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"`
194
+ LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"`
195
+ if [ -n "$CLASSPATH" ] ; then
196
+ CP_TEMP=`cygpath --path --unix "$CLASSPATH"`
197
+ CLASSPATH=`cygpath --path --$format "$CP_TEMP"`
198
+ fi
199
+ CYGHOME=`cygpath --$format "$HOME"`
200
+ fi
201
+
202
+ # Show script help if requested
203
+ if $show_help ; then
204
+ fop_exec_args=""
205
+ echo $0 '[script options] [FOP options]'
206
+ echo 'Script Options:'
207
+ echo ' --help, -h print this message and FOP help'
208
+ echo ' --noconfig suppress sourcing of /etc/fop.conf,'
209
+ echo ' $HOME/.fop/fop.conf, and $HOME/.foprc'
210
+ echo ' configuration files'
211
+ echo ' --execdebug print FOP exec line generated by this'
212
+ echo ' launch script'
213
+ fi
214
+
215
+ # add a second backslash to variables terminated by a backslash under cygwin
216
+ if $cygwin; then
217
+ case "$FOP_HOME" in
218
+ *\\ )
219
+ FOP_HOME="$FOP_HOME\\"
220
+ ;;
221
+ esac
222
+ case "$CYGHOME" in
223
+ *\\ )
224
+ CYGHOME="$CYGHOME\\"
225
+ ;;
226
+ esac
227
+ case "$LOCALCLASSPATH" in
228
+ *\\ )
229
+ LOCALCLASSPATH="$LOCALCLASSPATH\\"
230
+ ;;
231
+ esac
232
+ case "$CLASSPATH" in
233
+ *\\ )
234
+ CLASSPATH="$CLASSPATH\\"
235
+ ;;
236
+ esac
237
+ fi
238
+
239
+ # The default commons logger for JDK1.4 is JDK1.4Logger.
240
+ # To use a different logger, uncomment the one desired below
241
+ # LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
242
+ # LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
243
+ # LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
244
+
245
+ # Logging levels
246
+ # Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
247
+ # To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties
248
+ # file instead.
249
+ # Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
250
+ # LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO
251
+
252
+ # Execute FOP using eval/exec to preserve spaces in paths,
253
+ # java options, and FOP args
254
+ fop_exec_command="exec \"$JAVACMD\" $LOGCHOICE $LOGLEVEL -classpath \"$LOCALCLASSPATH\" $FOP_OPTS org.apache.fop.cli.Main $fop_exec_args"
255
+ if $fop_exec_debug ; then
256
+ echo $fop_exec_command
257
+ fi
258
+ eval $fop_exec_command
data/tools/fop/fop.bat ADDED
@@ -0,0 +1,75 @@
1
+ @ECHO OFF
2
+ REM Licensed to the Apache Software Foundation (ASF) under one or more
3
+ REM contributor license agreements. See the NOTICE file distributed with
4
+ REM this work for additional information regarding copyright ownership.
5
+ REM The ASF licenses this file to You under the Apache License, Version 2.0
6
+ REM (the "License"); you may not use this file except in compliance with
7
+ REM the License. You may obtain a copy of the License at
8
+ REM
9
+ REM http://www.apache.org/licenses/LICENSE-2.0
10
+ REM
11
+ REM Unless required by applicable law or agreed to in writing, software
12
+ REM distributed under the License is distributed on an "AS IS" BASIS,
13
+ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ REM See the License for the specific language governing permissions and
15
+ REM limitations under the License.
16
+ REM $Id: fop.bat 1736993 2016-03-29 09:19:30Z ssteiner $
17
+
18
+ SETLOCAL ENABLEDELAYEDEXPANSION
19
+
20
+ rem %~dp0 is the expanded pathname of the current script under NT
21
+ set LOCAL_FOP_HOME=
22
+ if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME="%~dp0"
23
+
24
+ rem Code from Apache Ant project
25
+ rem Slurp the command line arguments. This loop allows for an unlimited number
26
+ rem of arguments (up to the command line limit, anyway).
27
+ rem Could also do a "shift" and "%*" for all params, but apparently doesn't work
28
+ rem with Win9x.
29
+ set FOP_CMD_LINE_ARGS=%1
30
+ if ""%1""=="""" goto doneStart
31
+ shift
32
+ :setupArgs
33
+ if ""%1""=="""" goto doneStart
34
+ set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
35
+ shift
36
+ goto setupArgs
37
+ rem This label provides a place for the argument list loop to break out
38
+ rem and for NT handling to skip to.
39
+ :doneStart
40
+
41
+ set LOGCHOICE=
42
+ rem The default commons logger for JDK1.4 is JDK1.4Logger.
43
+ rem To use a different logger, uncomment the one desired below
44
+ rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
45
+ rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
46
+ rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
47
+
48
+ set LOGLEVEL=
49
+ rem Logging levels
50
+ rem Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
51
+ rem To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%\JRE\LIB\logging.properties
52
+ rem file instead.
53
+ rem Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
54
+ rem set LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO
55
+
56
+ set LIBDIR=%LOCAL_FOP_HOME%lib
57
+
58
+ set LOCALCLASSPATH=%FOP_HYPHENATION_PATH%
59
+ for %%l in (%LOCAL_FOP_HOME%build\*.jar %LIBDIR%\*.jar %LOCAL_FOP_HOME%target\*.jar) do set LOCALCLASSPATH=!LOCALCLASSPATH!;%%l
60
+
61
+ set JAVAOPTS=-Denv.windir=%WINDIR%
62
+
63
+ if "%JAVA_HOME%" == "" goto noJavaHome
64
+ if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
65
+ if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
66
+ goto runFop
67
+
68
+ :noJavaHome
69
+ if "%JAVACMD%" == "" set JAVACMD=java
70
+
71
+ :runFop
72
+ rem echo "%JAVACMD%" %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
73
+ "%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" %FOP_OPTS% org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
74
+
75
+ ENDLOCAL
data/tools/fop/fop.cmd ADDED
@@ -0,0 +1,31 @@
1
+ @ECHO OFF
2
+ REM Licensed to the Apache Software Foundation (ASF) under one or more
3
+ REM contributor license agreements. See the NOTICE file distributed with
4
+ REM this work for additional information regarding copyright ownership.
5
+ REM The ASF licenses this file to You under the Apache License, Version 2.0
6
+ REM (the "License"); you may not use this file except in compliance with
7
+ REM the License. You may obtain a copy of the License at
8
+ REM
9
+ REM http://www.apache.org/licenses/LICENSE-2.0
10
+ REM
11
+ REM Unless required by applicable law or agreed to in writing, software
12
+ REM distributed under the License is distributed on an "AS IS" BASIS,
13
+ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ REM See the License for the specific language governing permissions and
15
+ REM limitations under the License.
16
+ REM $Id: fop.cmd 1734671 2016-03-12 05:39:53Z gadams $
17
+
18
+ set LOCAL_FOP_HOME=%~dp0
19
+ set FOP_CMD_LINE_ARGS=%1
20
+ if ""%1""=="""" goto doneStart
21
+ shift
22
+ :setupArgs
23
+ if ""%1""=="""" goto doneStart
24
+ set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
25
+ shift
26
+ goto setupArgs
27
+ rem This label provides a place for the argument list loop to break out
28
+ :doneStart
29
+
30
+ call "%LOCAL_FOP_HOME%\fop.bat" %FOP_CMD_LINE_ARGS%
31
+
data/tools/fop/fop.js ADDED
@@ -0,0 +1,341 @@
1
+ // Licensed to the Apache Software Foundation (ASF) under one or more
2
+ // contributor license agreements. See the NOTICE file distributed with
3
+ // this work for additional information regarding copyright ownership.
4
+ // The ASF licenses this file to You under the Apache License, Version 2.0
5
+ // (the "License"); you may not use this file except in compliance with
6
+ // the License. You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ // $Id: fop.js 1734671 2016-03-12 05:39:53Z gadams $ -->
16
+
17
+ // jscript to run FOP, adapted from the Jakarta-Ant project.
18
+
19
+ // rpm_mode is irrelevant on Windows
20
+ // var rpm_mode=true;
21
+ var fop_exec_args = "";
22
+ var no_config=false;
23
+ var fop_exec_debug=false;
24
+ var debug=false;
25
+ var keep_open=false;
26
+ var show_help=false;
27
+
28
+ var config_wanted = new Array("FOP_HOME", "CLASSPATH", "FOP_HYPHENATION_PATH", "FOP_OPTS", "JAVA_OPTS", "LOGCHOICE", "LOGLEVEL");
29
+
30
+ // parse command-line arguments
31
+ function read_args() {
32
+ var args = WScript.Arguments;
33
+ var named = new ActiveXObject("Scripting.Dictionary");
34
+ for (i = 0; i < args.length; i++) {
35
+ switch(args(i)) {
36
+ case "--debug":
37
+ debug=true;
38
+ break;
39
+ case "--execdebug":
40
+ fop_exec_debug=true;
41
+ break;
42
+ case "--keepopen":
43
+ keep_open=true;
44
+ break;
45
+ case "--noconfig":
46
+ no_config=true;
47
+ break;
48
+ case "-h":
49
+ case "--help":
50
+ case "--h":
51
+ case "-help":
52
+ show_help=true;
53
+ // fop_exec_args=fop_exec_args + " -h";
54
+ break;
55
+ default:
56
+ fop_exec_args=fop_exec_args + " " + args(i);
57
+ }
58
+ }
59
+ if (debug) {
60
+ WScript.Echo("debug: " + debug);
61
+ WScript.Echo("execdebug: " + fop_exec_debug);
62
+ WScript.Echo("keepopen: " + keep_open);
63
+ WScript.Echo("noconfig: " + no_config);
64
+ WScript.Echo("help: " + show_help);
65
+ WScript.Echo("fop arguments: " + fop_exec_args);
66
+ }
67
+ }
68
+
69
+ var help_text="Usage:\n"
70
+ + WScript.ScriptFullName + " [script options] [FOP options]\n"
71
+ + "Script Options:\n"
72
+ + " --help, -h print this message and FOP help\n"
73
+ + " --debug print debugging information for this launch script\n"
74
+ + " --execdebug print FOP exec line generated by this launch script\n"
75
+ + " --keepopen keep FOP's command window open\n"
76
+ + " --noconfig suppress reading of configuration file and registry";
77
+
78
+ function read_environment() {
79
+ for (i in config_wanted) {
80
+ if (!config.Exists(config_wanted[i])) {
81
+ var env_var_string = "%" + config_wanted[i] + "%";
82
+ var env_var = shell.ExpandEnvironmentStrings(env_var_string);
83
+ if (env_var != "" && env_var != env_var_string) {
84
+ config.Add(config_wanted[i], env_var);
85
+ if (debug) {
86
+ WScript.Echo(config_wanted[i] + " env: "
87
+ + config.Item(config_wanted[i]));
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ function read_desktop(dtname) {
95
+ if (fs.FolderExists(dtname)) {
96
+ var fopname = fs.GetFolder(dtname).ParentFolder.Path
97
+ + "\\Application Data\\Fop";
98
+ if (fs.FolderExists(fopname)) {
99
+ var fop_conf_name = fs.GetFolder(fopname).Path + "\\fop.conf";
100
+ if (fs.FileExists(fop_conf_name)) {
101
+ // source fop_conf_file
102
+ var conf_file = fs.openTextFile(fs.GetFile(fop_conf_name));
103
+ var conf_lines = new ActiveXObject("Scripting.Dictionary");
104
+ while (!conf_file.AtEndOfStream) {
105
+ var line = conf_file.ReadLine();
106
+ var m = line.match(/(.+?)=(.+)/);
107
+ if (m != null) {
108
+ conf_lines.Add(m[1], m[2]);
109
+ }
110
+ }
111
+ for (j in config_wanted) {
112
+ if (!config.Exists(config_wanted[j])
113
+ && conf_lines.Exists(config_wanted[j])) {
114
+ config.Add(config_wanted[j], conf_lines.Item(config_wanted[j]));
115
+ if (debug) {
116
+ WScript.Echo(config_wanted[j] + " " + dts[i] + ": "
117
+ + config.Item(config_wanted[i]));
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ function read_registry(section) {
127
+ for (j in config_wanted) {
128
+ if (!config.Exists(config_wanted[j])) {
129
+ var reg_var;
130
+ try {
131
+ reg_var = shell.RegRead(section + "\\Software\\Fop\\"
132
+ + config_wanted[j]);
133
+ config.Add(config_wanted[j], reg_var);
134
+ if (debug) {
135
+ WScript.Echo(config_wanted[j] + " " + rks[i] + ": "
136
+ + config.Item(config_wanted[j]));
137
+ }
138
+ } catch(e) {}
139
+ }
140
+ }
141
+ }
142
+
143
+ // construct FOP_HOME from the script folder
144
+ function get_fop_home() {
145
+ if (!config.Exists("FOP_HOME")
146
+ || !fs.FolderExists(config.Item("FOP_HOME"))) {
147
+ var fop_home = WScript.ScriptFullName;
148
+ fop_home = fop_home.substring(0, fop_home.length
149
+ - WScript.ScriptName.length - 1);
150
+ if (config.Exists("FOP_HOME")) {
151
+ config.Remove("FOP_HOME");
152
+ }
153
+ config.Add("FOP_HOME", fop_home);
154
+ if (debug) {
155
+ WScript.Echo("FOP_HOME dyn: " + config.Item("FOP_HOME"));
156
+ }
157
+ }
158
+ }
159
+
160
+ function get_java_cmd() {
161
+ var java_home = shell.ExpandEnvironmentStrings("%JAVA_HOME%");
162
+ javacmd = "java";
163
+ if (java_home != "" && typeof(java_home) != "undefined"
164
+ && fs.FolderExists(java_home)) {
165
+ var javacmd_candidate = java_home + "\\bin\\java.exe";
166
+ if (fs.FileExists(javacmd_candidate)) {
167
+ javacmd = javacmd_candidate;
168
+ }
169
+ }
170
+ if (debug) {
171
+ WScript.Echo("java command: " + javacmd);
172
+ }
173
+ }
174
+
175
+ function get_local_classpath() {
176
+ if (config.Exists("CLASSPATH")) {
177
+ local_classpath = config.Item("CLASSPATH");
178
+ if (debug) {
179
+ WScript.Echo("local classpath: " + local_classpath);
180
+ }
181
+ }
182
+
183
+ // add fop.jar, fop-sandbox and fop-hyph.jar, which reside in $FOP_HOME/build
184
+ var lcp = local_classpath;
185
+ local_classpath = config.Item("FOP_HOME") + "\\build\\fop.jar;"
186
+ + config.Item("FOP_HOME") + "\\build\\fop-sandbox.jar;"
187
+ + config.Item("FOP_HOME") + "\\build\\fop-hyph.jar";
188
+ if (lcp != "") {
189
+ local_classpath += ";" + lcp;
190
+ }
191
+ if (debug) {
192
+ WScript.Echo("local classpath: " + local_classpath);
193
+ }
194
+
195
+ // add in the dependency .jar files, which reside in $FOP_HOME/lib
196
+ var libdir_name = config.Item("FOP_HOME") + "\\lib";
197
+ var dirlibs;
198
+ if (fs.FolderExists(libdir_name)) {
199
+ dirlibs = fs.GetFolder(libdir_name).Files;
200
+ var e = new Enumerator(dirlibs);
201
+ for (; !e.atEnd(); e.moveNext()) {
202
+ if (e.item().Name.match("\.jar$")) {
203
+ local_classpath = libdir_name + "\\" + e.item().Name + ";" + local_classpath;
204
+ }
205
+ }
206
+ if (debug) {
207
+ WScript.Echo("local classpath: " + local_classpath);
208
+ }
209
+ }
210
+
211
+ // add in user-defined hyphenation JARs
212
+ if (config.Exists("FOP_HYPHENATION_PATH")) {
213
+ local_classpath += ";" + config.Item("FOP_HYPHENATION_PATH");
214
+ if (debug) {
215
+ WScript.Echo("local classpath: " + local_classpath);
216
+ }
217
+ }
218
+ }
219
+
220
+ // Execute fop via shell.Exec
221
+ function fop_exec() {
222
+ var fop_exec_command = "\"" + javacmd + "\" "
223
+ + (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"")
224
+ + (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"")
225
+ + (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"")
226
+ + "-classpath \"" + local_classpath + "\" "
227
+ + (config.Exists("FOP_OPTS")?config.Item("FOP_OPTS"):"")
228
+ + "org.apache.fop.cli.Main " + fop_exec_args;
229
+ if (debug || fop_exec_debug) {
230
+ WScript.Echo(fop_exec_command);
231
+ }
232
+
233
+ var fop_run = shell.Exec(fop_exec_command);
234
+ while (true) {
235
+ while (!fop_run.StdOut.AtEndOfStream) {
236
+ WScript.Echo(fop_run.StdOut.ReadLine());
237
+ }
238
+ while (!fop_run.StdErr.AtEndOfStream) {
239
+ WScript.Echo(fop_run.StdErr.ReadLine());
240
+ }
241
+ if (fop_run.Status == 1) {
242
+ break;
243
+ }
244
+ WScript.Sleep(100);
245
+ }
246
+ if (debug) {
247
+ WScript.Echo("exit status: " + fop_run.ExitCode);
248
+ }
249
+ }
250
+
251
+ // Execute fop via shell.Run
252
+ function fop_run() {
253
+ var fop_exec_command = "cmd /" + (keep_open?"K":"C") + " \""
254
+ + "\"" + javacmd + "\" "
255
+ + (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"")
256
+ + (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"")
257
+ + (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"")
258
+ + "-classpath \"" + local_classpath + "\" "
259
+ + (config.Exists("FOP_OPTS")?config.Item("FOP_OPTS") + " ":"")
260
+ + "org.apache.fop.cli.Main " + fop_exec_args + "\"";
261
+ if (debug || fop_exec_debug) {
262
+ WScript.Echo(fop_exec_command);
263
+ }
264
+ var exit_code = shell.Run(fop_exec_command, 1, 1);
265
+ if (debug) {
266
+ WScript.Echo("exit status: " + exit_code);
267
+ } else {
268
+ if (exit_code != 0) {
269
+ WScript.Echo("A FOP error occurred (FOP exit status: " + exit_code + ")\n"
270
+ + "Use option --keepopen to see FOP's output\n"
271
+ + "(that is two dashes)");
272
+ }
273
+ }
274
+ }
275
+
276
+ function get_log_choice() {
277
+ // The default commons logger for JDK1.4 is JDK1.4Logger.
278
+ // To use a different logger, uncomment the one desired below
279
+ if (!config.Exists("LOGCHOICE")) {
280
+ // config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog\"");
281
+ // config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog\"");
282
+ // config.Add("LOGCHOICE","\"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger\"");
283
+ if (debug && config.Exists("LOGCHOICE")) {
284
+ WScript.Echo("LOGCHOICE script: " + config.Item("LOGCHOICE"));
285
+ }
286
+ }
287
+ }
288
+
289
+ function get_log_level() {
290
+ // Logging levels
291
+ // Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
292
+ // To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties
293
+ // file instead.
294
+ // Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
295
+ if (!config.Exists("LOGLEVEL")) {
296
+ // config.Add("LOGLEVEL","\"-Dorg.apache.commons.logging.simplelog.defaultlog=INFO\"");
297
+ if (debug && config.Exists("LOGLEVEL")) {
298
+ WScript.Echo("LOGLEVEL script: " + config.Item("LOGLEVEL"));
299
+ }
300
+ }
301
+ }
302
+
303
+ var shell = WScript.CreateObject("WScript.Shell");
304
+ var fs = WScript.CreateObject("Scripting.FileSystemObject");
305
+
306
+ // configuration
307
+ var config = new ActiveXObject("Scripting.Dictionary");
308
+
309
+ read_args();
310
+ read_environment();
311
+ if (!no_config) {
312
+ // read user and system-wide fop configurations
313
+ var spec = shell.SpecialFolders;
314
+ var dts = new Array("Desktop", "AllUsersDesktop");
315
+ for (i in dts) {
316
+ read_desktop(spec(dts[i]));
317
+ }
318
+ // read user and system-wide registry
319
+ var rks = new Array("HKCU", "HKLM");
320
+ for (i in rks) {
321
+ read_registry(rks[i]);
322
+ }
323
+ }
324
+
325
+ get_fop_home();
326
+ get_log_choice();
327
+ get_log_level();
328
+ var javacmd = "";
329
+ get_java_cmd();
330
+ var local_classpath = "";
331
+ get_local_classpath();
332
+
333
+ // Show script help if requested
334
+ if (show_help) {
335
+ // fop_exec_args = "";
336
+ keep_open = true;
337
+ WScript.Echo(help_text);
338
+ }
339
+
340
+ // fop_exec();
341
+ fop_run();