使用 Pandoc 从 Markdown 转换为带引用的 Markdown / “无打印形式的引用”是什么意思?

kop*_*por 6 pandoc

我想编写一个带有参考文献@ref(和 BibTeX 数据库)的 Markdown 文件。发送文件时,应将其转换为包含渲染引用的独立 Markdown 文件。呈现的参考键不应是数字,而应是字母数字。

最小的例子:

最小.md:

@PTDL2008
Run Code Online (Sandbox Code Playgroud)

最小围兜:

@article{PTDL2008,
  title                    = {{Service-Oriented Computing: State of the Art and Research Challenges}},
  author                   = {Michael P. Papazoglou and Paolo Traverso and Schahram Dustdar and Frank Leymann},
  journal                  = {International Journal of Cooperative Information Systems (IJCIS)},
  year                     = {2008},
  month                    = {June},
  number                   = {2},
  pages                    = {233--255},
  volume                   = {17},
  doi                      = {10.1109/MC.2007.400}
}
Run Code Online (Sandbox Code Playgroud)

获取DIN 1505-2(字母数字,德语)并将其存储在同一目录中。

命令行调用:

pandoc minimal.md -o minimal-new.md --atx-headers --bibliography="minimal.bib" --csl=din-1505-2-alphanumeric.csl
Run Code Online (Sandbox Code Playgroud)

结果输出为

pandoc-citeproc 参考资料,无打印形式

生成的minimal-new.md不包含渲染的引用。

Pon*_*ont 5

根据这个线程,您应该能够通过添加来扩展参考

\n\n
-t markdown-citations\n
Run Code Online (Sandbox Code Playgroud)\n\n

到你的 pandoc 论点。这转化为“markdown 减去引用”——也就是说,你禁用了citations,因此引用键将在输出中扩展。(至少,这是我的解释。)

\n\n

我已经用您的最小示例和 pandoc 版本 1.17.0.2 尝试过此操作,它产生了以下输出:

\n\n
**???**\n\n<div id="refs" class="references">\n\n<div id="ref-PTDL2008">\n\n<span style="font-variant:small-caps;">Papazoglou, Michael P.</span>\xe2\x80\xaf;\n<span style="font-variant:small-caps;">Traverso, Paolo</span>\xe2\x80\xaf; <span\nstyle="font-variant:small-caps;">Dustdar, Schahram</span>\xe2\x80\xaf; <span\nstyle="font-variant:small-caps;">Leymann, Frank</span>: Service-Oriented\nComputing: State of the Art and Research Challenges. In: *International\nJournal of Cooperative Information Systems (IJCIS)* Bd. 17 (2008),\nNr.\xc2\xa02, S.\xc2\xa0233\xe2\x80\x93255\n\n</div>\n\n</div>\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,引用已格式化,但包含 HTML 标记,用于 Markdown 本身无法完成的操作。如果你想要“纯粹的”降价,你需要在输出说明符中禁用更多扩展 - 使用

\n\n
-t markdown-raw_html-citations-native_divs-native_spans\n
Run Code Online (Sandbox Code Playgroud)\n\n

你会得到

\n\n
**???**\n\nPAPAZOGLOU, MICHAEL P.\xe2\x80\xaf; TRAVERSO, PAOLO\xe2\x80\xaf; DUSTDAR, SCHAHRAM\xe2\x80\xaf; LEYMANN,\nFRANK: Service-Oriented Computing: State of the Art and Research\nChallenges. In: *International Journal of Cooperative Information\nSystems (IJCIS)* Bd. 17 (2008), Nr.\xc2\xa02, S.\xc2\xa0233\xe2\x80\x93255\n
Run Code Online (Sandbox Code Playgroud)\n\n

现在,CSL 文件规定的“小型大写字母”现已近似使用普通的旧大写字母。

\n\n

不幸的是,这只能让您找到解决方案的一半:书目条目的格式正确,但由于某种原因,文本引用本身只是显示为**???**. 到目前为止,我还没有找到解决这个问题的方法。

\n


whi*_*cko 0

根据https://github.com/jgm/pandoc-citeproc/issues/195这意味着找不到参考。

但对我来说,这个例子看起来不错。正如问题中也提到的,它依赖于提供的 csl 文件。我建议在没有--csl指定的情况下检查它并使用默认的引用样式,这应该会产生更容易理解的输出。