diff MoinMoin/formatter/__init__.py @ 2572:ce0787373150

introduce ID cache in request, make everybody generate valid IDs even inside includes fixes the TOC macro, top/bottom etc. links inside includes, also [#anchorlinks] etc.
author Johannes Berg <johannes AT sipsolutions DOT net>
date Thu, 26 Jul 2007 16:29:13 +0200
parents 01f05e74aa9c
children f4c371b00fec
line wrap: on
line diff
--- a/MoinMoin/formatter/__init__.py	Thu Jul 26 16:26:44 2007 +0200
+++ b/MoinMoin/formatter/__init__.py	Thu Jul 26 16:29:13 2007 +0200
@@ -69,9 +69,13 @@
         return ""
 
     def startContent(self, content_id="content", **kw):
+        if self.page:
+            self.request.begin_include(self.page.page_name)
         return ""
 
     def endContent(self):
+        if self.page:
+            self.request.end_include()
         return ""
 
     # Links ##############################################################
@@ -309,6 +313,7 @@
         """ parser_name MUST be valid!
             writes out the result instead of returning it!
         """
+        # attention: this is copied into text_python!
         parser = wikiutil.searchAndImportPlugin(self.request.cfg, "parser", parser_name)
 
         args = self._get_bang_args(lines[0])
@@ -359,3 +364,9 @@
     def comment(self, text, **kw):
         return ""
 
+    def make_id_unique(self, id):
+        id = self.request.make_unique_id(id, self.request.include_id)
+        if self.request.include_id:
+            id = '%s.%s' % (
+                wikiutil.anchor_name_from_text(self.request.include_id), id)
+        return id