#!/bin/sh # action_compiler - generate publishable action docs from shorthand htmls # Copyright (C) 2018 Tibor 'Igor2' Palinkas # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # http://repo.hu/projects/librnd #shell lib; configuration: # $APP: name of the app, e.g. pcb-rnd # dump_actions(): function for dumping actions, e.g. cd ../../../../src; ./pcb-rnd --dump-actions SEP="<@@@@>" SEPH="<@@H@@>" compile() { awk -v "SEP=$SEP" -v "SEPH=$SEPH" ' BEGIN { q="\"" SEP="^" SEP SEPH="^" SEPH } function strip(s) { sub("^[ \t]*", "", s) sub("[ \t]*$", "", s) return s } function read_tag(tag, tmp1,tmp2) { getline tmp1 getline tmp2 if (tmp2 ~ "" tag) return tmp1 print "Error: expected closing tag " tag " in line " NR " of " current > "/dev/stderr" exit(1) } function notav(s) { if (s == "") return "n/a" return s } function end_act() { if (current != "") print "" currrent = "" } ($0 ~ SEP) { end_act() action = "" $1="" current=tolower(strip($0)) sub("^.*/", "", current) sub(".html$", "", current) if (current in ANAME) aname = ANAME[current] else aname = current print "" print "
" print "
Syntax summary: | " notav(SYNTAX[current]) print " |
---|---|
Help text: | " notav(HELP[current]) print " |
Registered by: | " notav(COOKIE[current]) print " |
" next } ($0 ~ SEPH) { end_act() action = "" $1="" print "