funstaff/ref-lib-ris

RIS 是一种参考元数据格式

2.0.1 2019-03-21 12:12 UTC

This package is auto-updated.

Last update: 2024-09-22 01:21:23 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version License SensioLabsInsight

此库提供了一个写入 RIS 数据格式的工具。

安装

  1. 按照 https://packagist.org.cn 上的说明进行操作
  2. 在您的项目中创建一个 composer.json 文件,并需要 RefLibRis
{
  "require": {
    "funstaff/ref-lib-ris": ">=2.0"
  }
}

使用

<?php

namespace ...;

use Funstaff\RefLibRis\RecordProcessing;
use Funstaff\RefLibRis\RisDefinition;
use Funstaff\RefLibRis\RisMappings;
use Funstaff\RefLibRis\RisWriter;

$mapping = [
    'DEFAULT' => [
        'TY' => ['type'],
        'AU' => ['author'],
        'TI' => ['title', 'title_secondary'],
    ],
    'BOOK' => [
        'TY' => ['type'],
        'AU' => ['author'],
        'TI' => ['title', 'title_secondary'],
        'ID' => ['recordid']
    ]
];

$recordDb = [
    'title' => ['History of the CDC PY - 1999'],
    'author' => ['Behrens, J.', 'Behrens, A.'],
    'type' => ['BOOK']
];

$risMappings = new RisMappings($mapping, 'DEFAULT');
$recordProcessing = new RecordProcessing($risMappings);
$record = $recordProcessing->process($recordDb);

$writer = new RisWriter(new RisDefinition());
$output = $writer->addRecord($record)->process();

输出

TY  - BOOK
AU  - Behrens, J.
AU  - Behrens, A.
TI  - History of the CDC PY - 1999
ER  -

发现了一个错误

如果您发现了一个错误,告诉我。最好的方式是在 http://github.com/funstaff/RefLibRis/issues 上提交报告。