1
0
Fork 0
easejs/tools/page-parse

49 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/bash
#
# Simple parser for static HTML generation
#
# Copyright (C) 2010 Free Software Foundation, Inc.
#
# 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/>.
##
# 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
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
gawk '
match( $0, /^ *<!--%inc (.*?) *--> *$/, arr ) {
system( "cat " arr[1] )
next
}
{ print }
2012-05-05 23:51:59 -04:00
' \
| sed "
s/<!--%curver-->/$curver/g;
s/<!--%curver-date-->/$curver_date/g;
"