Skip to content

Instantly share code, notes, and snippets.

@glowinthedark
Created April 2, 2022 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glowinthedark/f1fce86518e3e1411997be987f55147a to your computer and use it in GitHub Desktop.
Save glowinthedark/f1fce86518e3e1411997be987f55147a to your computer and use it in GitHub Desktop.
massage the html generated by macos `textutil -convert html *.doc`
find-replace-in-files-regex.py -s '[_]{3,}' -r '<hr>' -g '*.html'
find-replace-in-files-regex.py -s 'font: (\d{2})\.0px' -r 'font: \1pt' -g '*.html'
# remove line-height
find-replace-in-files-regex.py -s '(line-height:\s*[^;]+;)' -r '' -g '*.html'
find-replace-in-files-regex.py -s 'Times New Roman' -r 'Georgia, Baskerville, "PT Serif", Palatino' -l -g '*.html'
find-replace-in-files-regex.py -s '<p class="p\d"><br></p>' -r '' -l -g '*.html'
find-replace-in-files-regex.py -s '<span class="Apple-converted-space"> </span>' -r ' ' -l -g '*.html'
find-replace-in-files-regex.py -s '<style type="text/css">\n' -r '<style type="text/css">* {font-family: Georgia, Palatino; line-height: 1.61} body {padding: 1em 3em; text-align:center;margin-top: 5em;} .container{margin: 0 auto; width: 83%; max-width: 650px; text-align: left; padding: 0 10px 20px; } @media screen and (max-width:600px) { body {padding: 0; margin: 0} .container {margin:0; width:auto; text-align:left; padding:.7em;} } \n' -g '*.html'
find-replace-in-files-regex.py -s '<body>' -r '<body><div class="container">' -l -g '*.html'
find-replace-in-files-regex.py -s '</body>' -r '</div></body>' -l -g '*.html'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment