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

Apidoc: Handle files with the same name from different sourceDirs #45

Open
yii-bot opened this issue Jan 24, 2016 · 0 comments
Open

Apidoc: Handle files with the same name from different sourceDirs #45

yii-bot opened this issue Jan 24, 2016 · 0 comments
Labels

Comments

@yii-bot
Copy link

yii-bot commented Jan 24, 2016

This issue has originally been reported by @schmunk42 at yiisoft/yii2#3547.
Moved here by @cebe.


As you can specify different sourceDirs when rendering a guide, apidoc should also be able to correctly link to different files, even if they have the same source name.

Eg, if you specify two directories and both contain a README.md file you'll see both files in the index in the left sidebar, but you can access only one of them, since they have the same filename when rendered.

I played around with something like this:

protected function generateGuideFileName($file)
{
    $uniqueFileName = static::GUIDE_PREFIX . substr(sha1($file),0,6) . '-' . basename($file, '.md');
    return $uniqueFileName . '.html';
}

But it needs to be handled in more places, like generateGuideUrl.

What do you think about the approach adding a hash to the filename, any other ideas?

@cebe cebe added the type:bug Bug label Jan 24, 2016
@cebe cebe added this to the 2.0.x milestone Nov 22, 2016
@samdark samdark removed this from the 2.0.x milestone Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants