diff MoinMoin/items/__init__.py @ 67:d43c7fb728e0

Items - Move link converter into output Several parts, including macros, may generate internal links. All the link needs to be done after that.
author Bastian Blank <bblank@thinkmo.de>
date Thu, 03 Mar 2011 00:04:52 +0100
parents 1d8e9b1153d6
children efe399a0375b
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Thu Mar 03 00:03:38 2011 +0100
+++ b/MoinMoin/items/__init__.py	Thu Mar 03 00:04:52 2011 +0100
@@ -214,8 +214,6 @@
             input_conv = reg.get(Type(self.mimetype), type_moin_document)
             if not input_conv:
                 raise TypeError("We cannot handle the conversion from %s to the DOM tree" % self.mimetype)
-            link_conv = reg.get(type_moin_document, type_moin_document,
-                    links='extern', url_root=Iri(request.url_root))
             smiley_conv = reg.get(type_moin_document, type_moin_document,
                     icon='smiley')
 
@@ -231,8 +229,6 @@
             for conv in converters:
                 if conv == 'smiley':
                     doc = smiley_conv(doc)
-                elif conv == 'link':
-                    doc = link_conv(doc)
             if cid:
                 app.cache.set(cid, doc)
         flaskg.clock.stop('conv_in_dom')
@@ -240,15 +236,21 @@
 
     def _expand_document(self, doc):
         from MoinMoin.converter import default_registry as reg
+        from MoinMoin.util.iri import Iri
         from MoinMoin.util.mime import type_moin_document
         include_conv = reg.get(type_moin_document, type_moin_document, includes='expandall')
         macro_conv = reg.get(type_moin_document, type_moin_document, macros='expandall')
+        link_conv = reg.get(type_moin_document, type_moin_document, links='extern',
+                url_root=Iri(request.url_root))
         flaskg.clock.start('conv_include')
         doc = include_conv(doc)
         flaskg.clock.stop('conv_include')
         flaskg.clock.start('conv_macro')
         doc = macro_conv(doc)
         flaskg.clock.stop('conv_macro')
+        flaskg.clock.start('conv_link')
+        doc = link_conv(doc)
+        flaskg.clock.stop('conv_link')
         return doc
 
     def _render_data(self):