Skip to content

Conversation

nikophil
Copy link
Collaborator

@nikophil nikophil commented Apr 8, 2021

Hello,

this is a solution in response to this PR
doctrine/rst-parser#144

I used composition over inheritance for both classes where we was extending parser's classes.
This way @greg0ire could cleanly close the parser's api without exceptions.

@nikophil nikophil requested a review from weaverryan April 8, 2021 07:41
Comment on lines +61 to +73
public function reference(ResolvedReference $reference, array $value): string
{
if (!$this->isSafeUrl($reference->getUrl())) {
$reference = new ResolvedReference(
$reference->getFile(),
$reference->getTitle(),
$reference->getUrl(),
$reference->getTitles(),
$this->addAttributesForUnsafeUrl($reference->getAttributes())
);
}

return $this->decoratedSpanNodeRenderer->reference($reference, $value);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this part was a bit tricky because BaseSpanNodeRenderer::reference() internally calls BaseSpanNodeRenderer::link() thus I had to update the attributes here inside the reference

@weaverryan weaverryan merged commit 5d3b600 into symfony-tools:main Apr 14, 2021
@weaverryan
Copy link
Contributor

Wow, yea, a bit complex on the SpanNodeRenderer - that is complex enough already! But, tests pass and the change looks reasonable. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants