【问题标题】:Custom citation style with Jekyll Scholar使用 Jekyll Scholar 自定义引用样式
【发布时间】:2023-01-08 06:56:32
【问题描述】:

我使用JekyllJekyll Scholar来服务personal blog

对于特定的用例,我想在文本中显示内联引用,样式为:Authors (Year) Title,仅此而已。因此,例如我想获得以下引用样式:

顾等。 (2017) 非自回归神经机器翻译

从下面显示的我的参考书目中的 bibtex 条目。

是否有一种引文风格语言风格可以让我做到这一点?这在github.com/citation-style-language/styles/ 中可用吗?

更一般地说,有没有一种方法可以通过指定我想包含的字段以及格式/顺序来生成具有任意自定义样式的内联引用?


@misc{https://doi.org/10.48550/arxiv.1711.02281,
  doi       = {10.48550/ARXIV.1711.02281},
  url       = {https://arxiv.org/abs/1711.02281},
  author    = {Gu, Jiatao and Bradbury, James and Xiong, Caiming and Li, Victor O. K. and Socher, Richard},
  keywords  = {Computation and Language (cs.CL), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences},
  title     = {Non-Autoregressive Neural Machine Translation},
  publisher = {arXiv},
  year      = {2017},
  copyright = {arXiv.org perpetual, non-exclusive license}
}

【问题讨论】:

    标签: jekyll jekyll-extensions csl


    【解决方案1】:

    要使用“作者(年份)标题”样式在你的 Jekyll 博客中显示引用,你可以使用 Jekyll Scholar 提供的引用过滤器

    • 对于书目条目的键:
      {% cite gu2017non-autoregressive %}
    • 对于书目条目的 URL:
      {% cite https://doi.org/10.48550/arxiv.1711.02281 %}

    您可以创建自定义 CSL 样式文件并将其与 Jekyll Scholar 一起使用,以在您的博客文章中生成引用,如下所示:

    1. 创建自定义 CSL 样式文件
      <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" default-locale="en-US">
        <info>
          <title>Custom CSL style</title>
          <id>custom-csl-style</id>
        </info>
        <citation disambiguate-add-names="true" disambiguate-add-givenname="true">
          <layout delimiter=". ">
            <text value="("></text>
            <names variable="author">
              <name form="short" delimiter=", " and="symbol"/>
            </names>
            <text value=")"></text>
            <date variable="issued" form="text"/>
            <text value=" "></text>
            <text variable="title"/>
          </layout>
        </citation>
      </style>
      
      1. 将此文件另存为 custom.csl

      2. 安装 jekyll-scholar-csl gem 并将其添加到您的 Gemfile

      3. 在您的 _config.yml 文件中,将 csl 选项设置为自定义 CSL 样式文件的路径:

        scholar:
         csl: /path/to/your/custom.csl
        
      4. 使用 {% cite gu2017non-autoregressive %} 过滤器以使用自定义 CSL 样式显示博客文章中的引用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 2016-10-30
      • 1970-01-01
      • 1970-01-01
      • 2018-03-18
      • 1970-01-01
      • 2023-03-24
      相关资源
      最近更新 更多