Merge "Remove menclose in cancel rendering"

This commit is contained in:
jenkins-bot 2024-11-08 07:27:47 +00:00 committed by Gerrit Code Review
commit a7f8306d18
3 changed files with 39 additions and 5 deletions

View file

@ -79,3 +79,31 @@ mtd.mwe-math-matrix-left {
mtd.mwe-math-matrix-right {
border-right: 0.06em solid;
}
/* see https://github.com/w3c/mathml-core/issues/245#issuecomment-2410676518 */
menclose.menclose {
position: relative;
padding: 0.5ex 0;
}
mrow.menclose-updiagonalstrike {
display: inline-block;
position: absolute;
left: 0.5px;
bottom: 0;
width: 100%;
height: 100%;
background-color: currentcolor;
clip-path: polygon( 0.05em 100%, 0 calc( 100% - 0.05em ), calc( 100% - 0.05em ) 0, 100% 0.05em );
}
mrow.menclose-downdiagonalstrike {
display: inline-block;
position: absolute;
left: 0.5px;
bottom: 0;
width: 100%;
height: 100%;
background-color: currentcolor;
clip-path: polygon( 0 0, 0.05em 0, 100% 100%, calc( 100% - 0.05em ) 100% );
}

View file

@ -159,10 +159,14 @@ class BaseParsing {
return $mrow->encapsulateRaw( $node->getArg()->renderMML( $passedArgs ) );
}
public static function cancel( $node, $passedArgs, $operatorContent, $name, $notation = null, $smth2 = null ) {
$mrow = new MMLmrow();
$menclose = new MMLmenclose( "", [ "notation" => $notation ] );
return $mrow->encapsulateRaw( $menclose->encapsulateRaw( $node->getArg()->renderMML() ) );
public static function cancel( Fun1 $node, $passedArgs, $operatorContent, $name, $notation = '' ): string {
$outer = new MMLmenclose( '', [ 'notation' => $notation, 'class' => 'menclose' ] );
$bars = '';
foreach ( explode( ' ', $notation ) as $element ) {
$bars .= ( new MMLmrow( '', [ 'class' => 'menclose-' . $element ] ) )->getEmpty();
}
return $outer->encapsulateRaw( $node->getArg()->renderMML() . $bars );
}
public static function cancelTo( $node, $passedArgs, $operatorContent, $name, $notation = null ) {

View file

@ -67,7 +67,9 @@ class BaseParsingTest extends TestCase {
( new Literal( 'a' ) )
);
$result = BaseParsing::cancel( $node, [], null, 'cancel', 'something' );
$this->assertStringContainsString( '<menclose notation="something"><mi>a</mi></menclose>',
$this->assertStringContainsString( '<mi>a</mi><mrow class="menclose-something"/>',
$result );
$this->assertStringContainsString( '<menclose notation="something" class="menclose">',
$result );
}