Skip to content

Commit 8ceaa92

Browse files
marilenaRMMarilena Ruffelaere
andauthored
fix(docs): keep @example tags when a method is seen through several traits (#289)
Assisted-by: Claude Code:Opus-5 Co-authored-by: Marilena Ruffelaere <marilena.ruffelaere@sensiolabs.com>
1 parent 089016a commit 8ceaa92

8 files changed

Lines changed: 66 additions & 8 deletions

File tree

docs/generate.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ private function prepareBuilderFromClass(ReflectionClass $class): void
361361
$parsedDocBlock['tags']['see'],
362362
)));
363363
}
364+
365+
if (isset($parsedDocBlock['tags']['example']) && [] !== $parsedDocBlock['tags']['example']) {
366+
$this->parts['methods']['@'][$method->getShortName()]['tags']['example'] = $parsedDocBlock['tags']['example'];
367+
}
364368
}
365369
}
366370

docs/pdf/HtmlPdfBuilder.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ Adds a file, like an image, font, stylesheet, and so on.<br /><br />By default,
509509
> [!TIP]
510510
> See: [https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets](https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets)
511511
512+
```php
513+
return $gotenberg
514+
// Your builder call as ->html() and the rest of your configuration code
515+
->addAsset('../img/ceo.jpeg')
516+
->generate()
517+
->stream()
518+
;
519+
```
520+
512521
### assets(Stringable|string ...\$paths)
513522
Adds additional files, like images, fonts, stylesheets, and so on (overrides any previous files).<br /><br />By default, the assets files are fetch in the assets folder of your application.<br />If your assets are in another folder, you can override the default value of assets_directory in your<br />configuration file config/sensiolabs_gotenberg.yml.<br />
514523

@@ -518,7 +527,7 @@ Adds additional files, like images, fonts, stylesheets, and so on (overrides any
518527
```php
519528
return $gotenberg
520529
// Your builder call as ->html() and the rest of your configuration code
521-
->assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
530+
->assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
522531
->generate()
523532
->stream()
524533
;

docs/pdf/MarkdownPdfBuilder.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,15 @@ Adds a file, like an image, font, stylesheet, and so on.<br /><br />By default,
573573
> [!TIP]
574574
> See: [https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets](https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets)
575575
576+
```php
577+
return $gotenberg
578+
// Your builder call as ->html() and the rest of your configuration code
579+
->addAsset('../img/ceo.jpeg')
580+
->generate()
581+
->stream()
582+
;
583+
```
584+
576585
### assets(Stringable|string ...\$paths)
577586
Adds additional files, like images, fonts, stylesheets, and so on (overrides any previous files).<br /><br />By default, the assets files are fetch in the assets folder of your application.<br />If your assets are in another folder, you can override the default value of assets_directory in your<br />configuration file config/sensiolabs_gotenberg.yml.<br />
578587

@@ -582,7 +591,7 @@ Adds additional files, like images, fonts, stylesheets, and so on (overrides any
582591
```php
583592
return $gotenberg
584593
// Your builder call as ->html() and the rest of your configuration code
585-
->assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
594+
->assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
586595
->generate()
587596
->stream()
588597
;

docs/pdf/UrlPdfBuilder.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,15 @@ Adds a file, like an image, font, stylesheet, and so on.<br /><br />By default,
506506
> [!TIP]
507507
> See: [https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets](https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets)
508508
509+
```php
510+
return $gotenberg
511+
// Your builder call as ->html() and the rest of your configuration code
512+
->addAsset('../img/ceo.jpeg')
513+
->generate()
514+
->stream()
515+
;
516+
```
517+
509518
### assets(Stringable|string ...\$paths)
510519
Adds additional files, like images, fonts, stylesheets, and so on (overrides any previous files).<br /><br />By default, the assets files are fetch in the assets folder of your application.<br />If your assets are in another folder, you can override the default value of assets_directory in your<br />configuration file config/sensiolabs_gotenberg.yml.<br />
511520

@@ -515,7 +524,7 @@ Adds additional files, like images, fonts, stylesheets, and so on (overrides any
515524
```php
516525
return $gotenberg
517526
// Your builder call as ->html() and the rest of your configuration code
518-
->assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
527+
->assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
519528
->generate()
520529
->stream()
521530
;

docs/screenshot/HtmlScreenshotBuilder.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ Adds a file, like an image, font, stylesheet, and so on.<br /><br />By default,
151151
> [!TIP]
152152
> See: [https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets](https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets)
153153
154+
```php
155+
return $gotenberg
156+
// Your builder call as ->html() and the rest of your configuration code
157+
->addAsset('../img/ceo.jpeg')
158+
->generate()
159+
->stream()
160+
;
161+
```
162+
154163
### assets(Stringable|string ...\$paths)
155164
Adds additional files, like images, fonts, stylesheets, and so on (overrides any previous files).<br /><br />By default, the assets files are fetch in the assets folder of your application.<br />If your assets are in another folder, you can override the default value of assets_directory in your<br />configuration file config/sensiolabs_gotenberg.yml.<br />
156165

@@ -160,7 +169,7 @@ Adds additional files, like images, fonts, stylesheets, and so on (overrides any
160169
```php
161170
return $gotenberg
162171
// Your builder call as ->html() and the rest of your configuration code
163-
->assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
172+
->assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
164173
->generate()
165174
->stream()
166175
;

docs/screenshot/MarkdownScreenshotBuilder.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ Adds a file, like an image, font, stylesheet, and so on.<br /><br />By default,
240240
> [!TIP]
241241
> See: [https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets](https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets)
242242
243+
```php
244+
return $gotenberg
245+
// Your builder call as ->html() and the rest of your configuration code
246+
->addAsset('../img/ceo.jpeg')
247+
->generate()
248+
->stream()
249+
;
250+
```
251+
243252
### assets(Stringable|string ...\$paths)
244253
Adds additional files, like images, fonts, stylesheets, and so on (overrides any previous files).<br /><br />By default, the assets files are fetch in the assets folder of your application.<br />If your assets are in another folder, you can override the default value of assets_directory in your<br />configuration file config/sensiolabs_gotenberg.yml.<br />
245254

@@ -249,7 +258,7 @@ Adds additional files, like images, fonts, stylesheets, and so on (overrides any
249258
```php
250259
return $gotenberg
251260
// Your builder call as ->html() and the rest of your configuration code
252-
->assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
261+
->assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
253262
->generate()
254263
->stream()
255264
;

docs/screenshot/UrlScreenshotBuilder.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ Adds a file, like an image, font, stylesheet, and so on.<br /><br />By default,
166166
> [!TIP]
167167
> See: [https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets](https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets)
168168
169+
```php
170+
return $gotenberg
171+
// Your builder call as ->html() and the rest of your configuration code
172+
->addAsset('../img/ceo.jpeg')
173+
->generate()
174+
->stream()
175+
;
176+
```
177+
169178
### assets(Stringable|string ...\$paths)
170179
Adds additional files, like images, fonts, stylesheets, and so on (overrides any previous files).<br /><br />By default, the assets files are fetch in the assets folder of your application.<br />If your assets are in another folder, you can override the default value of assets_directory in your<br />configuration file config/sensiolabs_gotenberg.yml.<br />
171180
@@ -175,7 +184,7 @@ Adds additional files, like images, fonts, stylesheets, and so on (overrides any
175184
```php
176185
return $gotenberg
177186
// Your builder call as ->html() and the rest of your configuration code
178-
->assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
187+
->assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
179188
->generate()
180189
->stream()
181190
;

src/Builder/Behaviors/Chromium/AssetTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ abstract protected function getBodyBag(): BodyBag;
2525
*
2626
* @see https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets
2727
*
28-
* @example assets('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
28+
* @example assets('../img/ceo.jpeg', __DIR__.'/../../public/admin.jpeg')
2929
*/
3030
public function assets(string|\Stringable ...$paths): static
3131
{
@@ -49,7 +49,7 @@ public function assets(string|\Stringable ...$paths): static
4949
*
5050
* @see https://gotenberg.dev/docs/convert-with-chromium/convert-html-to-pdf#assets
5151
*
52-
* @example addAsset('../img/ceo.jpeg', __DIR__'/../../public/admin.jpeg')
52+
* @example addAsset('../img/ceo.jpeg')
5353
*/
5454
public function addAsset(string|\Stringable $path): static
5555
{

0 commit comments

Comments
 (0)