Description

copied from MoinMoinBugs

In 1.3, when you go to a missing page it has two content divs, so if you have a theme that has margins for the content div, the content div has double the margins.

In 1.3 this happens because Moin sends the content div and when the page doesn't exist, it sends MissingPage which adds another content div. This is around line 600 in Page.py.

-- EricDavis

(./) In 1.2.2 the version-history and system-info pages get the <div id="content"> twice and thus are indented twice in themes that give the content margins (sidebar-themes)

Suggested solution: change in wikiaction.py:

Reason:

Also the preview in the editor gets indented twice.

Suggested solution: change in PageEditor.py:

@@ -599,7 +599,8 @@
         # start wiki content div
         # Content language and direction is set by the theme
         lang_attr = request.theme.content_lang_attr()
-        request.write('<div id="%s" %s>\n' % (content_id, lang_attr))
+        if not content_only:
+            request.write('<div id="%s" %s>\n' % (content_id, lang_attr))

         # new page?
         if not self.exists() and self.default_formatter and not content_only:

This also fixes the Missing Page bug in 1.3. EricDavis

Even better solution: don't send a separate div in PageEditor.py. -- OliverGraf 2004-06-21 18:22:36

--- orig/MoinMoin/PageEditor.py
+++ mod/MoinMoin/PageEditor.py
@@ -391,9 +391,7 @@
  + '</dl>')
 
         if preview is not None:
-            self.request.write('<div id="preview">')
-            self.send_page(self.request, content_only=1, hilite_re=badwords_re)
-            self.request.write('</div>')
+            self.send_page(self.request, content_only=1, content_id="preview", hilite_re=badwords_re)
 
         self.request.write('</div>') # end content div
         self.request.theme.emit_custom_html(self.cfg.page_footer1)

Another (still partial) diff: preview-div.diff

Suggest one of these fixes be applied to the 1.2 maintenance branch -- NigelMetheringham 2004-09-29 12:33:05

Details

Moin Version: 1.2+

Discussion

Sometimes there are multiple content divs, which might screw up page markup. There are already two new formatter methods (startContent and endContent), which are currently only used in Page.py.

Solution for those multi-problems: add the content_id keyword to endContent. startContent should save its id and endContent should only close its own id. If startContent is used multiple times without endContent, the second and following startContent calls should be ignored (and perhaps the depth should be saved for a later check?). That way we will hopefully only get one content div with a unique id.

But this is sadly not always true: If the same page is included multiple times via the Include macro, all those includes will get the same id. Will this really occur in reality? Will there be multiple include of the same page? The fix is not that easy, perhaps generating a unique content id by adding some pseudo-random number (id of some class used? the formatter?) might help...

-- OliverGraf 2004-06-21 18:53:32

Keeping track is difficult, cause there is no central place where the formatters a kept. There are even places where a saved formatter in the request object is overwritten by some macro, without the knowing of the 'surrounding' code. Perhaps the formatter should get its fix place in the request. Plus some sort of sub-formatters embedded into the current formatter. So the formatters always know if they are a main formatter or just a worker for a page part.

-- OliverGraf 2004-06-21 19:57:06

Plan

See CodeBlockColorizer and IncludeTest (testwiki, is sometimes broken...)


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/ContentDivProblems (last edited 2007-10-29 19:09:08 by localhost)