Skip to content

Added support for snippet manifests#6700

Merged
sebastienros merged 5 commits into
1.10.xfrom
issue/6672/parameterized-snippets
Apr 11, 2016
Merged

Added support for snippet manifests#6700
sebastienros merged 5 commits into
1.10.xfrom
issue/6672/parameterized-snippets

Conversation

@sfmskywalker

Copy link
Copy Markdown
Member

This fixes #6672

The basic idea is that instead of declaring the fields within the snippet template itself, they are declared in a separate file next to the snippet.

This solves some peculiar side-effects, such as the issue described in #6672, and it is a cleaner implementation.

In addition, having a separate manifest allows us to add more information about a snippet, such as a friendly name, description and toolbox icon for example.

This PR retains full backwards compatibility with the way parameterized snippets currently work. Only when you add a .Params.txt manifest file will the snippet element harvester look into it and use that file instead of invoking the HTML helpers within the snippet itself to discover the snippet fields.

I also added a Module.md file as a proposal for allowing module developers to provide documentation alongside their module. We could potentially display these markdown files within the admin somewhere, or even generate online documentation for all modules at some point.

<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</dependentAssembly>
<dependentAssembly>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We just removed it, why adding it again?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, it got added automatically when adding the YamlDotNet Nuget package. Should I remove it?

@sebastienros

Copy link
Copy Markdown
Member

I don't dislike the idea of Module.md but it looks out of scope for this PR. Doing it only for a project is almost useless as people won't follow continue it. If this is something we want to push it should be at least in the codegen templates. And if there is no actual usage in the admin then it will die by itself. I would favor a new entry in the documentation instead, even a placeholder in the RDT site from @agriffard.

@sebastienros

Copy link
Copy Markdown
Member

I like the idea of having a separate file triggering the new behavior, keeping the current one otherwise.

@sfmskywalker

Copy link
Copy Markdown
Member Author

Makes sense regarding Module.md, and it is indeed out of scope. I removed it for now, but will update the documentation separately.

@DaRosenberg

Copy link
Copy Markdown
Member

Agree with Module.md being nice but out of scope for this.

Since we intend to do more with the snippet manifest for 1.11 that just parameter declaration (like snippet display name, description and toolbox icon) I think we should avoid naming the manifest something with "Params".

Instead I suggest:

  • SomeSnippet.Info.txt
  • SomeSnippet.Manifest.txt
  • or even better, simply SomeSnippet.txt

Other than that, this is great! I especially love the inclusion of a YAML parser. For 1.11 we should also change the extension harvesters to use this rather than doing their own parsing.

@sfmskywalker

Copy link
Copy Markdown
Member Author

I like Daniel's suggestion of simply naming the manifest SomeSnippet.txt.

- Renamed snippet manifest naming convention.
- Fields defined in the manifest can now be used as properties on the shape without needing the SnippetField HTML helper.
@sebastienros
sebastienros merged commit a5605b7 into 1.10.x Apr 11, 2016
@sfmskywalker
sfmskywalker deleted the issue/6672/parameterized-snippets branch June 6, 2016 10: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.

4 participants