-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix conversion from ALTO to PAGE and vice versa #106
Changes from all commits
3405ffb
31e97e6
0643c13
6505a88
06d037e
18dd27b
7332869
8228c4c
d1c4477
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ show_version () { | |
main () { | ||
local from="$1" to="$2" infile='-' outfile='-' transformer | ||
shift 2 | ||
declare -a script_args | ||
|
||
# Validate parameters | ||
if [[ -z "$from" ]];then | ||
|
@@ -50,6 +49,8 @@ main () { | |
fi | ||
fi | ||
|
||
declare -a script_args | ||
|
||
# <infile> | ||
if [[ "$1" == '--' ]];then | ||
script_args+=("${@:2}") | ||
|
@@ -86,8 +87,7 @@ main () { | |
[[ "$outfile" != '-' ]] && script_args=("${script_args[@]}" "-o:$outfile") | ||
exec_saxon "${script_args[@]}" | ||
else | ||
script_args=("${script_args[@]}" "$infile") | ||
script_args=("${script_args[@]}" "$outfile") | ||
script_args=("$infile" "$outfile" "${script_args[@]}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is reverse sorted then before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is now sorted as described in script/transform/README.md. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was wrong before, weird we never noticed this... |
||
"$transformer" "${script_args[@]}" | ||
fi | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alto__page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
#!/bin/bash -x | ||
#!/bin/bash | ||
|
||
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
VENDORDIR="$(cd $SCRIPTDIR/../../vendor/; pwd)" | ||
JAR="$VENDORDIR/JPageConverter/PageConverter.jar" | ||
INFILE="$1" | ||
OUTFILE="$2" | ||
ARGUMENT="$3" | ||
|
||
if [[ "$1" = "-" ]]; then | ||
INFILE="$(mktemp)" | ||
cat >"$INFILE" | ||
fi | ||
|
||
is_temp= | ||
if [[ "$2" = "-" ]];then | ||
is_temp=true | ||
if [[ "$2" = "-" ]]; then | ||
OUTFILE="$(mktemp)" | ||
fi | ||
|
||
java -jar "$JAR" -neg-coords toZero -source-xml "$INFILE" -target-xml "$OUTFILE" | ||
java -jar "$JAR" -neg-coords toZero -source-xml "$INFILE" -target-xml "$OUTFILE" 2>&1 | ||
|
||
if [[ "$1" = "-" ]]; then | ||
rm "$INFILE" | ||
fi | ||
|
||
if [[ "$is_temp" = true ]];then | ||
cat "$OUTFILE" | ||
if [[ "$2" = "-" ]]; then | ||
if [[ -z "$ARGUMENT" ]]; then | ||
cat "$OUTFILE" | ||
else | ||
java -cp "$VENDORDIR/saxon9he.jar" net.sf.saxon.Query -s:"$OUTFILE" -qs:/ "$ARGUMENT" | ||
fi | ||
rm "$OUTFILE" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alto__page |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alto__page |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
VENDORDIR="$(cd $SCRIPTDIR/../../vendor/; pwd)" | ||
JAR="$VENDORDIR/JPageConverter/PageConverter.jar" | ||
INFILE="$1" | ||
OUTFILE="$2" | ||
ARGUMENT="$3" | ||
|
||
if [[ "$1" = "-" ]]; then | ||
INFILE="$(mktemp)" | ||
cat >"$INFILE" | ||
fi | ||
|
||
if [[ "$2" = "-" ]]; then | ||
OUTFILE="$(mktemp)" | ||
fi | ||
|
||
java -jar "$JAR" -neg-coords toZero -source-xml "$INFILE" -target-xml "$OUTFILE" -convert-to ALTO 2>&1 | ||
|
||
if [[ "$1" = "-" ]]; then | ||
rm "$INFILE" | ||
fi | ||
|
||
if [[ "$2" = "-" ]]; then | ||
if [[ -z "$ARGUMENT" ]]; then | ||
cat "$OUTFILE" | ||
else | ||
java -cp "$VENDORDIR/saxon9he.jar" net.sf.saxon.Query -s:"$OUTFILE" -qs:/ "$ARGUMENT" | ||
fi | ||
rm "$OUTFILE" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move that line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simply wanted to have it close to the first use of
script_args
.