Skip to content

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

Open

Description

@yii-bot

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?

Activity

  1. added this to the milestone on Nov 22, 2016
  2. removed this from the milestone on Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions