#!/bin/bash

# Edit Github wiki page to create PrivacyPolicy.html

rm -f HTML-Editor-Privacy-Policy HTMLPrivacyPolicy.html

wget https://github.com/CMUCTAT/CTAT/wiki/HTML-Editor-Privacy-Policy
sed -n \
    -e '/<!DOCTYPE/p' \
    -e '/<\/\?html/p' \
    -e '/<\/\?head>/p' \
    -e '/<title>/s/ Policy . [^<]*</ Policy</p' \
    -e '/<\/\?body/p' \
    -e '/<div class="markdown-body"/i\
     <h3>CTAT HTML Editor Privacy Policy<\/h3>' \
    -e '/<div class="markdown-body"/,/<\/div>/s/\(<div class="[^"]*"\)/\1 style="width: 80%"/' \
    -e '/<div class="markdown-body"/,/<\/div>/p' \
    HTML-Editor-Privacy-Policy >../../PrivacyPolicy.html
