1#!/bin/bash
2## This file is part of the aMule Project
3##
4## Copyright (c) 2004-2011 Angel Vidal ( kry@amule.org )
5## Copyright (c) 2003-2011 aMule Team  ( admin@amule.org / http://www.amule.org )
6##
7## This program is free software; you can redistribute it and/or
8## modify it under the terms of the GNU General Public License
9## as published by the Free Software Foundation; either
10## version 2 of the License, or (at your option) any later version.
11##
12## This program 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 program; if not, write to the Free Software
19## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
20
21# Wikifies lastest changelog entry. No sanity checking. Must be run from sources root folder.
22if test x"`ls docs/Changelog`" = x""; then
23  echo "This script must be run on aMule base directory."
24else
25  CHANGELOG="Changelog-`grep -h -E 'Version [0-9]\.[0-9]+\.[0-9]+.*' docs/Changelog | head -n 1 | cut -d ' ' -f 2`"
26  head -n `grep -hn -E '(\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-)+' docs/Changelog | cut -d ':' -f 1 | head -1` docs/Changelog > $CHANGELOG 
27  sed -i -r "s/\t([A-Z,a-z].+):$/'''\1:'''/g" $CHANGELOG
28  sed -i -r "s/^(Version .+)$/=== \1 ===/g" $CHANGELOG
29  sed -i -r "s/^----------$//g" $CHANGELOG
30  sed -i -r "s/^([0-9][0-9][0-9][0-9]-[0-9][0-9]?-[0-9][0-9]?)$/''\1''/g" $CHANGELOG
31  sed -i -r "s/\t+(\*? .+)$/\1/g" $CHANGELOG
32  while test x"`grep -E '^\s+.+$' $CHANGELOG`" != x""; do 
33    sed -i -r "N 
34		s/^(\*?.*)\n\s+([^\*]+)$/\1 \2/g " $CHANGELOG;
35  done
36  echo "$CHANGELOG created."
37fi
38
39