summary refs log tree commit diff stats
path: root/article-template/configure
diff options
context:
space:
mode:
Diffstat (limited to 'article-template/configure')
-rwxr-xr-xarticle-template/configure36
1 files changed, 36 insertions, 0 deletions
diff --git a/article-template/configure b/article-template/configure
new file mode 100755
index 0000000..c19e965
--- /dev/null
+++ b/article-template/configure
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+[ -z "$2" ] && printf "$0: Not enough arguments.\n$0: You MUST run this script with the following arguments:\n$0: <Basename> <RFD number>\n" > /dev/stderr && exit 1 
+[ "$3" ] && printf "$0: Too many arguments.\n$0: You MUST run this script with the following arguments:\n$0: <Basename> <RFD number>\n" > /dev/stderr && exit 2
+
+FILENAME="$1"
+RFDN="$2"
+
+mv TEMPLATE.md "$FILENAME".md
+
+sed -i 's/RFDN/'"$RFDN"'/g' "$FILENAME".md
+
+sed 's/FILENAME/'"$FILENAME"'/g' > Makefile << EOF
+update: FILENAME.txt FILENAME.7 FILENAME.html
+	git add .
+	git commit
+	git push
+
+FILENAME.7: FILENAME.md
+	mmark --man FILENAME.md > FILENAME.7
+FILENAME.txt FILENAME.html: FILENAME.xml
+	xml2rfc --text --html FILENAME.xml
+	sed -i -e '/\f/{n;s/^.\{5\}/RFD 1/}' FILENAME.txt
+	ed FILENAME.txt < Edfile
+FILENAME.xml: FILENAME.md
+	sed '0,/title =/{s/ ."\$\$/"/}' FILENAME.md | mmark > FILENAME.xml
+EOF
+
+(sed 's/RFDN/'"$RFDN"'/g' << EOF
+6
+s/^DOTNUM/RFD RFDN/
+wq
+EOF
+) | sed 's/DOTNUM/'"$(printf 'RFD %s' "$RFDN" | sed 's/././g')"'/g' > Edfile
+
+printf "$0: Finished generating Makefile and Edfile.\n$0: You MUST now edit $FILENAME.md and replace the <++>s.\n" > /dev/stderr