2017 © Pedro Peláez
 

library csl

A php processor for the citation style language CSL (http://citationstyles.org)

image

geissler/csl

A php processor for the citation style language CSL (http://citationstyles.org)

  • Monday, March 11, 2013
  • by geissler
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

This project is still in an early alpha state, nearly the half of the tests are failing. The goal is to implement a parser which is 100% compatible with the CSL 1.0.1 standard, 100% clean OOP and follows the PSR-2 coding standard., (*1)

Installation

Via composer

Add to the composer.json the require key and run composer install., (*2)

    "require" : {
        "geissler/csl": "dev-master"
    }

Other

Make sure you are using a PSR-2 compatible autoloader., (*3)

Usage

Render a single bibliography entry., (*4)

    // include the composer autoloader
    require __DIR__ . '/vendor/autoload.php';

    use Geissler\CSL\CSL;

    // the name of the style you want to use
    $style = 'american-journal-of-archaeology';

    // the data do be displayed as a json array
    $input = '[
          {
              "id": "ITEM-1",
              "author" : [
                 {
                    "family": "Wallace-Hadrill",
                    "given": "Andrew"
                 }
              ],
              "issued": {
                  "date-parts": [
                      [
                          "2011"
                      ]
                  ]
              },
              "title": "The monumental centre of Herculaneum. In search of the identities of the public buildings",
              "container-title" : "Journal of Roman Archaeology",
              "volume" : "24",
              "page" : "121-160",
              "original-publisher-place" : "Ann Arbor, Mich.",
              "type": "article-journal"
          }
    ]';

    $csl = new CSL();
    echo $csl->bibliography($style, $input);

    // this will output the following
    Wallace-Hadrill, Andrew. 2011. "The monumental centre of Herculaneum. In search of the identities of the public
    buildings". Journal of Roman archaeology 24: 121-160.

As HTML, (*5)



Wallace-Hadrill, Andrew. 2011. "The monumental centre of Herculaneum. In search of the identities of the public buildings". Journal of Roman archaeology 24: 121-160.

Configuration

The following options can be configured via the configuration.ini:, (*6)

  • locale-group
    • dir = Path to the locales files relative to the configuration.ini (standard: locale)
    • file = Filename of the language files, where LANGUAGE represents de-DE, en-US (standard: locales-LANGUAGE.xml)
    • dialects = A JSON array with the main dialects for languages spoken in more than one country.
  • styles-group
    • dir = Path to the styles dir relative to the configuration.ini (standard: styles)

Styles and Locales

The files under styles are taken from the CSL styles repository and the files under locales are taken from the CSL locales repository., (*7)

Tests and Comments

Build Status, (*8)

Most of the examples for the phpunit-tests under tests/src, all files in tests/citeproc-test and some comments are taken/copied from CiteProc Test, "the standard test bundle for use in CSL processor and style development" written by Frank G. Bennett, Jr. and Bruce D'Arcus., (*9)

The Versions

11/03 2013

dev-master

9999999-dev

A php processor for the citation style language CSL (http://citationstyles.org)

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

csl citation