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

fix: doc generator builder case #123

Closed
wants to merge 1 commit into from
Closed

Conversation

rhyd42
Copy link
Contributor

@rhyd42 rhyd42 commented Dec 6, 2024

Case of 'Pdf' and 'Screenshot' causes broken links in generated documentation

Case of 'Pdf' and 'Screenshot' causes broken links in generated documentation
@@ -20,15 +20,15 @@
* @var array<string, non-empty-list<class-string>>
*/
const BUILDERS = [
'Pdf' => [
'pdf' => [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pdf should be kept since it's used to generate the title.

pdf and screenshot folders should be renamed to fix links. Also, the CI check should use git status --short --renames instead to check the diff. git diff --name-only does not seem to detect file renaming.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If renaming pdf and screenshot, should the async folder also be renamed to Async for consistency?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! We can also fix this folder.

Or, in order to keep folders in lowercase, the BUILDERS constant could keep lowercase keys but using ucfirst or ucwords when writing the title. WDYT ?

Copy link
Contributor Author

@rhyd42 rhyd42 Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ucfirst or ucwords was my first thought, but looking at the other folders there's a mix of snake case, Pascal case and lowercase, and even the folder hierarchy is different for /docs/. Maybe a new issue should be opened to decide on consistency for cases of file / folder names.
I was hoping to suggest a quick fix for the broken links but I seem to have opened a can of worms!

/docs/pdf/builders_api/HtmlPdfBuilder.md - lower case, snake case
/src/Builder/Pdf/HtmlPdfBuilder.php - Pascal case
/tests/Builder/Pdf/HtmlPdfBuilderTest.php - Pascal case
/test/Fixtures/pdf/ - Pascal case, lower case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, /docs/pdf/builders_api/HtmlPdfBuilder.md should be the correct way since only HtmlPdfBuilder refers to a classname. So, the ucfrist solution is the best for now.

Concerning /test/Fixtures/pdf/, you're probably right because this folder does not contains any class to load use PSR4. It could be done in a dedicated PR.

@Jean-Beru Jean-Beru mentioned this pull request Jan 6, 2025
@rhyd42 rhyd42 closed this Jan 7, 2025
@rhyd42 rhyd42 deleted the patch-2 branch January 7, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants