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

Chicago CSL style throws a fatal error when ecountering "page" values it cannot understand #144

Open
xopoc14 opened this issue Nov 30, 2022 · 2 comments

Comments

@xopoc14
Copy link

xopoc14 commented Nov 30, 2022

Bug reports:

A publication with "E4687-96" pages causes a fatal error when it is rendered:

The website encountered an unexpected error. Please try again later.
TypeError: Unsupported operand types: string % int in Seboettg\CiteProc\Util\PageHelper::renderChicago() (line 80 of .../vendor/seboettg/citeproc-php/src/Util/PageHelper.php).
Seboettg\CiteProc\Util\PageHelper::renderChicago('E4687', '96') (Line: 43)
Seboettg\CiteProc\Util\PageHelper::processPageRangeFormats(Array, Object) (Line: 162)
Seboettg\CiteProc\Rendering\Text->renderPage('E4687-96') (Line: 108)
Seboettg\CiteProc\Rendering\Text->render(Object, NULL) (Line: 79)
Seboettg\CiteProc\Rendering\Choose\ChooseIf->render(Object) (Line: 105)
Seboettg\CiteProc\Rendering\Choose\Choose->render(Object, NULL) (Line: 79)
Seboettg\CiteProc\Rendering\Choose\ChooseIf->render(Object) (Line: 98)
Seboettg\CiteProc\Rendering\Choose\Choose->render(Object, NULL) (Line: 86)
Seboettg\CiteProc\Style\Macro->render(Object) (Line: 290)
Seboettg\CiteProc\Rendering\Text->renderMacro(Object) (Line: 120)
Seboettg\CiteProc\Rendering\Text->render(Object, 0) (Line: 130)
Seboettg\CiteProc\Rendering\Layout->renderSingle(Object, 0) (Line: 97)
Seboettg\CiteProc\Rendering\Layout->render(Object, NULL) (Line: 76)
Seboettg\CiteProc\Style\Bibliography->render(Object) (Line: 137)
Seboettg\CiteProc\CiteProc->bibliography(Object) (Line: 183)
Seboettg\CiteProc\CiteProc->render(Object) (Line: 64)

Used CSL stylesheet:

chicago-author-date-16th-edition.csl

Used CSL metadata

Please replace these lines with your used metadata, for instance:

[
    {
        "author": [
            {
                "family": "Doe", 
                "given": "James"
            }
        ], 
        "id": "ITEM-1", 
        "type": "article-journal",
        "title": "Test",
        "page": "E4687-96"
    }
]

The value of pages is totally valid. It is imported from PubMed library. The original article is https://pubmed.ncbi.nlm.nih.gov/25267658/

@glorieux-f
Copy link
Contributor

Same as #159

@rbran100
Copy link
Contributor

Fix for this is in the PR linked above.

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

No branches or pull requests

3 participants