#!/bin/bash # converts aqoaba markdown into tex # TODO # - [ ] formatting scripture https://tex.stackexchange.com/a/652451/264579 # - [ ] do I even need mutliple verse environments? USAGE="""USAGE: $(basename $0) markdown-file""" if [ $# -ne 1 ] ; then echo "$USAGE" && exit 1; fi INFILE=$1 # remove any suffix https://stackoverflow.com/a/36341390 BASENAME=$( basename "${INFILE%.*}" ) DIRNAME=$( dirname "$INFILE" ) #echo $BASENAME #echo $DIRNAME KEEP_TMP_FILES=0 #set -x #set -e # # TODO # check if same number of paragraphs? # convert md to html pandoc --wrap=none -f markdown $DIRNAME/${BASENAME}.md -t html -o ${BASENAME}.html # convert html to tex # check if on linux or macos if [[ $(uname) == "Linux" ]] then SED_CMD="sed -i" elif [[ $(uname) == "Darwin" ]] then SED_CMD="sed -i ''" fi #$SED_CMD 's@
@\n\\pstart\n@' ${BASENAME}.html #$SED_CMD 's@
@\n\\pend@' ${BASENAME}.html $SED_CMD 's@@\n\\pend\\pstart\n@' ${BASENAME}.html $SED_CMD 's@
@@' ${BASENAME}.html $SED_CMD 's@“@\\enquote{@g' ${BASENAME}.html $SED_CMD 's@”@}@g' ${BASENAME}.html $SED_CMD 's@