2 # wikiimg --- Get and put SVG and PNG files to Oddmuse wikis
4 # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 echo image get PageName
-- gets PageName from the wiki and saves
25 echo it as PageName.svg
in the current directory.
27 echo image put PageName
-- saves PageName.svg as PageNameSource
28 echo and PageName.png as PageNameImage. You are responsible
for
29 echo exporting the SVG
file as PNG when you are
done.
33 WIKI
=http
://www.communitywiki.org
/en
35 WIKIUSER
=${WIKIUSER:-USER}
39 F
=`basename "$2" Image`.svg
40 # make sure both are accepted
41 IMG
=`basename "$2" Image`Image
45 # make sure all are accepted
47 PAGE
=`basename $PAGE .svg`
48 PAGE
=`basename $PAGE .png`
49 for f
in "$PAGE.svg" "$PAGE.png"; do
50 if [ ! -f "$f" ]; then
51 echo There is no
file called
$f
55 wikiupload
-u "$WIKIUSER" "$PAGE.png" "$WIKI/${PAGE}Image"
56 wikiupload
-t "image/svg+xml" -u "$WIKIUSER" \
57 "$PAGE.svg" "$WIKI/${PAGE}Source"
60 echo You must use either get or put as first parameter.