aboutsummaryrefslogtreecommitdiff
path: root/doc/tips/convert_mediawiki_to_ikiwiki.mdwn
diff options
context:
space:
mode:
authorJon Dowland <jon@alcopop.org>2009-10-16 11:20:32 +0100
committerJon Dowland <jon@alcopop.org>2009-10-16 11:20:32 +0100
commit811394ec92205112d3fec0d4f6aac380202f114b (patch)
tree7d3c0da1fdfe888ad193eba69ec57b8e09da8878 /doc/tips/convert_mediawiki_to_ikiwiki.mdwn
parentb1c9ca545bd58a8db665e06c5867ede2fe94e32a (diff)
downloadikiwiki-811394ec92205112d3fec0d4f6aac380202f114b.tar
ikiwiki-811394ec92205112d3fec0d4f6aac380202f114b.tar.gz
add snippet for converting categories
Diffstat (limited to 'doc/tips/convert_mediawiki_to_ikiwiki.mdwn')
-rw-r--r--doc/tips/convert_mediawiki_to_ikiwiki.mdwn22
1 files changed, 19 insertions, 3 deletions
diff --git a/doc/tips/convert_mediawiki_to_ikiwiki.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki.mdwn
index c522eaec3..ce0c684e7 100644
--- a/doc/tips/convert_mediawiki_to_ikiwiki.mdwn
+++ b/doc/tips/convert_mediawiki_to_ikiwiki.mdwn
@@ -1,3 +1,5 @@
+[[!toc levels=2]]
+
Mediawiki is a dynamically-generated wiki which stores it's data in a
relational database. Pages are marked up using a proprietary markup. It is
possible to import the contents of a Mediawiki site into an ikiwiki,
@@ -85,7 +87,23 @@ The next step is to convert Mediawiki conventions into Ikiwiki ones. These
include
* convert Categories into tags
- * ...
+
+ import sys, re
+ pattern = r'\[\[Category:([^\]]+)\]\]'
+
+ def manglecat(mo):
+ return '[[!tag %s]]' % mo.group(1).strip().replace(' ','_')
+
+ for line in sys.stdin.readlines():
+ res = re.match(pattern, line)
+ if res:
+ sys.stdout.write(re.sub(pattern, manglecat, line))
+ else: sys.stdout.write(line)
+
+## Step 3: Mediawiki plugin
+
+The [[plugins/contrib/mediawiki]] plugin can be used by ikiwiki to interpret
+most of the Mediawiki syntax.
## External links
@@ -93,5 +111,3 @@ include
git](http://u32.net/Mediawiki_Conversion/index.html?updated), including full
edit history, but as of 2009/10/16 that site is not available.
-The [[plugins/contrib/mediawiki]] plugin can then be used by ikiwiki to build
-the wiki.