Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor word wrapping and on-node properties #817

Closed
wants to merge 9 commits into from

Conversation

alex-mashin
Copy link
Contributor

@alex-mashin alex-mashin commented Feb 26, 2024

Refactor word wrapping and on-node properties, to facilitate further changes.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.68%. Comparing base (6509f4a) to head (0808f8f).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #817      +/-   ##
============================================
- Coverage     40.12%   39.68%   -0.44%     
+ Complexity     2332     2329       -3     
============================================
  Files            78       78              
  Lines          8247     8322      +75     
============================================
- Hits           3309     3303       -6     
- Misses         4938     5019      +81     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alex-mashin alex-mashin marked this pull request as ready for review February 26, 2024 09:25
@alex-mashin
Copy link
Contributor Author

@YOUR1, please take part in the review.

@@ -118,7 +119,7 @@ class GraphFormatterTest extends \PHPUnit\Framework\TestCase {
* @return GraphFormatter
*/
private static function graph( array $case ): GraphFormatter {
$graph = new GraphFormatter( new GraphOptions( GraphFormatterTest::BASE_PARAMS + $case['params'] ) );
$graph = new GraphFormatter( new GraphOptions( array_merge( GraphFormatterTest::BASE_PARAMS, $case['params'] ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why you changed this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+ was an error. In this place $case['params'] should override GraphFormatterTest::BASE_PARAMS.

. '</td></tr>';
}, $fields ) ) . "\n</table>\n>";
$label = $nodeLabel ?: $node->getID();
$nodeTooltip = htmlspecialchars( $label );
Copy link
Contributor

@YOUR1 YOUR1 Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version replaced the <br /> with '' when the Diagrams extension was loaded if im correct. What happened to that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate. Replaced where?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version replaced the '' with '' when the Diagrams extension was loaded if im correct. What happened to that?

I presume you mean the tooltip. OK, I have wrapped it with $this->getWordWrappedText().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion; Github did a weird thing with my <br />.

You refactored this part;

if ( version_compare( $wgVersion, '1.33', '>=' ) &&
   \ExtensionRegistry::getInstance()->isLoaded( 'Diagrams' ) ) {
   $nodeTooltip = str_replace( '<br />', '', $nodeTooltip );
}

But I can't find that anywhere now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, node tooltip for table nodes (with fields) for Diagrams should have line breaks instead of <br />?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, a question: could you please check how Diagrams will treat \n escape sequence in a quoted node label or identifier, like [label="First line\nsecond line"] or "First line\second line" -> 'Other node"?

$this->getWordWrappedText( )
@krabina
Copy link
Contributor

krabina commented May 4, 2024

Can we merge this, @YOUR1 ?

@alex-mashin
Copy link
Contributor Author

Can we merge this, @YOUR1 ?

No, we shouldn't. I am abandoning this request. I have fully rewritten the whole format, only unit tests are remaining.

@alex-mashin
Copy link
Contributor Author

Abandoning in favour of a more significant change.

@alex-mashin alex-mashin closed this May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants