Added news-fmt to replace existing system
parent
886b1a4f10
commit
ee12a7df5e
8
Makefile
8
Makefile
|
@ -64,13 +64,7 @@ $(outdir)/%.html: %.html $(header) $(footer) tools/page-parse | $(outdir)
|
||||||
|
|
||||||
# requires git-weblog from mikegerwitz's git-supp package
|
# requires git-weblog from mikegerwitz's git-supp package
|
||||||
news:
|
news:
|
||||||
@[ "$$( which git-weblog )" ] \
|
tools/news-fmt < NEWS \
|
||||||
|| ( echo "Please add git-weblog to PATH" >&2 && false )
|
|
||||||
git fetch origin refs/notes/*:refs/notes/*
|
|
||||||
git log --log-size --format="%H%n%B" master \
|
|
||||||
| grep -A1 '^log size \([5-9][0-9]\{2,\}\|[0-9]\{4,\}\)$$' \
|
|
||||||
| grep -o '^[a-z0-9]\+$$' \
|
|
||||||
| xargs git weblog -Dn $$( git tag -l ) \
|
|
||||||
| cat $(header) $(header_news) - $(footer) \
|
| cat $(header) $(header_news) - $(footer) \
|
||||||
| sed 's/\(<body\)/\1 class="news"/' \
|
| sed 's/\(<body\)/\1 class="news"/' \
|
||||||
> "$(outdir)/news.html"
|
> "$(outdir)/news.html"
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
#!/usr/bin/gawk -f
|
||||||
|
#
|
||||||
|
# Formats NEWS for display on the website
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 Mike Gerwitz
|
||||||
|
#
|
||||||
|
# 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 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/>.
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
# formats for HTML output
|
||||||
|
function escprint( str )
|
||||||
|
{
|
||||||
|
# escapes
|
||||||
|
gsub( /&/, "\\&", str )
|
||||||
|
gsub( /</, "\\<", str )
|
||||||
|
gsub( />/, "\\>", str )
|
||||||
|
|
||||||
|
# hyperlinks
|
||||||
|
print gensub( /(https?:\/\/.+)(>|\. )/, \
|
||||||
|
"<a href=\"\\1\">\\1</a>\\2", str \
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/^commit / { next }
|
||||||
|
|
||||||
|
# store author
|
||||||
|
match( $0, /^Author: *([^<]+)/, author ) { next }
|
||||||
|
|
||||||
|
# store date
|
||||||
|
match( $0, /^Date: *(.+)$/, date ) { next }
|
||||||
|
|
||||||
|
# commit messages are indented by four spaces, with the subject line
|
||||||
|
# occupying the first paragraph (that is---until an empty line)
|
||||||
|
/^ / {
|
||||||
|
# begin the subject line output
|
||||||
|
printf "<h3>"
|
||||||
|
|
||||||
|
do {
|
||||||
|
escprint( $0 " " )
|
||||||
|
} while ( getline && !/^ $/ );
|
||||||
|
|
||||||
|
# close subject line
|
||||||
|
printf "</h3>"
|
||||||
|
|
||||||
|
# the rest of the commit (that is, until we find a line with
|
||||||
|
# non-whitespace in column one) is the body
|
||||||
|
printf "<pre>"
|
||||||
|
while ( getline && /^\W/ ) {
|
||||||
|
escprint( $0 )
|
||||||
|
}
|
||||||
|
printf "</pre>"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue