changeset 1752:bff62fea804a

fix for #29 Transcluded csv page is not wrapped with object overlay; updated other converters to consistently return moin_page.page rather than table, object, etc.
author Roger Haase <crosseyedpenguin@yahoo.com>
date Sun, 26 Aug 2012 14:03:02 -0700
parents cdc6a47ff523
children 2be00a5febbe 2ae7384dd311
files MoinMoin/converter/archive_in.py MoinMoin/converter/audio_video_in.py MoinMoin/converter/everything.py MoinMoin/converter/html_out.py MoinMoin/converter/image_in.py MoinMoin/converter/include.py MoinMoin/converter/nonexistent_in.py MoinMoin/converter/text_csv_in.py
diffstat 8 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/archive_in.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/archive_in.py	Sun Aug 26 14:03:02 2012 -0700
@@ -56,7 +56,9 @@
                          self.process_datetime(dt),
                          self.process_name(name),
                         ) for size, dt, name in contents]
-            return self.build_dom_table(contents, head=[_("Size"), _("Date"), _("Name")], cls='zebra')
+            table = self.build_dom_table(contents, head=[_("Size"), _("Date"), _("Name")], cls='zebra')
+            body = moin_page.body(children=(table, ))
+            return moin_page.page(children=(body, ))
         except ArchiveException as err:
             logging.exception("An exception within archive file handling occurred:")
             # XXX we also use a table for error reporting, could be
--- a/MoinMoin/converter/audio_video_in.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/audio_video_in.py	Sun Aug 26 14:03:02 2012 -0700
@@ -33,7 +33,9 @@
             moin_page.type_: unicode(self.input_type),
             xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
         }
-        return moin_page.object_(attrib=attrib, children=[u'Your Browser does not support HTML5 audio/video element.', ])
+        obj = moin_page.object_(attrib=attrib, children=[u'Your Browser does not support HTML5 audio/video element.', ])
+        body = moin_page.body(children=(obj, ))
+        return moin_page.page(children=(body, ))
 
 
 from . import default_registry
--- a/MoinMoin/converter/everything.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/everything.py	Sun Aug 26 14:03:02 2012 -0700
@@ -27,7 +27,9 @@
         attrib = {
             xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
         }
-        return moin_page.a(attrib=attrib, children=[u"Download {0}.".format(item_name)])
+        a = moin_page.a(attrib=attrib, children=[u"Download {0}.".format(item_name)])
+        body = moin_page.body(children=(a, ))
+        return moin_page.page(children=(body, ))
 
 
 from . import default_registry
--- a/MoinMoin/converter/html_out.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/html_out.py	Sun Aug 26 14:03:02 2012 -0700
@@ -44,7 +44,8 @@
     href = unicode(href)
     # href will be "/wikiroot/SomeObject" or "/SomePage" for internal wiki items
     # or "http://Some.Org/SomeThing" for external link
-    if elem.tag.name == 'page':
+    if elem.tag.name not in ('object', 'img'):
+        # XXX see issue #167: for wikis not running at root, only object and img elements have complete path
         # if wiki is not running at server root, prefix href with wiki root
         wiki_root = request.url_root[len(request.host_url):-1]
         if wiki_root:
--- a/MoinMoin/converter/image_in.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/image_in.py	Sun Aug 26 14:03:02 2012 -0700
@@ -31,7 +31,9 @@
             moin_page.type_: unicode(self.input_type),
             xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
         }
-        return moin_page.object_(attrib=attrib, children=[item_name, ])
+        obj = moin_page.object_(attrib=attrib, children=[item_name, ])
+        body = moin_page.body(children=(obj, ))
+        return moin_page.page(children=(body, ))
 
 
 from . import default_registry
--- a/MoinMoin/converter/include.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/include.py	Sun Aug 26 14:03:02 2012 -0700
@@ -254,10 +254,8 @@
 
                     self.recurse(page_doc, page_href)
 
-                    # if this is an existing item, mark it as a transclusion.  non-existent items are not marked (page_doc.tag.name == u'a')
                     # The href needs to be an absolute URI, without the prefix "wiki://"
-                    if page_doc.tag.name == u'page':
-                        page_doc = mark_item_as_transclusion(page_doc, p_href.path)
+                    page_doc = mark_item_as_transclusion(page_doc, p_href.path)
                     included_elements.append(page_doc)
 
                 if len(included_elements) > 1:
--- a/MoinMoin/converter/nonexistent_in.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/nonexistent_in.py	Sun Aug 26 14:03:02 2012 -0700
@@ -28,8 +28,9 @@
         attrib = {
             xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=modify'),
         }
-        return moin_page.a(attrib=attrib, children=[_("%(item_name)s does not exist. Create it?", item_name=item_name)])
-
+        a = moin_page.a(attrib=attrib, children=[_("%(item_name)s does not exist. Create it?", item_name=item_name)])
+        body = moin_page.body(children=(a, ))
+        return moin_page.page(children=(body, ))
 
 from . import default_registry
 from MoinMoin.util.mime import Type, type_moin_document
--- a/MoinMoin/converter/text_csv_in.py	Sun Aug 26 22:25:00 2012 +0200
+++ b/MoinMoin/converter/text_csv_in.py	Sun Aug 26 14:03:02 2012 -0700
@@ -12,6 +12,7 @@
 
 from ._table import TableMixin
 from ._util import decode_data, normalize_split_text
+from MoinMoin.util.tree import moin_page
 
 
 class Converter(TableMixin):
@@ -39,7 +40,9 @@
                 row.append(encoded_cell.decode('utf-8'))
             if row:
                 rows.append(row)
-        return self.build_dom_table(rows)
+        table = self.build_dom_table(rows)
+        body = moin_page.body(children=(table, ))
+        return moin_page.page(children=(body, ))
 
 
 from . import default_registry