Index: /quintagroup.transmogrifier.simpleblog2quills/trunk/README.txt
===================================================================
--- /quintagroup.transmogrifier.simpleblog2quills/trunk/README.txt	(revision 585)
+++ /quintagroup.transmogrifier.simpleblog2quills/trunk/README.txt	(revision 586)
@@ -1,10 +1,10 @@
-quintagroup.transmogrifier.simpleblog2quills Package Readme
-=========================
+quintagroup.transmogrifier.simpleblog2quills
+============================================
 
 Overview
 --------
 
-Configuration of collective.transmogrifier pipeline for migrating SimpleBlog
-blog to Quills/QuillsEnabled content.
+Configuration of collective.transmogrifier pipeline for migrating blog from 
+SimpleBlog to Quills/QuillsEnabled.
 
 Installation
@@ -13,6 +13,6 @@
 See docs/INSTALL.txt for installation instructions.
 
-Supported Plone versions
-------------------------
+Supported Plone versions and migration instructions
+---------------------------------------------------
 
 This package was designed to work and tested on next Plone versions:
@@ -20,16 +20,25 @@
  - Plone 2.1
 
-    SimpleBlog_ plone product is required.
+    SimpleBlog_ plone product is required. To migrate SimbleBlog to Quills this
+    package must move all images and files, that were added somewhere in the
+    blog to one centralized folder. That's why modifications of links to those
+    images/files are needed and these are done automatically. There is only 
+    problem with absolute links, because site URL isn't known. To make it possible
+    to fix absolute links please edit export configuration file 'export.cfg',
+    which is located in 'quintagroup/transmogrifier/simpleblog2quills' folder.
+    Find in that file line that starts with "site-urls = " and change values
+    that come after it to your site URL.
 
  - Plone 3
 
-    Quills_ or QuillsEnabled plone product is required. When migrating to 
-    QuillsEnabled please edit transmogrifier import pipeline configuration file
-    located in quintagroup/transmogrifier/simpleblog2quills/import.cfg (comments
-    in that file will guide you through necessary modifications).
-
+    Quills_ or QuillsEnabled_ plone product is required. When migrating blog to 
+    QuillsEnabled please edit import configuration file 'import.cfg' located in
+    'quintagroup/transmogrifier/simpleblog2quills' folder (comments in that file 
+    will guide you through necessary modifications).
 
 Running tests
 -------------
+
+ - Plone 3
 
     Run next command:
@@ -41,9 +50,9 @@
 -------
 
-Design and development
-   `Bohdan Koval`_ at Quintagroup_
+Design and development `Bohdan Koval`_ at Quintagroup_
 
+.. _SimpleBlog: http://plone.org/products/simpleblog
 .. _Quills: http://plone.org/products/quills
-.. _SimpleBlog: http://plone.org/products/simpleblog
+.. _QuillsEnabled: http://plone.org/products/quills
 .. _Bohdan Koval: mailto:koval@quintagroup.com
-.. _Quintagroup: http://www.quintagroup.com/
+.. _Quintagroup: http://quintagroup.com/
Index: /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/activator.py
===================================================================
--- /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/activator.py	(revision 585)
+++ /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/activator.py	(revision 586)
@@ -21,4 +21,5 @@
     def __init__(self, transmogrifier, name, options, previous):
         self.transmogrifier = transmogrifier
+        self.context = transmogrifier.context
 
         self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
@@ -28,5 +29,5 @@
     def __iter__(self):
         for item in self.previous:
-            pathkey = self.pathkey(*item.keys())
+            pathkey = self.pathkey(*item.keys())[0]
 
             if not pathkey or self.flagkey not in item:
@@ -43,6 +44,6 @@
             if not IWeblogEnhanced.providedBy(obj) and \
                 IPossibleWeblog.providedBy(obj):
-                alsoProvides(self.context, IWeblogEnhanced)
-                event.notify(WeblogActivationEvent(self.context))
+                alsoProvides(obj, IWeblogEnhanced)
+                event.notify(WeblogActivationEvent(obj))
 
             yield item
Index: /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/adapters.py
===================================================================
--- /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/adapters.py	(revision 585)
+++ /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/adapters.py	(revision 586)
@@ -34,8 +34,29 @@
 
     def __call__(self, data):
-        doc = data['data'].splitlines()
-        record = '  <record type="Folder">%s</record>' % IMAGE_FOLDER
-        doc = doc[:-1] + [record] + doc[-1:]
-        data['data'] = '\n'.join(doc)
+        doc = minidom.parseString(data['data'])
+        root = doc.documentElement
+        for child in root.getElementsByTagName('record'):
+            if child.getAttribute('type') not in  ('BlogEntry', 'BlogFolder'):
+                root.removeChild(child)
+        folder = doc.createElement('record')
+        folder.setAttribute('type', 'Folder')
+        folder.appendChild(doc.createTextNode(IMAGE_FOLDER))
+        root.appendChild(folder)
+        data['data'] = doc.toxml('utf-8')
+        return data
+
+class BlogFolderManifest(object):
+    implements(IExportDataCorrector)
+
+    def __init__(self, context):
+        self.context = context
+
+    def __call__(self, data):
+        doc = minidom.parseString(data['data'])
+        root = doc.documentElement
+        for child in root.getElementsByTagName('record'):
+            if child.getAttribute('type') not in  ('BlogEntry', 'BlogFolder'):
+                root.removeChild(child)
+        data['data'] = doc.toxml('utf-8')
         return data
 
@@ -151,10 +172,18 @@
                     image_id = self.fixImageId(image, image_id, blog_path)
                     path = self.context.getPhysicalPath()
-                    # /plone/blog 2
-                    # /plone/blog/bloggins/entry 4
-                    # ../images
                     level = len(path) - len(blog_path) - 1
                     new_url = '/'.join(['..' for i in range(level)])
                     new_url = '/'.join([new_url, IMAGE_FOLDER, image_id])
+                    text = text.replace(url, new_url, 1)
+                elif url.startswith('../'):
+                    # remove '../' from the start of sting
+                    new_url = url[3:]
+                    text = text.replace(url, new_url, 1)
+                elif url.startswith('/'):
+                    # these links didn't work so rewrite them with '..'
+                    # find how many level self.context is under portal root
+                    level = len(self.context.getPhysicalPath()) - 3
+                    new_url = '/'.join(['..' for i in range(level)])
+                    new_url  = new_url + url
                     text = text.replace(url, new_url, 1)
 
Index: /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/configure.zcml
===================================================================
--- /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/configure.zcml	(revision 585)
+++ /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/configure.zcml	(revision 586)
@@ -41,4 +41,9 @@
 
         <five:implements
+            class="Products.SimpleBlog.content.BlogFolder"
+            interface=".interfaces.IBlogFolder"
+            />
+
+        <five:implements
             class="Products.SimpleBlog.content.BlogEntry"
             interface=".interfaces.IBlogEntry"
@@ -60,4 +65,11 @@
             provides="quintagroup.transmogrifier.interfaces.IExportDataCorrector"
             factory=".adapters.BlogManifest"
+            name="manifest"
+            />
+
+        <adapter
+            for=".interfaces.IBlogFolder"
+            provides="quintagroup.transmogrifier.interfaces.IExportDataCorrector"
+            factory=".adapters.BlogFolderManifest"
             name="manifest"
             />
Index: /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/export.cfg
===================================================================
--- /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/export.cfg	(revision 585)
+++ /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/export.cfg	(revision 586)
@@ -44,6 +44,10 @@
 type = export
 
+# in this section you must write you site URL
 [imagefolder]
 blueprint = quintagroup.transmogrifier.simpleblog2quills.imagefolder
+site-urls =
+    http://www.yoursite.com
+    http://yoursite.com
 
 [writer]
Index: /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/interfaces.py
===================================================================
--- /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/interfaces.py	(revision 585)
+++ /quintagroup.transmogrifier.simpleblog2quills/trunk/quintagroup/transmogrifier/simpleblog2quills/interfaces.py	(revision 586)
@@ -3,4 +3,8 @@
 class IBlog(Interface):
     """ Marker interface for SimpleBlog blog object.
+    """
+
+class IBlogFolder(Interface):
+    """ Marker interface for SimpleBlog blog folder object.
     """
 
