Bluebook citation style

Hi all,

I’m new to OJS. I’m wondering if anyone is using the Bluebook citation format in their OJS instance. If so, might you be able to advise on how to add it to the Citation Style Language plugin.

@asmecher Hey Alec, is there any documentation on how we can add another .csl style to the citationStyleLanguage/citation-styles folder and use it on the OJS interface?

I’m poking around here

Bluebook from Zotero is the CSL we want to add
http://www.zotero.org/styles/bluebook-law-review

If you can help point us in the right direction, I’m happy to help document the process… we’re trying to get our Law School on board. Thank you!

Hi @wilsonw,

See plugins/generic/citationStyleLanguage/CitationStyleLanguagePlugin.inc.php in the getCitationStyles function. Each entry, e.g.:

array(
    'id' => 'acm-sig-proceedings',
    'title' => __('plugins.generic.citationStyleLanguage.style.acm-sig-proceedings'),
    'isEnabled' => true,
),

…defines a single citation style. The id entry defines the .csl file’s filename – in the example above, it’s referring to plugins/generic/citationStyleLanguage/citation-styles/acm-sig-proceedings.csl.

You should be able to add a new entry for the desired style, put its .csl file in place (if it’s not there already), and check the settings form to see if it appears there.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Thank you @asmecher for the guidance. That worked in adding the citation to the settings interface.

However, when clicking on the Bluebook citation under How to Cite, I get a 500 Server Error with the following log

http://ojs.stanford.edu/ojs/index.php/SLSSJ/article/view/1456

PHP Fatal error: Call to a member function render() on null in /ojs/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/CiteProc.php on line 134
PHP Stack trace:
PHP 1. {main}() /ojs/index.php:0
PHP 2. PKPApplication->execute() /ojs/index.php:68
PHP 3. Dispatcher->dispatch() /ojs/lib/pkp/classes/core/PKPApplication.inc.php:247
PHP 4. PKPPageRouter->route() /ojs/lib/pkp/classes/core/Dispatcher.inc.php:134
PHP 5. PKPRouter->_authorizeInitializeAndCallRequest() /ojs/lib/pkp/classes/core/PKPPageRouter.inc.php:232
PHP 6. call_user_func: /ojs/lib/pkp/classes/core/PKPRouter.inc.php:390}() /ojs/lib/pkp/classes/core/PKPRouter.inc.php:390
PHP 7. CitationStyleLanguageHandler->get() /ojs/lib/pkp/classes/core/PKPRouter.inc.php:390
PHP 8. CitationStyleLanguagePlugin->getCitation() /ojs/plugins/generic/citationStyleLanguage/pages/CitationStyleLanguageHandler.inc.php:43
PHP 9. Seboettg\CiteProc\CiteProc->render() /ojs/plugins/generic/citationStyleLanguage/CitationStyleLanguagePlugin.inc.php:398
PHP 10. Seboettg\CiteProc\CiteProc->bibliography() /ojs/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/CiteProc.php:175

From an untrained eye, the .csl differs insignificantly from the other .csls in the folder (comparing Bluebook to Vancouver here https://www.diffchecker.com/usPCLYl6)

However, when I replace vancouver.csl with bluebook-law-review.csl to test, it still shows the same error when clicking on Vancouver, which suggests to me an error in the Bluebook csl file itself. Any suggestions? Thank you!

Quick aside for documentation purposes: I added a line to the locale in citationStyleLanguage/locale/en_US to translate the string ##plugins.generic.citationStyleLanguage.style.bluebook-law-review## into Bluebook on the English interface.

Hi @wilsonw,

It does sound like something to do with the CSL file itself. The library we use to transform citations is GitHub - seboettg/citeproc-php: Full-featured CSL 1.0.1 processor for PHP – you might try your CSL file with that library directly, simplifying things by taking OJS temporarily out of the picture.

Regards,
Alec Smecher
Public Knowledge Project Team

Hmm. Thinking out loud here, I found the citeproc-php library depends on these style distributions GitHub - citation-style-language/styles-distribution: Official repository for distribution of validated CSL citation styles. so I checked for Bluebook and they already have three Bluebook csl options in the repo. The bluebook-inline.csl in-text style looked closest to the others already present in OJS

https://raw.githubusercontent.com/citation-style-language/styles-distribution/master/bluebook-inline.csl

However, the code still bugs out on /ojs/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Seboettg/CiteProc/CiteProc.php line 134, which seems to be because self::$context->getBibliography() is returning null instead of the Seboettg\CiteProc\Style\Bibliography Object, so it could definitely be on citeproc-php’s side

Did some more digging. The bluebook csl file included the format for <citation> but not <bibliography>; I added <bibliography> and the error is gone. Good enough to keep moving forward. Thank you for your help!

<bibliography et-al-min="3" et-al-use-first="1">
  <layout delimiter="; ">
    <choose>
      <if position="ibid">
        <group delimiter=" ">
          <text value="id." text-case="capitalize-first" font-style="italic"/>
          <text macro="at_page"/>
          <!-- period will not show up - this is for find-and-replace later. -->
        </group>
      </if>
      <else-if position="subsequent" type="legal_case" match="any">
        <!--CSL does not currently support reference to number of repeats, so cannot follow proper Bluebook repeat rule; choice is either short form, or long form.-->
        <group delimiter=" ">
          <text macro="source-short"/>
          <text variable="locator" prefix="at "/>
        </group>
      </else-if>
      <else-if position="subsequent">
        <group delimiter=" ">
          <text macro="source-short" suffix=","/>
          <text value="supra" font-style="italic"/>
          <text value="note"/>
          <text variable="first-reference-note-number"/>
          <text macro="at_page"/>
        </group>
      </else-if>
      <else>
        <text macro="source-long"/>
        <text macro="access" prefix=", "/>
      </else>
    </choose>
  </layout>
</bibliography>
1 Like

Hi @wilsonw,

Excellent – please consider contributing this upstream if you think it would be useful!

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like