seboettg / citeproc-php

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

punctuation-in-quote issue #50

Closed jonathangreen closed 6 years ago

jonathangreen commented 6 years ago

Hello.

This issue came up while testing citeproc-php with the MLA style found here: https://github.com/citation-style-language/styles/blob/master/modern-language-association.csl

This test case reproduces the issue:

>>===== MODE =====>>
bibliography
<<===== MODE =====<<

>>===== RESULT =====>>
<div class="csl-bib-body">
  <div class="csl-entry">John Smith. “Chapter Title.”</div>
</div>
<<===== RESULT =====<<

>>===== CSL =====>>
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never" page-range-format="minimal-two">
  <info>
    <title></title>
    <id></id>
    <updated>2018-01-09T14:13:59+00:00</updated>
  </info>
  <locale xml:lang="en">
    <style-options punctuation-in-quote="true"/>
  </locale>
  <macro name="author">
    <names variable="author">
      <name/>
      <label form="long" prefix=", "/>
    </names>
  </macro>
  <macro name="title">
    <text variable="title" quotes="true" text-case="title"/>
  </macro>
  <citation>
    <layout>
      <text value="Bogus"/>
    </layout>
  </citation>
  <bibliography>
    <sort>
      <key macro="author"/>
      <key variable="title"/>
    </sort>
    <layout suffix=".">
      <group delimiter=". ">
        <text macro="author"/>
        <text macro="title"/>
      </group>
    </layout>
  </bibliography>
</style>
<<===== CSL =====<<

>>===== INPUT =====>>
[
    {
        "URL": "http://example.com", 
        "author": [
            {
                "family": "Smith", 
                "given": "John"
            }
        ], 
        "id": 276, 
        "title": "Chapter Title", 
        "type": "chapter"
    }
]
<<===== INPUT =====<<

Running the test I get:

--- Expected
+++ Actual
@@ @@
 '<div class="csl-bib-body">\n
-  <div class="csl-entry">John Smith. “Chapter Title.”</div>\n
+  <div class="csl-entry">John Smith. “Chapter Title”.</div>\n
 </div>'

It does however pass when running the same test case against citeproc-js.

seboettg commented 6 years ago

Hey Jonathan! Thank you for this detailed issue description. I guess I could fix it. Please checkout branch issue-50 for a test.

jonathangreen commented 6 years ago

This is awesome @seboettg thank you. I will test out later today and let you know the results.

jonathangreen commented 6 years ago

I also want to thank you for maintaining citeproc-php and moving development forward. It is great to see the library maintained again. I'm a developer on the islandora project, and I have a pull request (https://github.com/Islandora/islandora_scholar/pull/291) in progress to replace our fork of citeproc v1 with your version of citeproc. Thought you might like to see where the library is being used.

jonathangreen commented 6 years ago

Just gave the issue-50 branch a test, and it does fix my problem. Thank you again!

seboettg commented 6 years ago

Ok, perfect. I'm happy to hear that citeproc-php is useful for so many different projects. I started reimplementation of citeproc-php for a previous project of mine, and the old version ran into a lot of painful problems, that wasn't easy to fix. The new version follows the approach of test-driven development and makes it much easier to fix issues.

seboettg commented 6 years ago

By the way: I'm going to create further test cases before I make the next release.

jonathangreen commented 6 years ago

Cool. Thanks @seboettg. Can you update this ticket when you do the next release, so I know when to pull it into my project? Do you know when you'll be adding the additional test cases?

seboettg commented 6 years ago

Hey Jonathan! Bugfix branch has been merged and released under v2.1.3.