mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-28 07:23:07 +01:00
Refactor deplist
This commit is contained in:
parent
fda170aa19
commit
f8a4c4a534
4
Makefile
4
Makefile
@ -41,8 +41,8 @@ clean:
|
||||
$(MAKE) -C embed clean
|
||||
|
||||
docs: README.md doc/ctpv.1
|
||||
deptable/list.awk $(PRE) | deptable/markdown.sh | deptable/insert.sh README.md
|
||||
deptable/list.awk $(PRE) | deptable/roff.sh | deptable/insert.sh doc/ctpv.1
|
||||
deptable/list.awk $(PRE) | deptable/markdown.sed | deptable/insert.awk README.md
|
||||
deptable/list.awk $(PRE) | deptable/roff.sed | deptable/insert.awk doc/ctpv.1
|
||||
|
||||
ctpv: $(OBJ)
|
||||
$(CC) -o $@ $+ $(LDFLAGS)
|
||||
|
20
deptable/insert.awk
Executable file
20
deptable/insert.awk
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/gawk -f
|
||||
|
||||
@include "inplace"
|
||||
|
||||
BEGIN {
|
||||
while ((getline line < "-") > 0)
|
||||
input = input line "\n"
|
||||
close("-")
|
||||
}
|
||||
|
||||
/TABLEEND/ {
|
||||
table = 0
|
||||
printf "%s", input
|
||||
}
|
||||
|
||||
!table
|
||||
|
||||
/TABLESTART/ {
|
||||
table = 1
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
tmp="$(mktemp XXXXXX)"
|
||||
table="$(mktemp XXXXXX)"
|
||||
trap 'rm "$table"' EXIT
|
||||
|
||||
cat > "$table"
|
||||
|
||||
sed "
|
||||
/TABLESTART/,/TABLEEND/ {
|
||||
/TABLESTART/ {
|
||||
r $table
|
||||
b
|
||||
}
|
||||
/TABLEEND/!d
|
||||
}
|
||||
" "$1" > "$tmp"
|
||||
|
||||
mv -- "$tmp" "$1"
|
@ -38,5 +38,7 @@ BEGIN {
|
||||
process_file(ARGV[i])
|
||||
|
||||
for (t in types)
|
||||
printf "%s\t%s\n", t, join(types[t], " ")
|
||||
s = s sprintf("%s\t%s\n", t, join(types[t], " "))
|
||||
|
||||
printf "%s", s | "sort"
|
||||
}
|
||||
|
16
deptable/markdown.sed
Executable file
16
deptable/markdown.sed
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sed -f
|
||||
|
||||
# Add header
|
||||
1i\
|
||||
| File types | Programs |\
|
||||
| ---- | ---- |
|
||||
|
||||
# Format rows
|
||||
s/ /` `/g
|
||||
s/\t/ | `/
|
||||
s/^/| /
|
||||
s/$/` |/
|
||||
|
||||
# Add a newline at the end
|
||||
$a\
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "| File types | Programs |"
|
||||
echo "| ---- | ---- |"
|
||||
|
||||
sort | sed 's/ /` `/g; s/^/| /; s/\t/ | `/; s/$/` |/'
|
||||
echo
|
16
deptable/roff.sed
Executable file
16
deptable/roff.sed
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sed -f
|
||||
|
||||
# Add header
|
||||
1i\
|
||||
.TS\
|
||||
allbox;\
|
||||
lb lb\
|
||||
l li .\
|
||||
File type\tPrograms
|
||||
|
||||
# Format rows
|
||||
s/\t/&T{\n/; s/$/\nT}/
|
||||
|
||||
# Add footer
|
||||
$a\
|
||||
.TE
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo '.TS'
|
||||
echo 'allbox;'
|
||||
echo 'lb lb'
|
||||
echo 'l li .'
|
||||
|
||||
printf '%s\t%s\n' 'File type' 'Programs'
|
||||
sort | sed 's/\t/&T{\n/; s/$/\nT}/'
|
||||
|
||||
echo '.TE'
|
Loading…
Reference in New Issue
Block a user