rudolfbyker / php-marc-csl
描述
1.0.0
2021-10-22 10:27 UTC
Requires
- php: >=7.3
- ext-json: *
- scriptotek/marc: ^2.2
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-22 17:32:07 UTC
README
此包试图将MARC21记录映射到CSL变量。没有官方或行业标准映射。我们基于对以下内容的解读开发我们的映射:
- 的 MARC21文档
- 的 CSL文档
- 的 Citeproc JS文档,特别是CSL-JSON部分。
要查看哪些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文档的链接
- 如何修复的建议
生成文档
- 下载phpDocumentor。根据https://www.phpdoc.org/,我们不应使用composer安装phpDocumentor。遵循那里的说明进行安装。
- 删除旧的文档目录:
rm -rf docs
。 - 运行
phpDocumentor.phar
以生成新文档。 - 提交生成的文档。提交到仓库的文档应在GitHub页面上可用:https://github.com/rudolfbyker/php-marc-csl/deployments/activity_log?environment=github-pages