Remove link to GitHub sponsors
[openssl-web.git] / bin / mk-faq
1 #! /bin/sh
2
3 cat <<EOF
4 <h3><a name='toc'>Table of Contents</a></h3>
5 <ol>
6 EOF
7 for faqfile in "$@"; do
8     anchor=`basename $faqfile .txt | cut -f3 -d- | tr '[:lower:]' '[:upper:]'`
9     title=`head -1 $faqfile | sed -e 's|^##* *||'`
10
11     cat <<EOF
12   <h4><a href='#$anchor'>$title</a></h4>
13 EOF
14 done
15 cat <<EOF
16 </ol>
17 EOF
18
19 for faqfile in "$@"; do
20     anchor=`basename $faqfile .txt | cut -f3 -d- | tr '[:lower:]' '[:upper:]'`
21
22     cat <<EOF
23 <hr />
24 EOF
25     cat $faqfile \
26         | perl -pe 'BEGIN { $count = 0 } s/^(#### )/$1|'${anchor}'|/; s/^(\* *)(?{ $count++ })/$1|'${anchor}'${count}|/' \
27         | pandoc -t html --no-highlight \
28         | sed -E -e 's/ id="[-a-z]*">/>/' \
29         | sed -E -e 's/<([^<>]*)>\|([A-Z]*[0-9]*)\|/<\1 id="\2">/'
30 done