Anonymous avatar Anonymous committed d43c7fb

Items - Move link converter into output

Several parts, including macros, may generate internal links. All the
link needs to be done after that.

Comments (0)

Files changed (1)

MoinMoin/items/__init__.py

             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')
 
             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')
 
     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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.