summaryrefslogtreecommitdiff
path: root/web/noweb/src/shell/unmarkup
blob: a6ce6cc3474466fec045b41273a2a25d84b01836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
#
# Copyright 1991 by Norman Ramsey.  All rights reserved.
# See file COPYRIGHT for more information.

nawk '
/^@file / {
#  if (file) printf "EndOf%s\n", file
#  file = substr($0,7);
#  printf "diff %s - <<'"'EndOf%s'"'\n", file, file
}

END { 
#  if (file) printf "EndOf%s\n", file
}

/^@begin docs 0$/ { next }
/^@begin docs / { printf "@ " }
/^@end docs / { }

/^@begin code / { }
/^@defn / { printf "<<%s>>=", substr($0,7) }

/^@text $/ {next}
/^@text / { 
  gsub("<<", "@<<");
  gsub(">>", "@>>");
  printf "%s", substr($0,7) 
}
/^@quote$/    { printf("[[") }
/^@endquote$/ { printf("]]") }
/^@nl$/       { printf "\n"}

/^@use / { printf "<<%s>>", substr($0,6) }' "$@" | sed 's/^@ $/@/'