OSU
August 16, 2019, 5:36pm
1
Dear Colleagues!
We found that in Vancouver Citation Style (Citation Style Language Plugin) there is a small error in citation output (block How to Cite on article page) namely the penultimate number in pages is missed.
This can be seen on all OJS3 websites. All other styles work well…
Most likely this file needs to be fixed
/plugins/generic/citationStyleLanguage/citation-styles/vancouver.csl
in this block
<macro name="pages">
<choose>
<if type="article-journal article-magazine article-newspaper review review-book" match="any">
<text variable="page" prefix=":"/>
</if>
<else-if type="book" match="any">
<text variable="number-of-pages" prefix=" "/>
<choose>
<if is-numeric="number-of-pages">
<label variable="number-of-pages" form="short" prefix=" " plural="never"/>
</if>
</choose>
</else-if>
<else>
<group prefix=" " delimiter=" ">
<label variable="page" form="short" plural="never"/>
<text variable="page"/>
</group>
</else>
</choose>
</macro>
Please help to fix it !
Thank you in advance!
Hi @OSU ,
This is probably the same as Page numbering issue · Issue #60 · seboettg/citeproc-php · GitHub . What version of OJS are you using?
Regards,
Alec Smecher
Public Knowledge Project Team
OSU
August 16, 2019, 6:54pm
3
As far as it was found, this error is present in all versions of OJS 3.
… from 3.1.0.1 to 3.1.2.1… and in all websites
for example
https://ojs.lib.uwo.ca/index.php/locke/article/view/861
OSU
August 16, 2019, 7:10pm
4
for some reason, the first digit is lost after a short hyphen
https://ojs.lib.uwo.ca/index.php/locke/article/view/876
Hi @OSU ,
It looks like a problem in the upstream citeproc-php library. I’ve proposed a fix to it:
opened 12:52AM - 11 Oct 18 UTC
closed 09:15AM - 06 Nov 18 UTC
bug
# Please follow the general troubleshooting steps first:
- [x] I read the REA… DME and followed the instructions.
- [x] I am sure that the used CSL metadata follows the [CSL schema](https://github.com/citation-style-language/schema/blob/master/csl-data.json).
- [x] I use a valid CSL stylesheet
### Bug reports:
Page number parsing seems broken
#### Used CSL stylesheet: ####
Vancouver format: https://github.com/pkp/citationStyleLanguage/blob/master/citation-styles/vancouver.csl
#### Used sample code ####
```
<?php
require_once('lib/vendor/autoload.php');
use Seboettg\CiteProc\CiteProc;
$citationData = new stdClass();
$citationData->type = 'article-journal';
$citationData->id = 123;
$citationData->title = 'My Article';
$citationData->{'container-title'} = 'Journal of ABCs';
$citationData->{'container-title-short'} = 'JABC';
$citationData->volume = 1;
$citationData->issue = 1;
$citationData->section = 'Section Title';
$citationData->page = '3-10';
$citeProc = new CiteProc(file_get_contents('citation-styles/vancouver.csl'), 'en-US');
$citation = $citeProc->render(array($citationData), 'bibliography');
echo $citation;
```
#### Expected output ####
```
<div class="csl-bib-body">
<div class="csl-entry"><div class="csl-left-margin">1. </div><div class="csl-right-inline">My Article. JABC. 1(1):3-10. </div></div>
```
#### Received output ####
```
PHP Notice: Uninitialized string offset: 1 in /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Util/PageHelper.php on line 63
PHP Stack trace:
PHP 1. {main}() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/test.php:0
PHP 2. Seboettg\CiteProc\CiteProc->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/test.php:18
PHP 3. Seboettg\CiteProc\CiteProc->bibliography() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/CiteProc.php:183
PHP 4. Seboettg\CiteProc\Style\Bibliography->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/CiteProc.php:137
PHP 5. Seboettg\CiteProc\Rendering\Layout->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Style/Bibliography.php:70
PHP 6. Seboettg\CiteProc\Rendering\Layout->renderSingle() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Layout.php:91
PHP 7. Seboettg\CiteProc\Rendering\Group->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Layout.php:126
PHP 8. Seboettg\CiteProc\Rendering\Group->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Group.php:104
PHP 9. Seboettg\CiteProc\Rendering\Text->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Group.php:104
PHP 10. Seboettg\CiteProc\Rendering\Text->renderMacro() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Text.php:111
PHP 11. Seboettg\CiteProc\Style\Macro->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Text.php:254
PHP 12. Seboettg\CiteProc\Rendering\Choose\Choose->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Style/Macro.php:86
PHP 13. Seboettg\CiteProc\Rendering\Choose\ChooseIf->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Choose/Choose.php:73
PHP 14. Seboettg\CiteProc\Rendering\Text->render() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Choose/ChooseIf.php:88
PHP 15. Seboettg\CiteProc\Rendering\Text->renderPage() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Text.php:100
PHP 16. Seboettg\CiteProc\Util\PageHelper::processPageRangeFormats() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Rendering/Text.php:150
PHP 17. Seboettg\CiteProc\Util\PageHelper::renderMinimal() /home/asmecher/git/ojs-stable-3_1_1/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/Util/PageHelper.php:30
<div class="csl-bib-body">
<div class="csl-entry"><div class="csl-left-margin">1. </div><div class="csl-right-inline">My Article. JABC. 1(1):3-0. </div></div>
```
Note the truncated page numbering in the Received Output: `3-0`. This should be `3-10`.
Regards,
Alec Smecher
Public Knowledge Project Team
1 Like
OSU
August 16, 2019, 9:28pm
6
Many thanks, @asmecher !
hope it will fix it.