nanodoc (2143B)
1 #!/bin/sh 2 # Copyright (c) 2016 parazyd <parazyd@dyne.org> 3 # nanodoc is written and maintained by parazyd 4 # 5 # This file is part of arm-sdk 6 # 7 # This source code is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 3 of the License, or 10 # (at your option) any later version. 11 # 12 # This software is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with this source code. If not, see <http://www.gnu.org/licenses/>. 19 20 org="parazyd <parazyd@dyne.org> | dyne.org" 21 name=libdevuansdk 22 version=0.2 23 desc="common library for devuan's sdks" 24 25 pages=" 26 libdevuansdk.7 27 configuration.7 28 workflow.7 29 helper_functions.7 30 creating_wrappers.7 31 " 32 33 generate_manpages() { 34 for page in $pages; do 35 ronn -r --manual="$name" --organization="$org" ${page}.md 36 done 37 38 mkdir -p man/man7 39 mv *.7 man/man7 40 } 41 42 generate_html() { 43 mkdir -p html 44 sed -i -e 's/NAME/'"$name"'/' -e 's/DESC/'"$desc"'/g' static/head.html 45 sed -i -e 's/VERSION/'$version'/' static/foot.html 46 47 for page in $pages; do 48 pagetitle=$(sed 1q ${page}.md) 49 printf '<li><a href="%s.html" class="notPage">%s</a></li>\n' $page "$pagetitle" >> nav.html 50 done 51 52 printf "</ul></div><div id='main'>\n" >> nav.html 53 54 for page in $pages; do 55 printf "\thtml/%s\n" $page 56 cat static/head.html > html/${page}.html 57 cat nav.html >> html/${page}.html 58 python -m markdown ${page}.md >> html/${page}.html 59 cat static/foot.html >> html/${page}.html 60 61 pagetitle=$(sed 1q ${page}.md) 62 sed -i -e 's/TITLE/'"$pagetitle"'/' html/${page}.html 63 sed -i -e 's/'$page'.html" class="notPage/'$page'.html" class="thisPage/' html/${page}.html 64 done 65 66 ln -sf libdevuansdk.7.html html/index.html 67 #cat nav.html 68 rm -f nav.html 69 } 70 71 case $1 in 72 man) generate_manpages && exit 0 ;; 73 html) generate_html && exit 0 ;; 74 *) exit 1 ;; 75 esac