-
Notifications
You must be signed in to change notification settings - Fork 42
Value aggregation type #386
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
Conversation
|
I think that this check failed due to external factors - is there a way to rerun the tests? |
|
@splitbrain I believe the build failure was at the time that the stable build didn't work with PHP 7 - is it possible to rerun the tests any way, please? |
|
@splitbrain can this request be merged please? |
|
Very useful extension - thank you very much. I have two annotations: 1: It don't works with relative sites like sidebar or pageheader. This might be useful two. |
|
This looks very good, I would also like to see the inline syntax merged. The new feature probably does not require any test, maybe for the InlineConfigParser @splitbrain what do you think? |
splitbrain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea and agree that it should be merged soon. The code looks very good already, but there are some things I'd like to see addressed first. See my inline comments for details.
meta/AggregationValue.php
Outdated
| * | ||
| * @param int $show_not_found Whether to display the default text for no records | ||
| */ | ||
| public function render($show_not_found = 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be better to pass a boolean here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is taken directly from the config array, so will always be given a 0 or 1 depending on the config file. Should I convert a config 0 to Boolean false and config 1 to Boolean true before making use of the value, @splitbrain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I would convert it.
|
|
||
| /** @var AggregationValue $value */ | ||
| $value = new AggregationValue($INFO['id'], $mode, $renderer, $search); | ||
| $value->render($show_not_found); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above does not need to happen during metadata rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not where the value would be put into the text of the abstract when rendering metadata? This is quite a complex part of the DokuWiki code and I'm not at all sure I understand it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think you might be right. I forgot about that. Maybe give it a quick try by putting the value right at the top of the page and see what ends up in the abstract
|
@iainhallam Do you intend to respond to @splitbrain's review comments above? |
This comment has been minimized.
This comment has been minimized.
|
One other thing I noticed with a rather special use case: I want to overwrite the meta page title with data from a struct field. So I tested this PR in combination with the page title plugin. The page content rendering is correct, but the meta title shows "Nothing found" when becomes: |
This is a limitation of DokuWiki - you can't have any syntax inside headers: |
|
Ok, for the first example. That's a DokuWiki limitation. What about the second example using the pagetitle plugin? I think that's a different case, as the syntax is actually parsed, only the data is missing in the meta rendering. |
I'll need to take some time to delve into this - I don't feel I have a handle on the metadata parts of DW at the moment. |
Sure. I had a quick look for myself, but unfortunately I couldn't get the hang of it either so far. And I'm not even sure if this should be in the scope of this PR or rather something to look at after getting this merged. |
|
@iainhallam: Example: This would be extremely helpful. Thanks a lot in advance Regards, Juergen |
This is already available for the current page using the format https://www.dokuwiki.org/plugin:struct:filters My changes essentially add an inline syntax to the Struct configuration parser and an aggregation to display a single value, so this would be a change to the Struct configuration parser logic itself, that would need to add the ability to specify a page in that type of filter. Can you raise a separate issue for that, please? |
|
Sorry for the delay in answering your comments. @annda if you're working on this, maybe fix the few little things from above right on merging. |
|
I find this feature very useful and would like to finally merge it. I have two questions though: serial data: At this point there is no check on syntax: The |
|
Although due to the long time span in the meantime, I already worked with iainhallam's extension (thanks for this) and now I would have to adjust the syntax everywhere: One more question: What's about the filtering syntax " |
@Juergen-aus-Zuendorf Where's that syntax used; have you got an example? |
|
Perhaps this is a misunderstanding from myside: At the beginning of this thread you described the following: |
Ah. The configuration is mainly syntactic sugar, so it passes the page ID straight on to the main Struct parser. That syntax is actually the same It would perhaps be clearer to require a user to specify that they want the query to apply to all pages with something like: |
|
I think your suggestion is very good! Alternatively, I would find it just as good to use the automatism with the placeholders, if this is documented in detail in the plugin description. And once again my attempt (as syntactic sugar): Best regards |
Will have a go at redoing that part when I can.
Struct already has a syntax for that, and your bug report #552 should take care of specific pages. I won't be adding it to this aggregation. |
|
@iainhallam Can you update the documentation? |
|
Documentation updated at https://www.dokuwiki.org/plugin:struct:aggregation. |

This addition addresses #145 and adds an inline syntax following the existing Struct model, plus a shorthand for a single variable; examples follow.
Value from the current page:
Value from another page:
Filters can be added manually following a question mark; to keep flexibility for future features like
summarize, this means you need to restrict to the page you want yourself. Filters must be in double quotes:Filtering supports the usual Struct keywords,
filter,where,filterand,and,filteror,or, followed immediately by a colon, or the shortcuts&and|. The value above can be written: