Skip to content

Instantly share code, notes, and snippets.

@is-hoku
Last active November 9, 2021 06:34
Show Gist options
  • Save is-hoku/f8b57b2839e17f0c297c698ea80d4f6d to your computer and use it in GitHub Desktop.
Save is-hoku/f8b57b2839e17f0c297c698ea80d4f6d to your computer and use it in GitHub Desktop.
コンピュータ工学やエンジニアリングデザインなどの授業で、マークダウンでレポートを書いて docx ファイルにするスクリプト。 (usage) md2docx [config.sh で書いた授業名] [変換する .md ファイル]
#!/bin/bash
case $1 in
nktk)
REFERENCE=~/Documents/nktk/template.docx
BASE_DIR=~/Documents/nktk
;;
endz)
REFERENCE=~/Documents/engineering_design/template.docx
BASE_DIR=~/Documents/engineering_design
;;
esac
#!/bin/bash
CONFIG_DIR=~/bin
source "${CONFIG_DIR:?}/config.sh" "$1"
OUTPUT_FILE=`echo $2 | sed 's/\.[^\.]*$/.docx/'`
pandoc ${BASE_DIR}/$2 --from=markdown --to=docx --standalone --reference-doc=$REFERENCE --output=$OUTPUT_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment