使用 Pandoc 從 Markdown 轉換為帶引用的 Markdown / “無打印形式的引用”是什麼意思?

使用 Pandoc 從 Markdown 轉換為帶引用的 Markdown / “無打印形式的引用”是什麼意思?

我想編寫一個帶有參考文獻@ref(和 BibTeX 資料庫)的 Markdown 文件。發送檔案時,應將其轉換為包含渲染引用的獨立 Markdown 檔案。呈現的參考鍵不應是數字,而應是字母數字。

最小的例子:

最小.md:

@PTDL2008

最小圍兜:

@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}
}

得到DIN 1505-2(字母數字,德文)並將其儲存在同一目錄中。

命令列調用:

pandoc minimal.md -o minimal-new.md --atx-headers --bibliography="minimal.bib" --csl=din-1505-2-alphanumeric.csl

結果輸出為

pandoc-citeproc 參考資料,無列印形式

產生的minimal-new.md不包含渲染的參考。

答案1

這個線程在 pandoc-discuss 郵件列表上,您應該能夠透過添加來擴展參考

-t markdown-citations

到你的 pandoc 論點。這轉化為“markdown 減去引用”——也就是說,您citations在輸出格式中禁用擴展,因此引用鍵將在輸出中擴展。 (至少,這是我的解釋。)

我已經用您的最小範例和 pandoc 版本 1.17.0.2 嘗試過此操作,它產生了以下輸出:

**???**

<div id="refs" class="references">

<div id="ref-PTDL2008">

<span style="font-variant:small-caps;">Papazoglou, Michael P.</span> ;
<span style="font-variant:small-caps;">Traverso, Paolo</span> ; <span
style="font-variant:small-caps;">Dustdar, Schahram</span> ; <span
style="font-variant:small-caps;">Leymann, Frank</span>: Service-Oriented
Computing: State of the Art and Research Challenges. In: *International
Journal of Cooperative Information Systems (IJCIS)* Bd. 17 (2008),
Nr. 2, S. 233–255

</div>

</div>

因此,引用已格式化,但包含 HTML 標記,用於 Markdown 本身無法完成的操作。如果你想要“純粹的”降價,你需要在輸出說明符中禁用更多擴展 - 使用

-t markdown-raw_html-citations-native_divs-native_spans

你會得到

**???**

PAPAZOGLOU, MICHAEL P. ; TRAVERSO, PAOLO ; DUSTDAR, SCHAHRAM ; LEYMANN,
FRANK: Service-Oriented Computing: State of the Art and Research
Challenges. In: *International Journal of Cooperative Information
Systems (IJCIS)* Bd. 17 (2008), Nr. 2, S. 233–255

現在,CSL 檔案規定的「小型大寫字母」現已近似使用普通的舊大寫字母。

不幸的是,這只能讓您獲得解決方案的一半:書目條目的格式正確,但由於某種原因,文本引用本身只是以**???**.到目前為止,我還沒有找到解決這個問題的方法。

答案2

根據https://github.com/jgm/pandoc-citeproc/issues/195這意味著未找到參考。

但對我來說,這個例子看起來不錯。正如問題中也提到的,它依賴於提供的 csl 檔案。我建議在沒有--csl指定的情況下檢查它並使用預設的引用樣式,這應該會產生更容易理解的輸出。

相關內容