Last active
October 27, 2020 17:05
-
-
Save apraga/eef5eef87da40429945fa6e68986aee7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert SIDES conf from pdf to orgmode | |
# Needs some manual adujst sometimes | |
# | |
set -euo pipefail | |
echo $1 | |
out=$(basename $1 ".pdf")".org" | |
pdftotext -layout $1 $out | |
sed -i 's/^\s* Q/** Q/' $out #Create subheadings | |
sed -i 's/^\s* Q/** Q/' $out #Create subheadings | |
sed -i '/^$/d' $out #No empty lines | |
sed -i '/^\s\+$/d' $out #No empty lines | |
sed -i '/^\s*multiples$/d' $out # QRM | |
sed -i 's/Question à réponses$/QRM/' $out | |
sed -i '/^\s*unique$/d' $out # QRU | |
sed -i 's/Question à réponse$/QRU/' $out | |
sed -i 's/^\s*\([A-E]\)-\s\+/\1. [ ] /' $out # items | |
# TODO: multiline items can be replaced with something like | |
#%s/^\s{9}\(.*\)\n\s+\([A-E]\)-\n\s+/\2. [ ]\1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment