Skip to content

Commit

Permalink
Merge branch 'config'
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Nickum committed Dec 20, 2013
2 parents 716fc30 + ae634b6 commit 43ac00a
Show file tree
Hide file tree
Showing 57 changed files with 64 additions and 27 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ See [The FOP section on memory usage](http://xmlgraphics.apache.org/fop/1.1/runn
The final file structure before you run anything should look like this:

* empty.xml
* final_images (folder)
* final_xml (folder)
* input (folder)
* images (folder)
* xml (folder)
* lib (folder)
* fop (folder)
* saxon.jar
* README.txt
* run.sh
* saxon.jar
Expand Down Expand Up @@ -156,7 +158,7 @@ Step 2: Run Files

Command line instructions are below.

1: Place all files and images in final_xml and final_images, respectively
1: Place all files and images in input/xml and input/images, respectively

1b. Open a terminal and change directory (cd command) to the book creator root folder.

Expand Down
30 changes: 30 additions & 0 deletions config/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# locate saxon jar file
sax_jar=lib/saxon9he.jar

# locate FOP base directory
fop_lib=lib/fop-1.1

# additional options for FOP processing (sent to the java process)
# -d64: optimization for 64 bit processor
# -Xmx3000m: sets the maximum available memory allocation pool to 3000 MB
# Note: It's safe to leave this variable blank
fop_opts="-d64 -Xmx3000m"

# these variables shouldn't need to be changed, they are relative to fop_lib
fop_bin=${fop_lib}/fop
fop_conf=${fop_lib}/conf/fop.xconf

fo_obj=output/pdf.fo
pdf_obj=output/pdf.pdf

tei_xsl=lib/tei2pdf/TEIcorpus_producer.xsl
xslfo_xsl=lib/tei2pdf/xsl-fo-producer.xsl
init_xml=lib/tei2pdf/empty.xml
final_xml=output/Book_Corpus.xml

# further options that may be useful

# cleanup transitional files when finished
cleanup=true
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fop*
saxon*.jar
2 changes: 1 addition & 1 deletion lib/lib.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This folder is for holding the FOP Processor.
This folder is for holding the Saxon jar, FOP Processor, and internal library.
6 changes: 3 additions & 3 deletions TEIcorpus_producer.xsl → lib/tei2pdf/TEIcorpus_producer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
exclude-result-prefixes="#all">

<!-- =================================================================================
XSL to create a TEI Corpus file from the individual XML files in final_xml.
XSL to create a TEI Corpus file from the individual XML files in input/xml.
v.1 Created for Digital Humanities 2013 at the University of Nebraska-Lincoln by Karin Dalziel
Expand All @@ -20,7 +20,7 @@
<xsl:output indent="yes"/>

<!-- This is a wildly inefficient but convienent way to select documents -->
<xsl:variable name="files" select="collection('final_xml?recurse=yes;select=*.xml')"/>
<xsl:variable name="files" select="collection('../../input/xml?recurse=yes;select=*.xml')"/>

<!-- =================================================================================
Main Document Structure
Expand Down Expand Up @@ -316,4 +316,4 @@
</teiHeader>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>
File renamed without changes.
14 changes: 7 additions & 7 deletions xsl-fo-producer.xsl → lib/tei2pdf/xsl-fo-producer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:external-graphic
src="../../../final_images/front_cover.jpg"
src="../../../input/images/front_cover.jpg"
content-width="8.5in"
content-height="scale-to-fit"/>
</fo:block>
Expand Down Expand Up @@ -1175,7 +1175,7 @@
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:external-graphic
src="../../../final_images/back_cover.jpg"
src="../../../input/images/back_cover.jpg"
content-height="11in"
content-width="8.5in"/>
</fo:block>
Expand Down Expand Up @@ -1470,7 +1470,7 @@
<xsl:when test="graphic/@n='intro'">
<fo:block><xsl:call-template name="figure_container_intro"/>
<fo:external-graphic>
<xsl:attribute name="src"><xsl:text>../../../final_images/</xsl:text><xsl:value-of select="graphic/@url"/><xsl:text>.jpg</xsl:text></xsl:attribute>
<xsl:attribute name="src"><xsl:text>../../../input/images/</xsl:text><xsl:value-of select="graphic/@url"/><xsl:text>.jpg</xsl:text></xsl:attribute>
<xsl:call-template name="figure_intro"/>
</fo:external-graphic>

Expand All @@ -1479,7 +1479,7 @@
<xsl:otherwise>
<fo:block><xsl:call-template name="figure_container"/>
<fo:external-graphic>
<xsl:attribute name="src"><xsl:text>../../../final_images/</xsl:text><xsl:value-of select="graphic/@url"/><xsl:text>.jpg</xsl:text></xsl:attribute>
<xsl:attribute name="src"><xsl:text>../../../input/images/</xsl:text><xsl:value-of select="graphic/@url"/><xsl:text>.jpg</xsl:text></xsl:attribute>
<xsl:call-template name="figure"/>
</fo:external-graphic>
<fo:block><xsl:call-template name="figure_head"/><xsl:apply-templates select="head"/></fo:block>
Expand Down Expand Up @@ -1560,15 +1560,15 @@
<xsl:when test="$output = 'print'">
<fo:block><xsl:call-template name="figure_container_intro"/>
<fo:external-graphic>
<xsl:attribute name="src"><xsl:text>../../../final_images/logo_bw.jpg</xsl:text></xsl:attribute>
<xsl:attribute name="src"><xsl:text>../../../input/images/logo_bw.jpg</xsl:text></xsl:attribute>
<xsl:call-template name="figure_intro"/>
</fo:external-graphic>
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block><xsl:call-template name="figure_container_intro"/>
<fo:external-graphic>
<xsl:attribute name="src"><xsl:text>../../../final_images/logo_color.jpg</xsl:text></xsl:attribute>
<xsl:attribute name="src"><xsl:text>../../../input/images/logo_color.jpg</xsl:text></xsl:attribute>
<xsl:call-template name="figure_intro"/>
</fo:external-graphic>
</fo:block>
Expand All @@ -1580,4 +1580,4 @@



</xsl:stylesheet>
</xsl:stylesheet>
2 changes: 2 additions & 0 deletions output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
22 changes: 9 additions & 13 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#!/bin/bash

sax_jar=saxon.jar
fop_lib=./lib/fop
fop_bin=${fop_lib}/fop
fop_conf=${fop_lib}/conf/fop.xconf

fo_obj=pdf.fo
pdf_obj=pdf.pdf

tei_xsl=TEIcorpus_producer.xsl
xslfo_xsl=xsl-fo-producer.xsl
init_xml=empty.xml
final_xml=Book_Corpus.xml
if [[ -f 'config/config.sh' ]]; then
source config/config.sh
fi

java -jar "${sax_jar}" "${init_xml}" "${tei_xsl}" > "${final_xml}" && \
java -jar "${sax_jar}" "${final_xml}" "${xslfo_xsl}" > "${fo_obj}" && \
"${fop_bin}" -c "${fop_conf}" "${fo_obj}" "${pdf_obj}"
FOP_OPTS="${fop_opts}" "${fop_bin}" -c "${fop_conf}" "${fo_obj}" "${pdf_obj}"

if "$cleanup"; then
rm -f "${fo_obj}"
rm -f "${final_xml}"
fi
5 changes: 5 additions & 0 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

rm -f ../Book_Corpus.xml
rm -f ../pdf.fo
rm -f ../pdf.pdf

0 comments on commit 43ac00a

Please sign in to comment.