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

Convention for metadata written by tasks #20

Open
martinklepsch opened this issue Jun 18, 2015 · 10 comments
Open

Convention for metadata written by tasks #20

martinklepsch opened this issue Jun 18, 2015 · 10 comments
Labels

Comments

@martinklepsch
Copy link
Contributor

Probably a good idea to establish some sort of namespacing for metadata i.e. perun/markdown can only write to :perun/markdown key in metadata.

@podviaznikov
Copy link
Member

Can you describe with more details why that might be useful?

@martinklepsch
Copy link
Contributor Author

I was just thinking that if perun encourages people to extend it with other tasks there probably should be some convention about how/where they store task related data.

Given we change the :metadata key to :io.perun or something similar as discussed in #22 the structure could end up looking like this

{:io.perun {:markdown/html "<h1>Title</h1>"
            :ttr "2min"}}

i.e. there is some loose mapping from task name to the keys the tasks write to. Currently the markdown task writes to :content which is very generic and could be easily overwritten by other tasks in the pipeline.

@martinklepsch martinklepsch changed the title namespacing metadata Convention for metadata written by tasks Jun 19, 2015
@podviaznikov
Copy link
Member

Not 100% sure about this. In such case tasks further in the chain need to know name of props like markdown/html. This seems to introduce explicit coupling between tasks. E.x. now renderer task function should be aware of markdown/html.
My initial idea was to have some default props for each task (like content, ttr) but name of that property can be changed using task options.

@martinklepsch
Copy link
Contributor Author

E.x. now renderer task function should be aware of markdown/html.

I see your general point but doesn't the renderer function now equally need to be aware of :content?

My initial idea was to have some default props for each task (like content, ttr) but name of that property can be changed using task options.

Making them customizable is probably a good idea in any case.

@podviaznikov
Copy link
Member

E.x. now renderer task function should be aware of markdown/html.

I see your general point but doesn't the renderer function now equally need to be aware of :content?

I'm thinking that if you replace markdown with some other task/plugin render function would still work if it uses :content. Basically I see :content is like interface and :markdown/html as implementation detail.

Another idea: we can have some global option that turns namespacing on/off. This way we might have both solutions.

@martinklepsch
Copy link
Contributor Author

@podviaznikov I'll think about this a bit more but one thing to keep in mind is that the render task does not directly use :content, only the function supplied as renderer does. And this function is user supplied.

@martinklepsch
Copy link
Contributor Author

@Deraen do you have thoughts on establishing some sort of convention for tasks and the keys in metadata they're writing to?

@Deraen
Copy link
Contributor

Deraen commented Jun 21, 2015

Not really. But I would avoid anything which prevents using :keys destructuring, like namespace qualified keywords.

@MartyGentillon
Copy link
Contributor

The real problem with this is that it would mean that you could never use the same renderer for something in markdown and something in some other format. Overall, format is an implementation detail, and a website could have both markdown files and HTML fragments. Both of these may want to use the same templating.

@allentiak
Copy link
Contributor

Hi, @Deraen @martinklepsch @podviaznikov @MartyGentillon ,

There hasn't been any activity on this thread for over three years...
Should we close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants