diff --git a/md2parallel.sh b/md2parallel.sh index 3f225a8..34565e1 100755 --- a/md2parallel.sh +++ b/md2parallel.sh @@ -23,16 +23,24 @@ KEEP_TMP_FILES=0 # convert md to html pandoc --wrap=none -f markdown $DIRNAME/${BASENAME}.md -t html -o ${BASENAME}.html # convert html to tex -#sed -i '' 's@

@\n\\pstart\n@' ${BASENAME}.html -#sed -i '' 's@

@\n\\pend@' ${BASENAME}.html -sed -i '' 's@

@\n\\pend\\pstart\n@' ${BASENAME}.html -sed -i '' 's@

@@' ${BASENAME}.html -sed -i '' 's@“@\\enquote{@g' ${BASENAME}.html -sed -i '' 's@”@}@g' ${BASENAME}.html -sed -i '' 's@@\\section[@' ${BASENAME}.html -sed -i '' 's@@]@' ${BASENAME}.html -sed -i '' 's@@{@' ${BASENAME}.html -sed -i '' 's@@}@' ${BASENAME}.html -sed -i '' "s@’@'@g" ${BASENAME}.html +# 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@@\\section[@' ${BASENAME}.html +$SED_CMD 's@@]@' ${BASENAME}.html +$SED_CMD 's@@{@' ${BASENAME}.html +$SED_CMD 's@@}@' ${BASENAME}.html +$SED_CMD "s@’@'@g" ${BASENAME}.html mv ${BASENAME}.html ${BASENAME}.tex cat ${BASENAME}.tex && rm ${BASENAME}.tex