From 04a1256f89054db25413522779b9127c8c959f21 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 22 Feb 2010 10:55:15 +0100 Subject: [PATCH] Add a script to help the transition MSysGitWiki -> GitWiki We want to move the Wiki pages to the GitWiki, as the latter has a nice and powerful MediaWiki engine, and it is also much easier to get people involved. This script downloads the old pages, transforms them to MediaWiki markup (the transformation is ad-hoc, just enough for what this developer tested), opens the result in a graphical editor for easy Ctrl-A Ctrl-C (select all & copy), and also opens the appropriate link in the web browser, where the copied text can be simply pasted, previewed and saved. Once the editor is closed, the next page is handled. Signed-off-by: Johannes Schindelin --- bin/move-wiki.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 bin/move-wiki.sh diff --git a/bin/move-wiki.sh b/bin/move-wiki.sh new file mode 100755 index 00000000..98642343 --- /dev/null +++ b/bin/move-wiki.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +case $(uname -s) in +MINGW*) + EDITOR=wordpad + START=start + ;; +Linux) + EDITOR=gedit + START=xdg-open + ;; +esac + +OLDWIKISVN=http://msysgit.googlecode.com/svn/wiki +NEWWIKI=http://git.wiki.kernel.org/index.php +NAMESPACE=MSysGit + +transform () { + perl -e 'while (<>) { + s/^#.*//; + s/(?<=\s)!([A-Z])/$1/g; + s/(?$2<\/u>$3/g; + print $_; + } + print "\n[[Category:MSysGit]]\n"; + ' +} + +download () { + curl $OLDWIKISVN/"$1".wiki +} + +download_index () { + curl $OLDWIKISVN/ | + sed -n 's/.*>\([^<]*\)\.wiki<.*/\1/p' +} + +action () { + download "$1" > /tmp/"$1".old && + transform < /tmp/"$1".old > /tmp/"$1".wiki && + $START $NEWWIKI?title="$NAMESPACE:$1&action=edit" && + $EDITOR /tmp/"$1".wiki && + rm /tmp/"$1".old /tmp/"$1".wiki +} + +test $# = 0 && set $(download_index) + +for arg +do + echo action $arg +done -- 2.11.4.GIT