rudolfbyker/php-marc-csl

1.0.0 2021-10-22 10:27 UTC

This package is auto-updated.

Last update: 2024-09-22 17:32:07 UTC


README

此包试图将MARC21记录映射到CSL变量。没有官方或行业标准映射。我们基于对以下内容的解读开发我们的映射:

要查看哪些MARC字段映射到哪些CSL变量,请查看MarcCslVariables类的文档源代码,特别是getAll()方法。

示例用法

// Get a MARC record (e.g. from an XML file)
$record = Record::fromSimpleXMLElement(simplexml_load_file("marc/xml/35663.xml"));

// Wrap the record in the class provided by this package.
$marcCsl = new MarcCslVariables($record);

// Get the CSL variables as a PHP data structure.
$csl_variables = $csl_variables->jsonSerialize();

// Get the CSL variables as a CSL-JSON string.
$json_string = json_encode($csl_variables);

从这里,您可以使用CSL JSON字符串作为输入,例如CiteProc-JS或CiteProc-PHP,以生成参考文献和引用。

安装

composer require rudolfbyker/php-marc-csl

运行单元测试

composer install
composer test

报告错误

如果您的数据映射不正确,创建一个问题或PR,并提供以下内容:

  • 输入MARC数据
  • 实际输出
  • 预期输出
  • 相关CSL和MARC文档的链接
  • 如何修复的建议

生成文档

  1. 下载phpDocumentor。根据https://www.phpdoc.org/,我们不应使用composer安装phpDocumentor。遵循那里的说明进行安装。
  2. 删除旧的文档目录: rm -rf docs
  3. 运行 phpDocumentor.phar 以生成新文档。
  4. 提交生成的文档。提交到仓库的文档应在GitHub页面上可用:https://github.com/rudolfbyker/php-marc-csl/deployments/activity_log?environment=github-pages