Coder Social home page Coder Social logo

yiisoft / yii2-apidoc Goto Github PK

View Code? Open in Web Editor NEW
257.0 33.0 121.0 605 KB

Yii 2 apidoc extension.

Home Page: https://www.yiiframework.com

License: BSD 3-Clause "New" or "Revised" License

PHP 95.25% Makefile 0.27% TeX 1.90% Batchfile 0.23% CSS 2.35%
yii yii2 phpdoc api-documentation documentation generator hacktoberfest

yii2-apidoc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-apidoc's Issues

Guide's Mobile version improvement

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


Principle: the guide's text should be the king:

Should have more space for the text;

Menu icon on the right up corner takes the entire line space, pushing the title down;

Should have a floating menu icon having the topics;

"Go to top" icon could be smaller and should not stand so over the text;

I don't think the "pencil" edit icon is useful since editions use to be made via PR. It's only one more thing to stands over the text;

At the end of the each topic it should be a next/before topic links;

[Bug] Apidoc

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


During use apidoc, i found several bug/unexpected result.

Broken link in *.md.

I have README.md with line

- [Change Log](CHANGELOG.md).
- [Basic Usage](docs/guide/basic-usage.md).
- [Using Menu](docs/guide/using-menu.md).

in generated doc (guide-README.html) a good link only for Change Log (guide-CHANGELOG.html) but for Basic Usage and Using Menu dont. Generated link.

<li><a href="guide-CHANGELOG.html">Change Log</a>.</li>
<li><a href="docs/guide/basic-usage.md">Basic Usage</a>.</li>
<li><a href="docs/guide/using-menu.md">Using Menu</a>.</li>

Not read @property clause.

Apidoc only read setter and getter methode but no read from @propety.
I have line

 * @property Menu[] $menus 
 */

...
/**
* @return ActiveQuery
*/
public function getMenus()
{
    return $this->hasMany(...
}

generated doc is [$menus type ActiveQuery] instead of [$menus type Menu[]]

Application exit 😢

I got throw exeption try to get property of non object. No other message, no error line, just apllication exit. I need a full day to investigate this trouble. I found that is caused when we have public methode setXyz() with no parameter. can you add another good error message or error line 😀 ?

Guide: extension's link "all classes" not concerning current class + yii vs extension versions

Let's take the example of the page http://www.yiiframework.com/doc-2.0/yii-bootstrap-html.html, I would like to suggest small improvements in the guide for all extensions:

  1. change "Available since version: 2.0.5" by something like "Available since extension's version: 2.0.5" or "Available since version: yii2-bootstrap 2.0.5"
    so that readers have a hint that it concerns the extension's version and not yii's version (avoiding confusion with overlapping numbers).
  2. At the top of each class's page, change the link behind "All classes":
    -> http://www.yiiframework.com/doc-2.0/index.html (you may also note that when clicking on "all classes" you actually can't come back on the class you were reading)
    by
    -> http://www.yiiframework.com/doc-2.0/ext-bootstrap-index.html (in my example)
    so that it leads to all the class of the extension and would again avoid confusion and mixing unrelated matters.

Exception is thrown in case target directory doesn't exist

Searching files to process... Exception 'yii\base\InvalidParamException' with message 'The dir argument must be a directory: /Users/samdark/src/yiiframework.com/data/yii-2.0/docs/guide'

Instead of throwing an exception it can create a directory.

Code Highlighter

At the moment only the php code highlighter is working.

When i want to use the js code highlighter i use this ```js
but the code is not highlightet.

Apidoc: Handle files with the same name from different sourceDirs

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?

Tables have no spacing

Hi, I trying to create some tables, but there's no border and no spacing on the cells. Am I missing something? Thanks.

First Header  | Second Header
------------- | -------------
Content Cell  | Content Cell
Content Cell  | Content Cell

Can't use custom apidoc templates

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


I tried to create a custom apidoc and guide renderer by extending the one from the bootstrap template.

But it looks to me like I can not get past these two lines, with a custom generator location:
https://github.com/yiisoft/yii2/blob/master/extensions/apidoc/commands/ApiController.php#L145
https://github.com/yiisoft/yii2/blob/master/extensions/apidoc/commands/GuideController.php#L96

Should be i.e. changed to params with absolute paths/NS, what do you think?

so long time spended.

hi it's so long time you dose not work on this repo.
and this part of yii is very important to have api document, setting template get pdf and ...
this repo is the difference by other framework.

@property clause not rendered in documentation with apidoc

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


When use apidoc to generate documentation, @property items in comment immediately before class statement are not published in html.

This example will return in html documentation only "This is the model class for table "tbl_auth_item"",
without all properties declared.

/**
 * This is the model class for table "tbl_auth_item".
 *
 * @property string $name
 * @property integer $type
 * @property string $description
 * @property string $ruleName
 * @property string $data
 *
 */
class PrenotazioniController extends \api\components\BaseController
{
.....
}

magic @property before class declaration

Hi!

I just noticed a @Property which described before a class declarations do not rendered to result apidoc htmls :(

For example, even AR-model classes genereated by gii have such @Property comments for each db field, but they do not appers in the docs.

Other case is for AR-relations. If a model have a relation to (for ex) User model, there is a method like:

/**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(User::className(), ['id' => 'user_id']);
    }

While the method $model->getUser() returns ActiveQuery, the magic property $model->user will return User class instance (see why). I think, it is enough reason to describe the method and property separately.

It is possible to put magic @Property comments/descriptions to the result docs indepenently from the getter/setter method?

Thank you!

Can't install via Composer

$ composer require --prefer-dist yiisoft/yii2-apidoc

Using version ^2.0 for yiisoft/yii2-apidoc
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for cebe/markdown == 1.1.0.0 -> satisfiable by cebe/markdown[1.1.0].
    - yiisoft/yii2-apidoc 2.0.0 requires cebe/markdown-latex * -> satisfiable by cebe/markdown-latex[1.0.0].
    - yiisoft/yii2-apidoc 2.0.1 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
    - yiisoft/yii2-apidoc 2.0.2 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
    - yiisoft/yii2-apidoc 2.0.3 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
    - yiisoft/yii2-apidoc 2.0.4 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
    - Conclusion: don't install cebe/markdown-latex 1.0.0
    - Installation request for yiisoft/yii2-apidoc ^2.0 -> satisfiable by yiisoft/yii2-apidoc[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].


Installation failed, reverting ./composer.json to its original content.

conflicting cebe/markdown with yii2-app-basic

Latest yii2-app-basic (2.0.6, 2015-09-30) has dependency on cebe/markdown 1.1.0 in composer.lock.
This conflicts with yii2-apidoc (cebe/markdown-latex), unable to install through composer.

composer create-project --prefer-dist yiisoft/yii2-app-basic basic
cd basic
composer require --prefer-dist yiisoft/yii2-apidoc 

Result:
Problem 1
- Installation request for cebe/markdown == 1.1.0.0 -> satisfiable by cebe/markdown[1.1.0].
- yiisoft/yii2-apidoc 2.0.0 requires cebe/markdown-latex * -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.1 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.2 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.3 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- yiisoft/yii2-apidoc 2.0.4 requires cebe/markdown-latex ~1.0.0 -> satisfiable by cebe/markdown-latex[1.0.0].
- Conclusion: don't install cebe/markdown-latex 1.0.0
- Installation request for yiisoft/yii2-apidoc ^2.0 -> satisfiable by yiisoft/yii2-apidoc[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].

api is generating with errors

i installed manually composer create-project --prefer-dist yiisoft/yii2-apidoc yii2 2.0.0, it downloads all pretty well.

but then when i generate the api with this command
yii2/apidoc api yii2 ./output

it throws this message

Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
39 files to update.
Processing files... done.(39/39) ETA: 0 sec.
Updating cross references and backlinks... done.
Rendering files: done.(40/40) ETA: 0 sec.
generating extension index files...done.
generating search index...done.
202 errors have been logged to ./output/errors.txt

you can check the file in here

this command is ran under windows 10 cmd

Error: array_unshift() expects parameter 1 to be array, object given

When add a description to a function or a class the apidoc show this error:

Searching files to process... done.
Loading apidoc data from cache... done.
Checking for updated files... done.
1 file to update.
Processing files... done.
Updating cross references and backlinks... done.
Rendering files: 0% (0/2) ETA: n/a Error: array_unshift() expects parameter 1 to be array, object given

[APIdoc] Pdf generation doesn't work.

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


@cebe I tried the APIdoc extension these days, it is awesome! However, i found some bugs.
I installed make and pdflatex, and write a Batch file to automatically publish doc into my friend's GitHub page.
Here is the snippet of PDF generation portion:

@echo off
cd "D:\GitHub\yii2-src\extensions\apidoc"
echo yes|apidoc guide D:\GitHub\yii2-doc-temp D:\GitHub\ab**.github.io\download --template=pdf
cd D:\GitHub\ab**.github.io\download
make pdf
echo "Done! "
pause
exit

error

Btw, the encoding issue which you already know.....It is quiet important for us, since we rely on the site to publish new Chinese translations.

No indication for deprecated methods

Deprecated methods are displayed like others, without any indication that it has been deprecated. It does not even include that in the description of the method, and the @deprecated annotation is just removed.

Change doc style

If I want to change the doc style, and I don't want change the code in vendor folder. How could I do?

Error: Undefined property: stdClass::$methods

Relates to #37

The problem is i have an interface that extends from 'yii\base\ViewContextInterface'. If it doesn't the error doesn't occur.

Stack trace:

Searching files to process... done.
Loading apidoc data from cache... done.
Checking for updated files... done.
1 file to update.
Processing files... done.(1/1) ETA: n/a
Updating cross references and backlinks... PHP Notice 'yii\base\ErrorException'
with message 'Undefined property: stdClass::$methods'

in C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\models\Context.php:187

Stack trace:
#0 C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\components\BaseController.php(
148): yii\apidoc\models\Context->updateReferences()
#1 C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\commands\ApiController.php(108
): yii\apidoc\components\BaseController->updateContext()
#2 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\InlineAction.php(55): yii\apidoc
\commands\ApiController->actionIndex()
#3 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\InlineAction.php(55): ::call_use
r_func_array:{C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\InlineAction.php:55}(
)
#4 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\Controller.php(154): yii\base\In
lineAction->runWithParams()
#5 C:\wamp\www\big-cms\vendor\yiisoft\yii2\console\Controller.php(108): yii\base
\Controller->runAction()
#6 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\Module.php(454): yii\console\Con
troller->runAction()
#7 C:\wamp\www\big-cms\vendor\yiisoft\yii2\console\Application.php(167): yii\bas
e\Module->runAction()
#8 C:\wamp\www\big-cms\vendor\yiisoft\yii2\console\Application.php(143): yii\con
sole\Application->runAction()
#9 C:\wamp\www\big-cms\vendor\yiisoft\yii2\base\Application.php(375): yii\consol
e\Application->handleRequest()
#10 C:\wamp\www\big-cms\vendor\yiisoft\yii2-apidoc\apidoc(53): yii\base\Applicat
ion->run()
#11 {main}

vendor/bin/apidoc api /path..../models ./output

vendor/bin/apidoc api /path..../models ./output

Searching files to process... done.
Loading apidoc data from cache... done.
Checking for updated files... done.
0 files to update.
Processing files... done.
Updating cross references and backlinks... done.
Rendering files: 0% (0/36) ETA: n/a Error: array_unshift() expects parameter 1 to be array, object given

any ideas?

Error: Undefined property: stdClass::$methods

Since a few days i get the following error:

Error: Undefined property: stdClass::$methods

when running (has not changed since):

./vendor/bin/apidoc api [comma seperated list of all folders to lookup] /output/folder/ --pageTitle="TITLE" --interactive=0

Full process:

Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
137 files to update.
Processing files... done.
Updating cross references and backlinks... Error: Undefined property: stdClass::$methods

any idea?

[docs] Anchors not rendered as intended in the github pages

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


In #8168, a link (db-dao.md#database-schema) has been modified as (db-dao.md#working-with-database-schema-). IMO, it should be reverted, since the intended anchor name in db-dao.md is 'database-schema'.

But it seems that the modification has been made based on the fact that the anchors are not rendered as intended in the github pages.

For example, this is what we have in http://www.yiiframework.com/doc-2.0/guide-db-dao.html

<h2>
Working with Database Schema 
<span id="database-schema"></span> 
<a href="#working-with-database-schema"
  id="working-with-database-schema"
  class="hashlink">&para;</a>
</h2>
<p>Yii DAO provides ...

But the counterpart of it in https://github.com/yiisoft/yii2/blob/master/docs/guide/db-dao.md is:

<h2>
<a id="user-content-working-with-database-schema-" 
  class="anchor" 
  href="#working-with-database-schema-" 
  aria-hidden="true">
  <span class="octicon octicon-link"></span>
</a>
Working with Database Schema
</h2>
<p>Yii DAO provides ...

(Note that I've reformatted the htmls for the sake of readability)

As you see, <span id="database-schema"></span> is lost in the github version. And the auto created elements are different from each other.

As far as I understand, the policy in the Yii documentation is to use <span id="anchor-name"></span> for an anchor. And I do favor it, because it is easy to refer to from other places of the documentation.

Especially, the auto created anchors based on the heading's text could be a nightmare for multi-byte languages: they will be URL-encoded. For example, https://github.com/yiisoft/yii2/blob/master/docs/guide-ja/db-dao.md goes like the following:

<h2>
<a id="user-content-データベーススキーマを扱う-" 
  class="anchor"
  href="#%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%82%B9%E3%82%AD%E3%83%BC%E3%83%9E%E3%82%92%E6%89%B1%E3%81%86-"
  aria-hidden="true">
  <span class="octicon octicon-link"></span>
</a>
データベーススキーマを扱う 
</h2>
<p>Yii DAO は、...

It will be very hard for us to use and maintain such an anchor in the documentation source text.

Although the fact is that the anchors in the span tags are not rendered as intended in the github pages, and I think that we have to deal with the following problems:

  1. In the github pages, the anchors won't work. This is inconvenient even if you are using them just for previewing purpose.
  2. In the Yii site, we don't have the documentations of apps and extensions yet. As for now, the links to them from the Yii 2 guide can do nothing but point to the github pages.

Error: Interface 'PHPParser_NodeVisitor' not found

$ vendor/bin/apidoc api vendor/yiisoft/yii2 out
Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
331 files to update.
Processing files... 0% (0/331) ETA: n/a   PHP Fatal error:  Interface 'PHPParser_NodeVisitor' not found in /Library/WebServer/Documents/yii2doc/vendor/phpdocumentor/reflection/src/phpDocumentor/Reflection/FileReflector.php on line 51
Error: Interface 'PHPParser_NodeVisitor' not found

php7 scalar type hints problem

For example:

class {
    public static function cacheGetTime() :  int
    {
        return 3600;
    }
}

And that file is no apidoc generation. Problem in ": int" because without him all work

Special characters broken in the PDF content - apidoc

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


I ran the following command to export the pt-BR guide in PDF.

extensions/apidoc/apidoc guide docs/guide-pt-BR ./output
cd ./output
make pdf

When I analyzed the PDF content, I realized that the comments with special characters in code blocks were broken.

main

Is there some setting I can apply or is even an error?

Can't access to message property of HttpException.

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


Hello, I can't access to message property of exception's object. Is in normal?

My simple code:

  #SiteController.php
  #I changed errorHandler action to site/error in configurations.
  public function actionError()
  {
    $this->layout = 'container';
    if (\Yii::$app->exception !== null) {
      return $this->render('error', ['exception' => \Yii::$app->exception]);
    }
  }

  public function actionPage($view = 'index')
  {
    try {
      return $this->render('site/page/'.$view);
    } catch (InvalidParamException $e) {
      throw new HttpException(404, 'Страница не найдена');
    }
  }

When I go to nonexist page, I get the following:

yii\web\HttpException Object
(
    [statusCode] => 404
    [message:protected] => Страница не найдена #custom message naturally inaccessible

It means that I can't insert $exception->message into view file.

Create API documentation only for user extension (without Yii core) but related with yii2 apidoc (class reference)

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


How to create api documentation only for my extension (without yii core) but related with yii2 apidoc (class refence)? Good point if can related with http://www.yiiframework.com/doc-2.0/.
When executed like this

./bin/apidoc api mdmsoft/yii2-admin ../admin-apidoc

it will provide error message (errors.txt) "Method ini has no parent to inherit from in mdm\admin\Module".
When executed

./bin/apidoc api mdmsoft/yii2-admin,yiisoft/yii2 ../admin-apidoc

it will generate both of them and index file only list yii2 classes (no mdmsoft classes on index.html)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.