Closed solewniczak closed 5 years ago
What do you think about it? Do you want to merge it into mainline?
I believe this is simple and quite useful feature. I can provide some unit test if desirable. I'll update the documentation as soon as the feature is merged.
Yes, unit tests would be helpful. Unfortunately I don't have the time to properly look into all the pull requests here. This plugin could use some clean up and maintenance. I just gave you commit access, feel free to merge and refactor where you see fit. Please try to keep the documentation uptodate with whatever changes you introduce.
Hi,
Great to see more people working on the bureaucracy plugin.
This thread reminds me on a use case I am looking for: There are several fields in my form collecting numerical data. I have to send an email with the result of a computation done with the numerical data (at the moment merely additions and multiplications). Would it be possible to add a fifth function to this feature that would be able to perform computations with numerical fields?
Thanks in advance for reading this and sorry if this message disturbs the thread.
Hi Szymon,
Are the functions wrapped by a single @ or a double @@?
From the wiki page I get the impression it is double, while the code shows single.
@@curNS(arg)@@@@getNS(arg)@@@@noNS(arg)@@@@p_get_first_heading(arg)@@ | Will be replaced with a result of the corresponding dokuwiki function. arg can be both a static value, eg. @curNS(some:test:value)@ or the placeholder of a field, eg. @p_get_first_heading(@@field@@)@. |
---|
Should be single. I've just fixed it in the documentation.
this commit adds an additional syntax to bureaucracy template parser that introduces simple functions calls:
@function_name(arg)@
the functions are parsed after the fields replacements. this will work:
@function(@@some_field@@)@
currently four functions are supported:
@curNS()@
@getNS()@
@noNS()@
@p_get_first_heading()@
only functions with one argument are possible now
i've found this useful when using bureaucracy together with struct's "Page" field. My use cases:
@p_get_first_heading(@@schema.page@@)
action template tpl:template1 "somens:@noNS(@@schema.page@@)@"