diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-07 20:58:10 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-08 15:37:54 +0200 |
commit | b18302253c93727b28da8d128fbb204c21b62815 (patch) | |
tree | 557d473c742b57bd3101aaf512733c2c01466ec3 /em.sh | |
parent | cd943ef6b47b00c73b3b544fb3ecb07c91511f0d (diff) | |
download | em-b18302253c93727b28da8d128fbb204c21b62815.tar.gz |
Add UNIX support
Diffstat (limited to 'em.sh')
-rwxr-xr-x | em.sh | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ +#!/bin/sh + +# em -- limited hypertext markup language + +IFS=' +' + +if [ $# = 0 ]; then + file=`mktemp` + tmp=$file + cat > $file +else + file=$1 +fi + +export file +emcollect $file | +perl -w -ne ' + chomp; + @parts = split /=/; + $url = $parts[1]; + $url .= "=$_" for @parts[3..$#parts]; + $ENV{"ref".$parts[0]} = $url; + END { + exec("emparse", $ENV{file}); + die "$!\n"; + } +' + +[ -z "$tmp" ] || rm $tmp |