aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-12-22 17:30:44 -0800
committerJohn MacFarlane <[email protected]>2022-12-22 17:30:44 -0800
commit6c96340bf63df36c91d11d405af96da8b736eb56 (patch)
tree2a08e6fb24d0942a2322f2a77f9c25a3413bece6
parentee6cf1b8bfecd743de6f5c605c7fccf33bee0088 (diff)
Support "software" type in biblatex <-> CSL conversions.
Closes #8504.
-rw-r--r--src/Text/Pandoc/Citeproc/BibTeX.hs5
-rw-r--r--test/command/8504.md90
2 files changed, 93 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Citeproc/BibTeX.hs b/src/Text/Pandoc/Citeproc/BibTeX.hs
index 648d35a90..fd5ab68be 100644
--- a/src/Text/Pandoc/Citeproc/BibTeX.hs
+++ b/src/Text/Pandoc/Citeproc/BibTeX.hs
@@ -121,7 +121,8 @@ writeBibtexString opts variant mblang ref =
"treaty" | variant == Biblatex -> "legal"
"personal_communication" | variant == Biblatex -> "letter"
"motion_picture" | variant == Biblatex -> "movie"
- "review" | variant == Biblatex -> "review"
+ "review" | variant == Biblatex -> "review"
+ "software" | variant == Biblatex -> "software"
_ -> "misc"
mbSubtype =
@@ -1249,7 +1250,7 @@ getTypeAndGenre = do
"proceedings" -> "book"
"reference" -> "book"
"report" -> "report"
- "software" -> "book" -- no "software" type in CSL
+ "software" -> "software"
"suppbook" -> "chapter"
"suppcollection" -> "chapter"
"suppperiodical"
diff --git a/test/command/8504.md b/test/command/8504.md
new file mode 100644
index 000000000..582304f31
--- /dev/null
+++ b/test/command/8504.md
@@ -0,0 +1,90 @@
+```
+% pandoc -f markdown -s -t biblatex
+---
+references:
+- id: Larsson_2016
+ author:
+ - family: Larsson
+ given: Johan
+ citation-key: Larsson_2016
+ issued:
+ - year: 2016
+ medium: Windows
+ title: 'qualpalr: Automatic Generation of Qualitative Color Palettes'
+ type: software
+ URL: https://cran.r-project.org/package=qualpalr
+ version: 0.3.1
+...
+^D
+@software{Larsson_2016,
+ author = {Larsson, Johan},
+ title = {Qualpalr: {Automatic} {Generation} of {Qualitative} {Color}
+ {Palettes}},
+ version = {0.3.1},
+ date = {2016},
+ url = {https://cran.r-project.org/package=qualpalr}
+}
+```
+
+```
+% pandoc -f markdown -s -t bibtex
+---
+references:
+- id: Larsson_2016
+ author:
+ - family: Larsson
+ given: Johan
+ citation-key: Larsson_2016
+ issued:
+ - year: 2016
+ medium: Windows
+ title: 'qualpalr: Automatic Generation of Qualitative Color Palettes'
+ type: software
+ URL: https://cran.r-project.org/package=qualpalr
+ version: 0.3.1
+...
+^D
+@misc{Larsson_2016,
+ author = {Larsson, Johan},
+ title = {Qualpalr: {Automatic} {Generation} of {Qualitative} {Color}
+ {Palettes}},
+ year = {2016},
+ url = {https://cran.r-project.org/package=qualpalr}
+}
+```
+
+```
+% pandoc -f biblatex -s -t csljson
+@software{Larsson_2016,
+ author = {Larsson, Johan},
+ title = {Qualpalr: {Automatic} {Generation} of {Qualitative} {Color}
+ {Palettes}},
+ version = {0.3.1},
+ date = {2016},
+ url = {https://cran.r-project.org/package=qualpalr}
+}
+^D
+[
+ {
+ "URL": "https://cran.r-project.org/package=qualpalr",
+ "author": [
+ {
+ "family": "Larsson",
+ "given": "Johan"
+ }
+ ],
+ "id": "Larsson_2016",
+ "issued": {
+ "date-parts": [
+ [
+ 2016
+ ]
+ ]
+ },
+ "title": "Qualpalr: Automatic Generation of Qualitative Color Palettes",
+ "title-short": "Qualpalr",
+ "type": "software",
+ "version": "0.3.1"
+ }
+]
+```