booellean/apa-formatter

一组函数,可以将出版物构建成格式化的HTML

8.2.x-dev 2024-05-07 17:57 UTC

This package is auto-updated.

Last update: 2024-09-07 18:55:57 UTC


README

此软件包用于将出版物和研究资助格式化为APA格式的HTML。此软件包具有预构建的函数来格式化您的出版物,或者单独的函数以创建更个性化的APA格式。

主要函数列表

  • apaFormatBookChapter()
  • apaFormatBookEntry()
  • apaFormatBookReview()
  • apaFormatConferencePaper()
  • apaFormatDissertationOrThesis()
  • apaFormatEditorial()
  • apaFormatForeword()
  • apaFormatJournalEntry()
  • apaFormatReport()
  • apaFormatSoftware()
  • apaFormatVideoGame()
  • apaFormatVideoSeries()
  • apaFormatWebProject()
  • apaFormatResearchBrief()
  • apaFormatDefaultItem()

为了保持此README的易管理性,请查看特质代码中关于应使用哪个函数来处理哪种类型出版物的示例。代码对此有非常深入的注释。

次要函数列表

有时我们希望对APA格式化的条目进行特殊格式化(例如,超链接书名)。在这种情况下,请使用次要构建函数创建自定义条目。

  • apaStructureAuthors() - 从数组输出作者字符串
  • apaAddIfElseCharacter() - 非常专业的Shorthad逻辑。有时我们需要逗号,有时不需要。我们可以在此处传递值以检查在输出该字符之前所有值是否存在。
  • apaGetEdition() - 格式化出版物的版本
  • apaGetEditors() - 从数组输出编辑者字符串
  • apaGetPageNumbers() - 格式化出版物的页码
  • apaGetPublishing() - 从传递的城市/州和出版商设置出版信息
  • apaGetSecondaryTitle() - 如果存在二级标题,则输出章节条目或期刊名称
  • apaGetTitle() - 获取出版物标题作为强调的HTML
  • apaGetType() - 如果存在,则格式化出版物的类型
  • apaGetUrl() - 如果存在,则格式化带有URL的锚标签
  • apaGetVolumeAndIssue() - 如果没有,有一些,或者都有,则适当格式化卷和期
  • apaGetYear() - 返回年份或适当格式化未知年份

主要函数代码中有许多示例说明了如何将这些函数结合使用

示例出版物数组

出版物是一个数组传递。并非每个出版物都将具有以下属性,但这可能是出版物数组可能具有的完整属性列表

        $pub = [
            'authors' => [
                [
                    'last_name' => 'Isaka',
                    'first_name' => 'Kotaro',
                    'middle_name' => ''
                ],
                [
                    'last_name' => 'Hayashi',
                    'first_name' => 'Tamio',
                    'middle_name' => ''
                ]
            ],
            'conf_city_state' => 'New York, NY',
            'editors' => [
                [
                    'last_name' => 'Oohata',
                    'first_name' => 'Eisuke',
                    'middle_name' => ''
                ]
            ],
            'issue' => 6,
            'page_number' => '320',
            'pub_city_state' => 'New York, NY',
            'publication' => 'Fisshū Sutōrī',
            'publisher' => 'New York Asian Film Festival',
            'status' => 'Published',
            'title' => 'Fish Story',
            'title_secondary' => 'The Story of My Life if My Life Were a Fish',
            'type' => 'Movie',
            'url' => 'https://en.wikipedia.org/wiki/Fish_Story_(film)',
            'volume' => 1,
            'year_published' => 2009,

注意:遗憾的是,由于我们信息有限,此特质不支持出版平台字段或DOI:DOI编号。