Merge "Hide marked empty elements by default (stage 1)"
This commit is contained in:
commit
4d0d2dd136
7 changed files with 14 additions and 26 deletions
|
|
@ -2688,6 +2688,11 @@ class OutputPage extends ContextSource {
|
|||
$bodyClasses[] = 'capitalize-all-nouns';
|
||||
}
|
||||
|
||||
// Parser feature migration class
|
||||
// The idea is that this will eventually be removed, after the wikitext
|
||||
// which requires it is cleaned up.
|
||||
$bodyClasses[] = 'mw-hide-empty-elt';
|
||||
|
||||
$bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
|
||||
$bodyClasses[] = 'skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
|
||||
$bodyClasses[] =
|
||||
|
|
|
|||
|
|
@ -51,24 +51,6 @@ class MWTidy {
|
|||
return $driver->tidy( $text );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CSS modules needed if HTML from the current driver is to be displayed.
|
||||
*
|
||||
* This is just a migration tool to allow some changes expected as part of
|
||||
* Tidy replacement (T89331) to be exposed on the client side via user
|
||||
* scripts, without actually replacing tidy. See T49673.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getModuleStyles() {
|
||||
$driver = self::singleton();
|
||||
if ( $driver && $driver instanceof MediaWiki\Tidy\RaggettBase ) {
|
||||
return [ 'mediawiki.raggett' ];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check HTML for errors, used if $wgValidateAllHtml = true.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1357,7 +1357,6 @@ class Parser {
|
|||
|
||||
if ( MWTidy::isEnabled() && $this->mOptions->getTidy() ) {
|
||||
$text = MWTidy::tidy( $text );
|
||||
$this->mOutput->addModuleStyles( MWTidy::getModuleStyles() );
|
||||
} else {
|
||||
# attempt to sanitize at least some nesting problems
|
||||
# (bug #2702 and quite a few others)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class RaggettWrapper {
|
|||
// Preserve empty li elements (T49673) by abusing Tidy's datafld hack
|
||||
// The whitespace class is as in TY_(InitMap)
|
||||
$wrappedtext = preg_replace( "!<li>([ \r\n\t\f]*)</li>!",
|
||||
'<li datafld="" class="mw-empty-li">\1</li>', $wrappedtext );
|
||||
'<li datafld="" class="mw-empty-elt">\1</li>', $wrappedtext );
|
||||
|
||||
// Wrap the whole thing in a doctype and body for Tidy.
|
||||
$wrappedtext = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' .
|
||||
|
|
|
|||
|
|
@ -253,3 +253,9 @@ div.tright {
|
|||
div.tleft {
|
||||
margin: .5em 1.4em 1.3em 0;
|
||||
}
|
||||
|
||||
/* Hide elements that are marked as "empty" according to legacy Tidy rules
|
||||
*/
|
||||
.mw-empty-elt, .mw-empty-li {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
.mw-empty-elt,
|
||||
.mw-empty-li {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -27075,8 +27075,8 @@ Empty LI (T49673)
|
|||
!! html/php+tidy
|
||||
<ul>
|
||||
<li>a</li>
|
||||
<li class="mw-empty-li"></li>
|
||||
<li class="mw-empty-li"></li>
|
||||
<li class="mw-empty-elt"></li>
|
||||
<li class="mw-empty-elt"></li>
|
||||
<li>b</li>
|
||||
</ul>
|
||||
!! end
|
||||
|
|
|
|||
Loading…
Reference in a new issue