#!/bin/bash
. /home/me/.bashrc
cd /home/me/.local/share/jami/f5b2919877b9ddf2/conversations/27c4df046b23463fe4795065f5ca42f6bbd85ed5
git log --reverse --no-merges --encoding=utf-8 --pretty=format:"
*%ci:* **%cn:** %B ">/home/me/myjamistuff/raw.txt
cd /home/me/myjamistuff
cp raw.txt hacked.txt
# Add "UTC" to all timestamps in the files
sed -i 's| +0000:| (UTC)|g' hacked.txt
# Remove certain lines from the file that I don't want
sed -i '/{"mode":2,"type":"initial"}/d' hacked.txt
sed -i '/{"type":"application/d' hacked.txt
sed -i '/{"action":"add","type":"member","uri"/d' hacked.txt
sed -i '/{"action":"join","type":"member"/d' hacked.txt
sed -i '/","react-to":"/d' hacked.txt
sed -i '/"","edit":"/d' hacked.txt
sed -i '/ {"type":"vote","uri":"/d' hacked.txt
sed -i '/ {"action":"ban","type":"member","uri":"/d' hacked.txt
sed -i '/ {"action":"unban","type":"member","uri":"/d' hacked.txt
# Remove some formatting I don't like
sed -i 's| {"body":| |g' hacked.txt
sed -i 's|,"type":"text/plain"}||g' hacked.txt
sed -i 's|","reply-to":"|)"\n\n\n|g' hacked.txt
# Convert curly quote to straight quotes
sed -i 's|\u2019|'"'"'|g' hacked.txt # doesn't fully work
# Provide full path to images and delete extraneous
sed -i 's|{"displayName":"|
\n\n|g' hacked.txt
sed -i '/data-transfer+json"}/d' hacked.txt
# Delete any line that doesn't begin with a
tag
sed -i '/^
/!d' hacked.txt
cp hacked.txt hacked.md
pandoc --metadata title="JamiForum Archives" hacked.md -o hacked.html --self-contained --css pandoc.css