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

[FEATURE] Make index file configurable #1116

Merged
merged 1 commit into from
Oct 3, 2024
Merged

[FEATURE] Make index file configurable #1116

merged 1 commit into from
Oct 3, 2024

Conversation

linawolf
Copy link
Contributor

@linawolf linawolf commented Oct 2, 2024

The index file will also be used in automatic menu building.

As oposed to setting "input-file" not only the one file mentioned will be rendererd but all files from the directory. However the name of the input file can be changed.

Some markdown projects like to change the name of the index file. For example powermail is using Readme.md as index file in every directory:

https://github.com/in2code-de/powermail/tree/master/Documentation

References #1108

Copy link
Member

@jaapio jaapio left a comment

Choose a reason for hiding this comment

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

I had some issues to follow the code in the parseDirectoryHandler. It looks like we can simplify it when we would use the settings manager, and skip the inline defaults? I think it would make sense to define a default in the settings manager. And remove the hardcoded defaults.

Please keep in mind that adding a parameter to any class constructor should be seen as a backward compatibility break. So we might need to make them default to null when possible. And apply a fallback. Which would be in this case the inline defaults. 'index,Index'

Given the fact that the inline defaults may contain multiple filenames. index and Index I think we should allow the users to specify multiple as well?

packages/guides/src/Handlers/ParseDirectoryHandler.php Outdated Show resolved Hide resolved
@@ -98,14 +101,23 @@ private function getDirectoryIndexFile(
$hashedContentFromFilesystem[$itemFromFilesystem['basename']] = true;
}

foreach (self::INDEX_FILE_NAMES as $indexName) {
if ($indexName !== null) {
Copy link
Member

Choose a reason for hiding this comment

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

if the user configured an indexName we can enforce the index to exist like this. So I would expect a throw in this if block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really get what you are suggesting?

packages/guides/src/Handlers/ParseDirectoryHandler.php Outdated Show resolved Hide resolved
@linawolf
Copy link
Contributor Author

linawolf commented Oct 3, 2024

Is adding an additional constructor to a final class that is used by DI really breaking?

The index file will also be used in automatic menu
building.

As oposed to setting "input-file" not only the one file mentioned will be rendererd but all files from the directory. However the name of the input file can be changed.

Some markdown projects like to change the name of the index file. For example powermail is using
Readme.md as index file in every directory:

https://github.com/in2code-de/powermail/tree/master/Documentation

References #1108
@linawolf
Copy link
Contributor Author

linawolf commented Oct 3, 2024

@jaapio, tried to apply the changes as far as I understood them. Please have another look

@jaapio jaapio merged commit 1762e82 into main Oct 3, 2024
40 checks passed
@jaapio jaapio deleted the task/menu branch October 3, 2024 05:58
@phpdoc-bot
Copy link

💚 All backports created successfully

Status Branch Result
1.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

phpdoc-bot added a commit that referenced this pull request Oct 3, 2024
[1.x] Merge pull request #1116 from phpDocumentor/task/menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants