Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ Suppose you have a directory `my_resource_dir` with the following contents:
- `reference_style.csl`
- `template.tex`

`template.tex` and any input files can refer to files in `resource_dir`, for example
by using `\includegraphics{extra/my_resource_dir/img/cover_page_background.png}`.
`template.tex` and any input files can refer to files in `my_resource_dir`, for example
by using `\includegraphics{img/cover_page_background.png}`.

You can then run the following:

```sh
./docker_run \
--extra_resource_dir path/to/my_resource_dir \
--template extra/my_resource_dir/template.tex \
--reference_doc extra/my_resource_dir/reference_doc.docx \
--csl extra/my_resource_dir/reference_style.csl \
--resourcedir my_resource_dir \
--template /my_resource_dir/template.tex" \
--reference_doc /my_resource_dir/reference_doc.docx" \
--csl /my_resource_dir/reference_style.csl \
--pdf output.pdf \
input.tcg
```
Expand All @@ -98,10 +98,10 @@ To render a document to HTML:

```sh
./docker_run \
--extra_resource_dir path/to/my_resource_dir \
--template_html extra/my_resource_dir/html.template \
--html_stylesheet extra/my_resource_dir/style1.css \
--html_stylesheet extra/my_resource_dir/style2.css \
--resourcedir my_resource_dir \
--template_html /my_resource_dir/html.template \
--html_stylesheet /my_resource_dir/style1.css \
--html_stylesheet /my_resource_dir/style2.css \
--html output.html \
input.tcg
```
12 changes: 6 additions & 6 deletions docker_run
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ if test "${1}" == "--help"; then
exit 0
fi

EXTRA_RESOURCE_DIR=""
RESOURCE_DIR=""

declare -a pass_through_args=()

while [[ $# -gt 0 ]]; do
arg="$1"
case "$arg" in
--extra_resource_dir)
--resourcedir)
if [[ -n "$2" ]]; then
EXTRA_RESOURCE_DIR="$2"
RESOURCE_DIR="$2"
shift 2
else
echo "Error: Argument for $1 is missing" >&2
Expand All @@ -51,9 +51,9 @@ done

declare -a docker_run_args=("--workdir=/workspace" "--volume=$(pwd):/workspace")

if [[ -n "${EXTRA_RESOURCE_DIR}" && -d "${EXTRA_RESOURCE_DIR}" ]]; then
dir=$(basename "${EXTRA_RESOURCE_DIR}")
docker_run_args+=("--volume=${EXTRA_RESOURCE_DIR}:/extra_resources/${dir}")
if [[ -n "${RESOURCE_DIR}" && -d "${RESOURCE_DIR}" ]]; then
docker_run_args+=("--volume=$(realpath ${RESOURCE_DIR}):/${RESOURCE_DIR}")
docker_container_args+=("--resourcedir=/${RESOURCE_DIR}")
fi

echo "Launching Container: ${docker_image}"
Expand Down