Skip to content

Instantly share code, notes, and snippets.

@posobin
Last active January 21, 2016 00:48
Show Gist options
  • Save posobin/a00d8679513d4fbd3c81 to your computer and use it in GitHub Desktop.
Save posobin/a00d8679513d4fbd3c81 to your computer and use it in GitHub Desktop.
#!/bin/sh
header='\
<html>\
<head>\
<meta charset="utf-8"> \
<meta name="viewport" content="width=device-width, initial-scale=1.0">\
<link rel="stylesheet" href="http://cmcenroe.me/writ/writ.min.css"> \
<style>\
a { background-size: 16px; \
background-repeat: no-repeat; \
padding-left: 20px; \
}\
body { line-height: 1.5em; \
width: 50%; \
min-width: 35em; \
margin-left: auto; \
margin-right: auto; \
}\
dl { padding-left: 10px; \
margin-bottom: 0.5em; \
margin-top: 0; } \
h3 { margin: 0; } \
h1 { margin-bottom: 0; } \
dl dl { border-left: 1px solid lightblue; } \
</style>'
sed -i \
-e '5 {i '"$header"'
d}' \
-e '7i </head><body>' \
-e '$a </body></html>' \
-e 's/icon="\([^"]*\)"/style="background-image:url(\1);"/gI' \
-e 's/<\/\?p>//g' \
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment