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

Simplifying base templates #73

Open
wants to merge 32 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7623226
Disable throws output
shcherbanich Jan 17, 2024
9163a7b
Adding new API methods
shcherbanich Jan 18, 2024
6faa28f
Updating templates
shcherbanich Jan 18, 2024
c3c31dc
Fixing breadcrumbs generator
shcherbanich Jan 18, 2024
4ce3895
Output data in MD format
shcherbanich Jan 18, 2024
170ac12
Use more md syntax instead of filters
shcherbanich Jan 18, 2024
a7ca6ab
Use more md syntax instead of filters
shcherbanich Jan 18, 2024
6c657c4
Removing old functions
shcherbanich Jan 18, 2024
7118cd2
Fixing templates
shcherbanich Jan 18, 2024
dfe1be3
Page linker generates MD instead of HTML
shcherbanich Jan 18, 2024
1faeba9
Generate md instead of HTML
shcherbanich Jan 18, 2024
5fb2400
Generate md instead of HTML
shcherbanich Jan 18, 2024
4dbe851
Generate md instead of HTML
shcherbanich Jan 18, 2024
586857e
Fix Daux links
shcherbanich Jan 18, 2024
b988eb1
Updating templates
shcherbanich Jan 18, 2024
b224447
Updating doc
shcherbanich Jan 18, 2024
55ab859
Using MD instead of HTML
shcherbanich Jan 19, 2024
485f97d
Mark properties as readonly
shcherbanich Jan 19, 2024
6945815
Adding new func to get relative url
shcherbanich Jan 19, 2024
ea03e97
Change method to generate entities breadcrumbs
shcherbanich Jan 19, 2024
d89610e
Change method generate links
shcherbanich Jan 19, 2024
40725cb
Fix url changer
shcherbanich Jan 19, 2024
cb597a7
Change linking method
shcherbanich Jan 19, 2024
1011d7b
Change linking method
shcherbanich Jan 19, 2024
a1aae73
Updating doc
shcherbanich Jan 19, 2024
ef85387
Updating doc
shcherbanich Jan 19, 2024
147c223
Adding a new setting for documenting internal links
shcherbanich Jan 19, 2024
363dbc2
Renaming relative url calculator function
shcherbanich Jan 19, 2024
e09278c
Updating doc
shcherbanich Jan 19, 2024
6683b93
Renaming function to generate breadcrumbs
shcherbanich Jan 19, 2024
a727e64
Fixing template
shcherbanich Jan 19, 2024
a5a19d8
Updating doc
shcherbanich Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ This document serves as a reference for updating your current version of the Bum
* Class `\BumbleDocGen\LanguageHandler\Php\Plugin\Event\Entity\OnCheckIsClassEntityCanBeLoad` has been removed. Use `\BumbleDocGen\LanguageHandler\Php\Plugin\Event\Entity\OnCheckIsEntityCanBeLoaded`
* ⚠️**PHP ReflectionAPI has been completely changed. See information about the current version here:** [ReflectionAPI](https://github.com/bumble-tech/bumble-doc-gen/tree/master/docs/tech/2.parser/reflectionApi)
* Method `\BumbleDocGen\LanguageHandler\Php\PhpHandlerSettings::getComposerInstalledFile()` renamed to `\BumbleDocGen\LanguageHandler\Php\PhpHandlerSettings::getComposerVendorDir()`
* Twig filter `\BumbleDocGen\Core\Renderer\Twig\Filter\TextToCodeBlock` removed
* Twig filter `\BumbleDocGen\Core\Renderer\Twig\Filter\TextToHeading` removed
* Plugin `\BumbleDocGen\Core\Plugin\CorePlugin\PageLinker\PageLinkerPlugin` now generates MD instead of HTML
* Twig function `\BumbleDocGen\Core\Renderer\Twig\Function\GeneratePageBreadcrumbs` removed. Use `\BumbleDocGen\Core\Renderer\Twig\Function\DrawPageBreadcrumbs` function instead
8 changes: 5 additions & 3 deletions demo/demo1/templates/classMap/index.md.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
title: Class map
---
{{ generatePageBreadcrumbs(title, _self) }}
{{ drawPageBreadcrumbs() }}

{{ "Class map epample" | textToHeading('H1') }}
# Class map example

{{ "{{ drawClassMap( phpEntities ) }}" | textToCodeBlock('twig') }}
```twig
{{ "{{ drawClassMap( phpEntities ) }}" }}
```

**The result of the function execution:**

Expand Down
7 changes: 4 additions & 3 deletions demo/demo1/templates/readme.md.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
title: Demo 1
---
{{ "Demo 1" | textToHeading('H1') }}
# Demo 1

{{ drawDocumentationMenu() }}


To update this documentation, run the following command:

{{ 'php demo/demo1/demoScript.php' | textToCodeBlock('console') }}
```console
php demo/demo1/demoScript.php
```
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
title: Class list example
---
{{ generatePageBreadcrumbs(title, _self) }}
{{ drawPageBreadcrumbs() }}

{{ "Class list" | textToHeading('H1') }}
# Class list

**List of classes filtered by the directory where they are located.**

{{ "{{ printEntityCollectionAsList( phpEntities.filterByPaths(['/annotations']) ) }}" | textToCodeBlock('twig') }}
```twig
{{ "{{ printEntityCollectionAsList( phpEntities.filterByPaths(['/annotations']) ) }}" }}
```

{{ printEntityCollectionAsList( phpEntities.filterByPaths(['/annotations']) ) }}
8 changes: 5 additions & 3 deletions demo/demo1/templates/sectionWithSubsections/index.md.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
title: Section with subsections
---
{{ generatePageBreadcrumbs(title, _self) }}
{{ drawPageBreadcrumbs() }}

{{ "Section with subsections example" | textToHeading('H1') }}
# Section with subsections example

{{ "{{ drawDocumentationMenu(_self) }}" | textToCodeBlock('twig') }}
```twig
{{ "{{ drawDocumentationMenu(_self) }}" }}
```

**Documentation menu from current page only:**

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Page linking example
---
{{ generatePageBreadcrumbs(title, _self) }}
{{ drawPageBreadcrumbs() }}

{{ "Page linking example" | textToHeading('H1') }}
# Page linking example

1) [a]InvalidArgumentException[/a] - create a reference by short class name
2) [a]Doctrine\Common\Annotations\AnnotationException[/a] - creating a reference by full class name
Expand Down
6 changes: 4 additions & 2 deletions demo/demo4-config-array/templates/README.md.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
title: Demo 5
---
{{ "Demo 5" | textToHeading('H1') }}
# Demo 5

{{ printEntityCollectionAsList( phpEntities.filterByPaths(['/annotations']) ) }}

To update this documentation, run the following command:

{{ 'php demo/demo4-config-array/demoScript.php' | textToCodeBlock('console') }}
```console
php demo/demo4-config-array/demoScript.php
```
99 changes: 47 additions & 52 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,82 @@
<embed> <h1>BumbleDocGen: A Documentation Generator for PHP projects 🐝</h1> </embed>
# BumbleDocGen: A Documentation Generator for PHP projects 🐝

<b>BumbleDocGen</b> is a robust library for generating and maintaining documentation next to the code of large and small PHP projects.
**BumbleDocGen** is a robust library for generating and maintaining documentation next to the code of large and small PHP projects.

This tool analyzes your codebase and produces a comprehensive set of Markdown documents, including descriptions of classes, methods, and properties alongside navigable internal links.

<embed> <h2>Installation</h2> </embed>
## Installation

Add the BumbleDocGen to the `composer.json` file of your project using the following command:

```console
composer require bumble-tech/bumble-doc-gen
composer require bumble-tech/bumble-doc-gen
```

## Detailed technical description

<embed> <h2>Detailed technical description</h2> </embed>
💡 Please refer to the [Description of the technical part of the project](/docs/tech/readme.md) for a detailed explanation of all the classes and methods used.

💡 Please refer to the <a href="/docs/tech/readme.md">Description of the technical part of the project</a> for a detailed explanation of all the classes and methods used.
## Core Features

<embed> <h2>Core Features</h2> </embed>
1. 🔍 **[Parsing](/docs/tech/02_parser/readme.md):**
BumbleDocGen analyzes your code and provides a convenient [Reflection API](/docs/tech/02_parser/reflectionApi/readme.md).

- 🔍 <b><a href="/docs/tech/02_parser/readme.md">Parsing</a>:</b>
BumbleDocGen analyzes your code and provides a convenient <a href="/docs/tech/02_parser/reflectionApi/readme.md">Reflection API</a>.

- ✍️ <b><a href="/docs/tech/03_renderer/readme.md">Rendering</a>:</b>
2. ✍️ **[Rendering](/docs/tech/03_renderer/readme.md):**
BumbleDocGen generates markdown content using templates and fills them with data obtained from parsing your code.

- 🧠 <b>AI tools for documentation generation:</b>
3. 🧠 **AI tools for documentation generation:**
BumbleDocGen allows you to use a group of AI tools to help generate project documentation.

<embed> <h2>How to Use</h2> </embed>
## How to Use

<embed> <h3>Entry points</h3> </embed>
### Entry points

BumbleDocGen's interface consists of mainly two classes: <a href="/docs/classes/DocGenerator.md">DocGenerator</a> and <a href="/docs/classes/DocGeneratorFactory.md">DocGeneratorFactory</a>.
BumbleDocGen's interface consists of mainly two classes: [DocGenerator](classes/DocGenerator.md) and [DocGeneratorFactory](classes/DocGeneratorFactory.md).

- <a href="/docs/classes/DocGenerator.md">DocGenerator</a> provides main operations for generating the documents.
- [DocGenerator](classes/DocGenerator.md) provides main operations for generating the documents.

- [addDocBlocks()](/docs/classes/DocGenerator.md#madddocblocks): Generate missing docBlocks with LLM for project class methods that are available for documentation
- [generate()](/docs/classes/DocGenerator.md#mgenerate): Generates documentation using configuration
- [generateReadmeTemplate()](/docs/classes/DocGenerator.md#mgeneratereadmetemplate): Creates a `README.md` template filled with basic information using LLM
- [serve()](/docs/classes/DocGenerator.md#mserve): Serve documentation
- [addDocBlocks()](classes/DocGenerator.md#madddocblocks): Generate missing docBlocks with LLM for project class methods that are available for documentation
- [generate()](classes/DocGenerator.md#mgenerate): Generates documentation using configuration
- [generateReadmeTemplate()](classes/DocGenerator.md#mgeneratereadmetemplate): Creates a `README.md` template filled with basic information using LLM
- [serve()](classes/DocGenerator.md#mserve): Serve documentation

- <a href="/docs/classes/DocGeneratorFactory.md">DocGeneratorFactory</a> provides a method for creating `DocGenerator` instance.
- [DocGeneratorFactory](classes/DocGeneratorFactory.md) provides a method for creating `DocGenerator` instance.

- [create()](/docs/classes/DocGeneratorFactory.md#mcreate): Creates a documentation generator instance using configuration files
- [createByConfigArray()](/docs/classes/DocGeneratorFactory.md#mcreatebyconfigarray): Creates a documentation generator instance using an array containing the configuration
- [createConfiguration()](/docs/classes/DocGeneratorFactory.md#mcreateconfiguration): Creating a project configuration instance
- [createRootEntitiesCollection()](/docs/classes/DocGeneratorFactory.md#mcreaterootentitiescollection): Creating a collection of entities (see `ReflectionAPI`)
- [create()](classes/DocGeneratorFactory.md#mcreate): Creates a documentation generator instance using configuration files
- [createByConfigArray()](classes/DocGeneratorFactory.md#mcreatebyconfigarray): Creates a documentation generator instance using an array containing the configuration
- [createConfiguration()](classes/DocGeneratorFactory.md#mcreateconfiguration): Creating a project configuration instance
- [createRootEntitiesCollection()](classes/DocGeneratorFactory.md#mcreaterootentitiescollection): Creating a collection of entities (see `ReflectionAPI`)

<embed> <h3>Examples of usage</h3> </embed>
### Examples of usage

1) Working with a library in a PHP file
```php
require_once 'vendor/autoload.php';

```php
require_once 'vendor/autoload.php';

use BumbleDocGen\DocGeneratorFactory;

// Initialize the factory
$factory = new DocGeneratorFactory();
use BumbleDocGen\DocGeneratorFactory;

// Create a DocGenerator instance
$docgen = $factory->create('/path/to/configuration/files');
// Initialize the factory
$factory = new DocGeneratorFactory();

// or $docgen = $factory->createByConfigArray([...]);
// Create a DocGenerator instance
$docgen = $factory->create('/path/to/configuration/files');

// Now call the desired operation
$docgen->generate();
```
// or $docgen = $factory->createByConfigArray([...]);

// Now call the desired operation
$docgen->generate();
```
2) Working with the library through a console application
```bash
# List of available commands
./vendor/bin/bumbleDocGen list

```bash
# List of available commands
./vendor/bin/bumbleDocGen list

# Documentation generation example
./vendor/bin/bumbleDocGen generate -c <path to config file>
# Documentation generation example
./vendor/bin/bumbleDocGen generate -c <path to config file>

# Getting detailed information about a command
./vendor/bin/bumbleDocGen generate -h
```
# Getting detailed information about a command
./vendor/bin/bumbleDocGen generate -h
```

------------------

Expand All @@ -89,11 +85,10 @@ $docgen->generate();
To update this documentation, run the following command:

```console
./bin/bumbleDocGen generate
./bin/bumbleDocGen generate
```


---

<div id='page_committer_info'>
<hr>
<b>Last page committer:</b> fshcherbanich &lt;[email protected]&gt;<br><b>Last modified date:</b> Sat Dec 23 23:00:37 2023 +0300<br><b>Page content update date:</b> Mon Jan 15 2024<br>Made with <a href='https://github.com/bumble-tech/bumble-doc-gen/blob/master/docs/README.md'>Bumble Documentation Generator</a></div>
**Last page committer:** fshcherbanich &lt;[email protected]&gt;<br>**Last modified date:** Thu Jan 18 14:38:29 2024 +0300<br>**Page content update date:** Fri Jan 19 2024<br>Made with [Bumble Documentation Generator](https://github.com/bumble-tech/bumble-doc-gen/blob/master/docs/README.md)
Loading