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

Allow generating files for partials #2008

Closed
rmccue opened this issue Aug 10, 2018 · 0 comments
Closed

Allow generating files for partials #2008

rmccue opened this issue Aug 10, 2018 · 0 comments

Comments

@rmccue
Copy link
Contributor

rmccue commented Aug 10, 2018

I'd like to be able to generate files for partials, allowing something like:

<partials>
        <entry>
            <name>contributing</name>
            <link>./CONTRIBUTING.md</link>
        </entry>
        <entry>
            <name>some-other-file</name>
            <link>./some-other-file.md</link>
        </entry>
</partials>

Combined with a template with:

<transformation
	writer="twig"
	query="partials"
	source="templates/my-template/partial.twig"
	artifact="partials/{{name}}.html"
/>

This is almost possible, but $project->partials is a Collection of strings, rather than a collection of Partial objects.

Expected Behavior

query="partials" should pass phpDocumentor\Partials\Partial objects as the node to the templates.

Actual Behavior

The query passes strings as the node. This then causes the dynamic artifact name of artifact="partials/{{name}}.html" to fail, as it attempts to find the string property of a string.

Steps to Reproduce the Problem

  1. Add partial to configuration
  2. Add transformation with query="partials" and dynamic artifact="partials/{{name}}.html"

This could be solved by moving the content generation step from Partials\ServiceProvider->register() into a new Partials\Partial->toString(), and storing the actual Partial objects in the collection.

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

No branches or pull requests

1 participant