mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
better troff handling
This commit is contained in:
parent
829ec0d30c
commit
72208f3827
1 changed files with 19 additions and 2 deletions
21
bin/page
21
bin/page
|
@ -22,6 +22,16 @@ preview()
|
||||||
end tell' | osascript
|
end tell' | osascript
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfile()
|
||||||
|
{
|
||||||
|
if sed 1q "$1" | 9 grep '^x T '
|
||||||
|
then
|
||||||
|
echo 'troff intermediate output'
|
||||||
|
else
|
||||||
|
file - < "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
case `uname` in
|
case `uname` in
|
||||||
|
@ -29,7 +39,10 @@ main()
|
||||||
preview "$@"
|
preview "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
case "`file $1`" in
|
case "`xfile $1`" in
|
||||||
|
*troff*)
|
||||||
|
tr2post "$1" | psfonts | page
|
||||||
|
;;
|
||||||
*PDF*)
|
*PDF*)
|
||||||
psv $1
|
psv $1
|
||||||
;;
|
;;
|
||||||
|
@ -51,7 +64,11 @@ case $# in
|
||||||
0)
|
0)
|
||||||
tmp=/var/tmp/page.$$.tmp
|
tmp=/var/tmp/page.$$.tmp
|
||||||
cat >$tmp
|
cat >$tmp
|
||||||
case "`file $tmp`" in
|
case "`xfile $tmp`" in
|
||||||
|
*troff*)
|
||||||
|
mv $tmp $tmp.tr
|
||||||
|
tmp=$tmp.tr
|
||||||
|
;;
|
||||||
*PDF*)
|
*PDF*)
|
||||||
mv $tmp $tmp.pdf
|
mv $tmp $tmp.pdf
|
||||||
tmp=$tmp.pdf
|
tmp=$tmp.pdf
|
||||||
|
|
Loading…
Reference in a new issue