seboettg / citeproc-php

Full-featured CSL 1.0.1 processor for PHP
MIT License
75 stars 39 forks source link

BIBITEX format missing last character "}" #51

Closed israelcefrin closed 6 years ago

israelcefrin commented 6 years ago

Please follow the general troubleshooting steps first:

Bug reports:

When we try export a citation format based on BibTex it is missing last closing character "}". You can test it on following URL

Click "More citation Formats" > BibText (download)

Used CSL stylesheet:

bibtex.csl

Used CSL metadata

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

[
    {
        "author": [
            {
                "family": "Shafagh", 
                "given": "Jafer"
            }, 
            {
                "family": "Updegrove", 
                "given": "Jessica"
            }, 
            {
                "family": "Durak", 
                "given": "Umut"
            }, 
            {
                "family": "Bharvi", 
                "given": "Chhaya"
            }
        ], 
        "id": "5", 
        "type": "article",
        "title": "Schema-based Ontological Representations of a Domain-Specific Scenario Modeling Language"
    }
]
seboettg commented 6 years ago

Hello Israel! Thank you for your bug report. This bug happens because of identical consecutive suffixes will be removed (have a look here). This behavior is desirable because there are styles where consecutive identical characters have to be removed (especially punctuation characters). I do not have any idea how to solve this problem yet.

But the following Workaround would work. You can change the style (line 146) replace <group prefix="{" suffix="}" delimiter=", "> with <group prefix="{" suffix=" }" delimiter=", "> or <group prefix="{" suffix="\n}" delimiter=", ">. That would solve your problem.

Additionally, I guess CSL is not the best way to render BibTeX, because there are no formatting options intended like newlines and tabs. I would suggest to use another tool to render BibTeX exports. In past I built a script that is able to render BibTeX, but I haven't finished yet. Follow this link: https://github.com/seboettg/CiteData/blob/master/src/Seboettg/CiteData/Bibtex/BibtexSerializeTrait.php I hope that helps!

israelcefrin commented 6 years ago

Hi @seboettg Thanks for your answer. Suggested workaround you gave has worked. And thanks for alternative solutions to render BibTeX.

Cheers