-
Notifications
You must be signed in to change notification settings - Fork 39
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
create possibility to filter specific citations in "render" function, independently from CSL input data. #39
Conversation
Why do we need it? Cos when we are trying to render a citation and it is part of a number of bibliography but it's not the number 1 we will be able to send the field "citation-number" and render with it.
Changes Unknown when pulling 205496c on CarlosCraviotto:patch-1 into ** on seboettg:master**. |
Hi Carlos! Do you have any idea? And where do you get your CSL input data from? I haven't seen an example yet which uses |
Hi Sebastian, |
I'm not sure whether I understood the actual problem completely.
|
I will give you an example: [1] World Health Organization. Drinking water [Internet]. Geneva: World Health Organization; 2015 Jun [cited 2015 Jul 20]. Available from: http://www.who.int/mediacentre/factsheets/fs391/en/ And now I want to render as a citation just the Heart Foundation (AU). As I'm using the vancouver style, the csl processor will return [1] because when I'm rendering it I'm sending the data for this one and I don't have any way (I didn't find any) to tell to the processor this is the second one. |
Okay, I understand the problem. But I guess we need a different approach, which enables citeproc users to filter specific citations without changing the CSL input data. Another advantage for this way is also that we're closer to citeproc-js, the reference implementation of a CSL processor and I'm able to still use the test-suite. |
Changes Unknown when pulling 36b768b on CarlosCraviotto:patch-1 into ** on seboettg:master**. |
Changes Unknown when pulling 549f672 on CarlosCraviotto:patch-1 into ** on seboettg:master**. |
This approach enables you to filter specific citation items by a filter array which you can pass to the render function while rendering citations. In that array are one or more stdClass objects containing an id property which references the item that should be rendered. $dataString = '[
{
"id": "ITEM-1",
"title": "Book 1",
"type": "book"
},
{
"id": "ITEM-2",
"title": "Book 2",
"type": "book"
},
{
"id": "ITEM-3",
"title": "Book 3",
"type": "book"
}
]';
$data = json_decode($dataString);
$filter = json_decode('[{"id":"ITEM-3"}]');
$citeProc->render($data, "citation", $filter); Another example you will find in example/index.php. What do you think? |
Great!!! I like it 👍 |
Changes Unknown when pulling 315715a on CarlosCraviotto:patch-1 into ** on seboettg:master**. |
render
function, independently from CSL input data.
render
function, independently from CSL input data.
Why do we need it? Cos when we are trying to render a citation and it is part of a number of bibliography but it's not the number 1 we will be able to send the field "citation-number" and render with it.