[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2024-06-21 09:56:41 +00:00 committed by xiaoyifang
parent a3d7c89563
commit fd94f31209
2 changed files with 7 additions and 9 deletions

View file

@ -622,13 +622,13 @@ void StardictDictionary::pangoToHtml( QString & text )
int pos = 0; int pos = 0;
do { do {
auto match = spanRegex.match( text, pos ); auto match = spanRegex.match( text, pos );
pos = match.capturedStart(); pos = match.capturedStart();
if ( pos >= 0 ) { if ( pos >= 0 ) {
QString styles = match.captured( 1 ); QString styles = match.captured( 1 );
QString newSpan( "<span style=\"" ); QString newSpan( "<span style=\"" );
int stylePos = 0; int stylePos = 0;
do { do {
auto styleMatch= styleRegex.match( styles, stylePos ); auto styleMatch = styleRegex.match( styles, stylePos );
stylePos = styleMatch.capturedStart(); stylePos = styleMatch.capturedStart();
QString style = styleMatch.captured( 1 ); QString style = styleMatch.captured( 1 );
@ -748,8 +748,8 @@ void StardictDictionary::pangoToHtml( QString & text )
else if ( style.compare( "font_size", Qt::CaseInsensitive ) == 0 else if ( style.compare( "font_size", Qt::CaseInsensitive ) == 0
|| style.compare( "size", Qt::CaseInsensitive ) == 0 ) { || style.compare( "size", Qt::CaseInsensitive ) == 0 ) {
if ( cap2[ 0 ].isLetter() || cap2.endsWith( "px", Qt::CaseInsensitive ) if ( cap2[ 0 ].isLetter() || cap2.endsWith( "px", Qt::CaseInsensitive )
|| cap2.endsWith( "pt", Qt::CaseInsensitive ) || cap2.endsWith( "pt", Qt::CaseInsensitive ) || cap2.endsWith( "em", Qt::CaseInsensitive )
|| cap2.endsWith( "em", Qt::CaseInsensitive ) || cap2.endsWith( "%" ) ) || cap2.endsWith( "%" ) )
newSpan += QString( "font-size:" ) + cap2 + ";"; newSpan += QString( "font-size:" ) + cap2 + ";";
else { else {
int size = cap2.toInt(); int size = cap2.toInt();
@ -831,8 +831,7 @@ void StardictDictionary::pangoToHtml( QString & text )
newSpan += QString( "text-decoration-line:none;" ); newSpan += QString( "text-decoration-line:none;" );
} }
else if ( style.compare( "rise", Qt::CaseInsensitive ) == 0 ) { else if ( style.compare( "rise", Qt::CaseInsensitive ) == 0 ) {
if ( cap2.endsWith( "px", Qt::CaseInsensitive ) if ( cap2.endsWith( "px", Qt::CaseInsensitive ) || cap2.endsWith( "pt", Qt::CaseInsensitive )
|| cap2.endsWith( "pt", Qt::CaseInsensitive )
|| cap2.endsWith( "em", Qt::CaseInsensitive ) || cap2.endsWith( "%" ) ) || cap2.endsWith( "em", Qt::CaseInsensitive ) || cap2.endsWith( "%" ) )
newSpan += QString( "vertical-align:" ) + cap2 + ";"; newSpan += QString( "vertical-align:" ) + cap2 + ";";
else { else {
@ -842,8 +841,7 @@ void StardictDictionary::pangoToHtml( QString & text )
} }
} }
else if ( style.compare( "letter_spacing", Qt::CaseInsensitive ) == 0 ) { else if ( style.compare( "letter_spacing", Qt::CaseInsensitive ) == 0 ) {
if ( cap2.endsWith( "px", Qt::CaseInsensitive ) if ( cap2.endsWith( "px", Qt::CaseInsensitive ) || cap2.endsWith( "pt", Qt::CaseInsensitive )
|| cap2.endsWith( "pt", Qt::CaseInsensitive )
|| cap2.endsWith( "em", Qt::CaseInsensitive ) || cap2.endsWith( "%" ) ) || cap2.endsWith( "em", Qt::CaseInsensitive ) || cap2.endsWith( "%" ) )
newSpan += QString( "letter-spacing:" ) + cap2 + ";"; newSpan += QString( "letter-spacing:" ) + cap2 + ";";
else { else {

View file

@ -1089,7 +1089,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
idxHeader.langTo = getLanguageId( str.c_str() ); idxHeader.langTo = getLanguageId( str.c_str() );
QRegularExpression regNum( "\\d+" ); QRegularExpression regNum( "\\d+" );
auto match = regNum.match( stream.attributes().value( "revision" ).toString() ); auto match = regNum.match( stream.attributes().value( "revision" ).toString() );
idxHeader.revisionNumber = match.captured().toUInt(); idxHeader.revisionNumber = match.captured().toUInt();
bool isLogical = bool isLogical =