- if [[ "$HTTP_ACCEPT" == *'html'* &&
- "$QUERY_STRING" != 'raw'* ]]; then
- # Create a temp file with the provided modeline
- output="$(mktemp)"
- tmp="$(mktemp)"
- sed "\$avim: $(get_modeline)" "$input" > "$tmp"
-
- # - I have some plugins in ~/.vim
- # - Run ex in screen to trick it into thinking that it
- # has a real terminal, note that we also have to set
- # term=xterm-256color in vimrc
- HOME=/home/andy \
- screen -D -m ex -nXZ -i NONE -u vimrc \
- '+sil! set fde= fdt= fex= inde= inex= key= pa= pexpr=' \
- '+sil! set iconstring= ruf= stl= tal=' \
- "+sil! set titlestring=$1\ -\ vpaste.net" \
- '+sil! set noml' \
- '+sil! $d|'$trim \
- '+sil! %s/\r//g' \
- '+sil! TOhtml' \
- "+sav! $output" \
- '+qall!' \
- "$tmp"
-
- header text/html
- cat "$output"
- rm "$tmp" "$output"
- else
+ # Check for raw paste
+ if [[ "$QUERY_STRING" == 'raw'* ||
+ "$REQUEST_URI" != *'?'* &&
+ "$HTTP_ACCEPT" != *'html'* ]]; then