Page MenuHomePhabricator

Background color captures more than content area
Open, Needs TriagePublic


For archive pages of completed (closed) discussions, a colored background is often made. To do this for the whole page, an opening tag <div style="background-color:gray"> (e.g. by template closed-start {{closed}}) is placed at the top of the page and a closing tag </div> (e.g. by template closed-end {{ecs}}) is placed at the end of the page.

But often only an opening template/tag <div> is put, because the parser autocloses the tags
e.g. lintid=8555846 in oldid=83985028

due to this, many pages fall into the list of linter errors (tens of thousands pages with "Missing end tag - div" in ruwiki e.g. namespase wikipedia).

But, for example, take such a single div: <div style="background-color: #eaecf0; position: absolute; z-index: -1; top: 0; bottom: 0; left: 0; right: 0;"></div>. It was expected that the background will only be in the area in which the text of the article/discussion is located. But in fact, the background extends far beyond the <div class="mw-parser-output">

Is it possible to clarify the boundaries of an mw-parser-output area so that the background remains only inside of<div class="mw-parser-output">?

Is it possible somehow better to make a gray background for the content of individual pages to avoid the constant addition of a closing div for tens of thousands of pages?

Event Timeline

Please see and provide a link where such a problem can be seen.

Jdlrobson added a subscriber: Jdlrobson.

Sounds related to the parser? I'm sure an existing bug around balanced templates exists?

It would be better to use ExtensionTemplateStyles to target .mw-parser-output to have this effect, rather than emit unbalanced tags in wikitext. Dunno if that's possible... but it should be.

In theory T114432: [RFC] Heredoc arguments for templates (aka "hygienic" or "long" arguments) would let you do something like:

{{archived page|<<<

at the top of the page and


at the bottom of the page, with no other changes to the content necessary. Assuming something like T114445: [RFC] Balanced templates, that would also ensure no open tags leak out.

I'm a bit surprised that Remex isn't closing the open <div> at the end of the mw-parser-output. That's probably a bug or othersight somewhere. I've been doing that work as part of T198214: Deprecate and remove non-remex Tidy modes of the core parser; it's possible in fact that would fix it.

TemplateStyles affects blocks inside .mw-parser-output, but does not directly affect .mw-parser-output. Affect the entire page instead of part of the page may be against "Template"Styles goals.

In heredoc way, the parameter 1 will be filled in the templates, which means that the limit of template expand size will be quickly reached.

Expecting a balanced page, with a closing div or heredoc close is incompatible with what is probably the primary use case. If someone uses the new-section button, or casually adds a new content or a new section at the bottom, the closing div will no longer be at the bottom. Not only will that mess up the rendering of the page, but the closing-div may get automatically archived. Archiving would again result in a page with an unclosed div.

All open tags need to be auto-closed at the end of parser output. Anyone who expects tags to always be balanced is working at the wrong website. We're a wiki, and wikitext should not be mistaken for HTML or treated as HTML. We EXPECT clueless or semi-clueless users to put in arbitrary/malformed content, and wikitext is supposed to be more user friendly than HTML.