From 9a073d0ba3a075181fd8ae17e927d76374e12527 Mon Sep 17 00:00:00 2001 From: Erin Schnabel Date: Tue, 5 Nov 2024 09:16:43 -0500 Subject: [PATCH] undo fix-docx. Use template for docx instead --- Dockerfile | 1 - fix-document.sh | 50 ------------------------------------------------- 2 files changed, 51 deletions(-) delete mode 100755 fix-document.sh diff --git a/Dockerfile b/Dockerfile index 9fd90f4..438b7d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,6 @@ RUN tlmgr update --self \ && luaotfload-tool --update \ && chmod o+w /opt/texlive/texdir/texmf-var - COPY fix-document.sh /fix-document.sh COPY fonts/Figtree,IBM_Plex_Mono,IBM_Plex_Sans.zip /tmp RUN mkdir -p /tmp/fonts \ && mkdir -p /usr/local/share/fonts \ diff --git a/fix-document.sh b/fix-document.sh deleted file mode 100755 index 61ceac6..0000000 --- a/fix-document.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Check if the correct number of arguments is provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -DOCX_FILE=$(readlink -f $1) -FILE_TO_INSERT=$(readlink -f $2) - -# Check if the provided .docx file exists -if [ ! -f "$DOCX_FILE" ]; then - echo "Error: File $DOCX_FILE not found!" - exit 1 -fi - -# Check if the file to insert exists -if [ ! -f "$FILE_TO_INSERT" ]; then - echo "Error: File $FILE_TO_INSERT not found!" - exit 1 -fi - -echo "DOCX_FILE: $DOCX_FILE" -echo "FILE_TO_INSERT: $FILE_TO_INSERT" - -TEMP_DIR=$(mktemp -d) - -# Unzip the .docx file -unzip -q "$DOCX_FILE" -d "$TEMP_DIR" - -# Insert the contents of the specified file into document.xml -DOCUMENT_XML="$TEMP_DIR/word/document.xml" -if [ ! -f "$DOCUMENT_XML" ]; then - echo "Error: document.xml not found in the .docx file!" - exit 1 -fi - -sed -e 's|w:document |w:document\n|' $DOCUMENT_XML | sed -e "/ ${DOCUMENT_XML}.new -mv ${DOCUMENT_XML}.new $DOCUMENT_XML - -# Rezip the contents back into a .docx file -pushd "$TEMP_DIR" -zip -qr ${DOCX_FILE} * -popd - -# Clean up -rm -rf "$TEMP_DIR" - -echo "$DOCX_FILE modified" \ No newline at end of file