2012-01-08 16:14:38 -05:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Simple parser for static HTML generation
|
|
|
|
#
|
2014-04-09 19:49:00 -04:00
|
|
|
# Copyright (C) 2010 Free Software Foundation, Inc.
|
2012-01-08 16:14:38 -05:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
##
|
|
|
|
|
2012-05-06 00:02:48 -04:00
|
|
|
# grab most recent version tag
|
|
|
|
curver="$( git tag -l \
|
|
|
|
| grep '^[0-9]\+.[0-9]\+.[0-9]\+$' \
|
|
|
|
| tail -n1
|
|
|
|
)"
|
2012-05-05 23:51:59 -04:00
|
|
|
|
2012-05-07 00:40:29 -04:00
|
|
|
curver_date="$( date "+%d %b %Y" \
|
|
|
|
--date="$( git for-each-ref \
|
|
|
|
--format='%(*authordate)' \
|
|
|
|
"refs/tags/$curver" \
|
|
|
|
| cut -d' ' -f1-5 \
|
|
|
|
)"
|
|
|
|
)"
|
|
|
|
|
|
|
|
|
2012-05-05 23:51:59 -04:00
|
|
|
# TODO: Both sed and gawk are unnecessary; it was just the most convenient
|
|
|
|
# solution
|
2012-01-08 16:14:38 -05:00
|
|
|
gawk '
|
|
|
|
match( $0, /^ *<!--%inc (.*?) *--> *$/, arr ) {
|
|
|
|
system( "cat " arr[1] )
|
|
|
|
next
|
|
|
|
}
|
|
|
|
{ print }
|
2012-05-05 23:51:59 -04:00
|
|
|
' \
|
2012-05-07 00:40:29 -04:00
|
|
|
| sed "
|
|
|
|
s/<!--%curver-->/$curver/g;
|
|
|
|
s/<!--%curver-date-->/$curver_date/g;
|
|
|
|
"
|