1 |
#! /bin/bash
|
2 |
rm -f item_def.h.wiki
|
3 |
rm -f osmmap_def.h.wiki
|
4 |
IFS="|"
|
5 |
for file in item_def.h.wiki osmmap_def.h.wiki
|
6 |
do
|
7 |
cat <<\EOT >$file
|
8 |
/**
|
9 |
* Navit, a modular navigation system.
|
10 |
* Copyright (C) 2005-2008 Navit Team
|
11 |
*
|
12 |
* This program is free software; you can redistribute it and/or
|
13 |
* modify it under the terms of the GNU Library General Public License
|
14 |
* version 2 as published by the Free Software Foundation.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU Library General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU Library General Public
|
22 |
* License along with this program; if not, write to the
|
23 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
24 |
* Boston, MA 02110-1301, USA.
|
25 |
*/
|
26 |
|
27 |
/* This file is generated from http://wiki.navit-project.org/index.php/Item_def.h, do not edit it, edit the wiki page instead */
|
28 |
EOT
|
29 |
done
|
30 |
type="n"
|
31 |
wget -O - "http://wiki.navit-project.org/index.php/Item_def.h?action=edit" |
|
32 |
awk '/<textarea/,/<\/textarea/ { print $0 }' |
|
33 |
grep "^| " |
|
34 |
sed -e 's/^| *//' -e 's/ *$//' -e 's/ *|/|/g' -e 's/| */|/g' -e 's/||/|/g' |
|
35 |
while read id item description osmtags dummy
|
36 |
do
|
37 |
if [[ "$id" == colspan=* ]]
|
38 |
then
|
39 |
echo "/* $item */" >>item_def.h.wiki
|
40 |
continue
|
41 |
fi
|
42 |
if [[ -z "$id" ]]
|
43 |
then
|
44 |
echo "ITEM($item)" >>item_def.h.wiki
|
45 |
else
|
46 |
echo "ITEM2($id,$item)" >>item_def.h.wiki
|
47 |
if [ "$id" == "0x80000000" ]
|
48 |
then
|
49 |
type="w"
|
50 |
fi
|
51 |
fi
|
52 |
if [[ -n "$osmtags" ]]
|
53 |
then
|
54 |
for osmtag in $(echo "$osmtags" | sed 's/<br\/>/|/g')
|
55 |
do
|
56 |
printf '"%s\t%s\t%s\t%s\\n"\n' $type $osmtag $item >> osmmap_def.h.wiki
|
57 |
done
|
58 |
fi
|
59 |
done
|
60 |
exit 0
|