md2verse.sh write to stdout

This commit is contained in:
uni@bor.mac 2024-10-01 15:51:29 +02:00
parent 4d9e23a11f
commit e43bad85b5

View File

@ -1,8 +1,8 @@
#!/bin/bash
# converts akoaba markdown into tex
# converts aqoaba markdown into tex
# TODO
# - formatting scripture https://tex.stackexchange.com/a/652451/264579
# - do I even need mutliple verse environments?
# - [ ] 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
@ -11,29 +11,6 @@ INFILE=$1
BASENAME=$(basename "${INFILE%.*}")
KEEP_TMP_FILES=0
###############
# OLD VERSION #
###############
## translate from pandoc md to latex
#pandoc \
# -f markdown \
# ${bname}.md \
# -t latex \
# -o ${bname}.tmp1
## repurpose headings and verbatim
#sed \
# -e "s/subsection/attrib/" \
# -e "s/section/poemtitle/" \
# -e "s/verbatim/verse/" \
# ${bname}.tmp1 \
# > ${bname}.tex
## insert verse into empty lines
###################
# SECOND VERSION #
###################
sed \
's/^$/\\end{verse}\
\
@ -58,11 +35,15 @@ pandoc \
-t latex \
-o ${BASENAME}.tmp4
# --wrap=preserve \
#sed \
# -e "s/subsection/attrib/" \
# -e "s/section/poemtitle/" \
# ${BASENAME}.tmp4 \
# > ${BASENAME}.tex
sed \
-e "s/subsection/attrib/" \
-e "s/section/poemtitle/" \
${BASENAME}.tmp4 \
> ${BASENAME}.tex
${BASENAME}.tmp4
if ! [[ $KEEP_TMP_FILES -gt 0 ]]
then