From 6c96340bf63df36c91d11d405af96da8b736eb56 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 22 Dec 2022 17:30:44 -0800 Subject: Support "software" type in biblatex <-> CSL conversions. Closes #8504. --- src/Text/Pandoc/Citeproc/BibTeX.hs | 5 ++- test/command/8504.md | 90 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 test/command/8504.md 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" + } +] +``` -- cgit v1.2.3