yii2-apidoc icon indicating copy to clipboard operation
yii2-apidoc copied to clipboard

Fix `ApiMarkdown::renderLink()`

Open WinterSilence opened this issue 3 years ago • 7 comments
trafficstars

Normalizes .md URLs

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues #286

WinterSilence avatar Jun 12 '22 19:06 WinterSilence

@rob006 what's wrong?

WinterSilence avatar Jun 19 '22 16:06 WinterSilence

@WinterSilence You didn't explained your change and I'm not sure how these changes could help with https://github.com/yiisoft/yii2-apidoc/issues/286. Right now renderLink() implementation just don't make any sense - you have a lot of dead code, because both preg_replace_callback() calls do exactly the same.

https://github.com/yiisoft/yii2-apidoc/issues/286 is weird, because there are 2 nearly identical links, but only one of them works. Did you figure out what is so special about second link that it is incorrectly rendered?

rob006 avatar Jun 19 '22 21:06 rob006

@rob006

Did you figure out what is so special about second link that it is incorrectly rendered?

link don't have guide: prefix: [Filtering Data](output-data-widgets.md#filtering-data) and [Separate Filter Form](output-data-widgets.md#separate-filter-form)

Prefix is bad idea, because prefixed links not works in github wiki.

do exactly the same

i don't want create method with duplicated code

WinterSilence avatar Jun 19 '22 22:06 WinterSilence

link don't have guide: prefix: [Filtering Data](output-data-widgets.md#filtering-data) and [Separate Filter Form](output-data-widgets.md#separate-filter-form)

First link does not have guide prefix and it works, so that's not it.

rob006 avatar Jun 20 '22 09:06 rob006

@rob006 what link are you talking about?

WinterSilence avatar Jun 20 '22 14:06 WinterSilence

"Filtering Data" is ok, only "Separate Filter Form" is broken.

rob006 avatar Jun 20 '22 14:06 rob006

@rob006 aaa... you about this: greedy condition in RegExp

WinterSilence avatar Jun 21 '22 06:06 WinterSilence

Thanks for contributing and sorry for the late review again.

I checked these changes locally and unfortunately they do nothing. Both before and after them the last mentioned problematic link is rendered like this:

<a href="guide-output-data-widgets.html#separate-filter-form">Separate Filter Form</a>

So I guess either the rendered version shown at production site is outdated or there is some additional post processing done at site level.

The bottom line is it can't be merged in the current state.

arogachev avatar Sep 13 '22 07:09 arogachev

@arogachev how you test it? ApiMarkdown::process('[Filtering Data](output-data-widgets.md#filtering-data) and [Separate Filter Form](output-data-widgets.md#separate-filter-form) returns correct result

there is some additional post processing done at site level

"site" don't don't post-fix results

WinterSilence avatar Sep 13 '22 08:09 WinterSilence

  1. Using guide console command on the whole en guide (before and after the changes).
  2. Might be something here, need to check more thoroughly.

arogachev avatar Sep 13 '22 09:09 arogachev

@arogachev 1. this PR changed only yii\apidoc\helpers\ApiMarkdown, incorrect test it by guide command. This PR not full fix for #286. 2. as I'm already told you, this is bug in apidoc

WinterSilence avatar Sep 13 '22 10:09 WinterSilence

@WinterSilence Can you provide failing unit tests and then show how your change fixes it?

rob006 avatar Sep 13 '22 10:09 rob006

@rob006

WinterSilence avatar Sep 15 '22 12:09 WinterSilence