Allow parse and transform to be ran independently#116
Open
mvriel wants to merge 2 commits intodoctrine:1.0.xfrom
Open
Allow parse and transform to be ran independently#116mvriel wants to merge 2 commits intodoctrine:1.0.xfrom
mvriel wants to merge 2 commits intodoctrine:1.0.xfrom
Conversation
For phpDocumentor we want to be able to build a TOC for the API documentation and the output of one or more runs of this RST parser and inject that into the Twig templates. In the existing setup, this causes a chicken and egg problem since the TOC is only available after parsing, but we want to add more to the TOC based on the output of other modules. The solution to this scenario is to enable executing the parse and render phase individually. This will allow us to gather the TOC earlier in the application, combine it with other TOC elements, and then later render the output using this updated TOC.
2c1a53b to
fea2858
Compare
fea2858 to
0856820
Compare
In my previous commit I believed that the meta's could be cached after parsing had completed but the unit tests quickly proved me wrong. During the rendering phase will the dependencies be resolved and persisted in the meta's collection. This means that when we try to persist the cache too soon, that this information is lost. It might be worth investigating if there is a way to resolve this dependencies before rendering; but that is beyond scope of this change.
0856820 to
b82dd67
Compare
Member
|
Should the newly public API be documented at https://github.com/doctrine/rst-parser/blob/0.1.x/docs/en/builder.rst ? |
SenseException
requested changes
Dec 7, 2020
Member
SenseException
left a comment
There was a problem hiding this comment.
I don't know about the docs. It's current state shows how to build rst files in a simple way. Maybe there's place for a advanced section below that shows use cases where the other methods can be explained and why someone might want to use them.
| } | ||
|
|
||
| private function render(string $directory, string $targetDirectory): void | ||
| public function render(string $directory, string $targetDirectory): void |
Member
There was a problem hiding this comment.
Render became public and should get its own tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For phpDocumentor we want to be able to build a TOC for the API
documentation and the output of one or more runs of this RST parser and
inject that into the Twig templates.
In the existing setup, this causes a chicken and egg problem since the
TOC is only available after parsing, but we want to add more to the TOC
based on the output of other modules.
The solution to this scenario is to enable executing the parse and
render phase individually. This will allow us to gather the TOC earlier
in the application, combine it with other TOC elements, and then later
render the output using this updated TOC.