@@ -18,7 +18,7 @@ import { pathWithForwardSlashes } from "../../../core/path.ts";
1818import { execProcess } from "../../../core/process.ts" ;
1919import { pandocBinaryPath } from "../../../core/resources.ts" ;
2020
21- import { kBibliography , kCsl } from "../../../config/constants.ts" ;
21+ import { kBibliography , kCsl , kNoCite } from "../../../config/constants.ts" ;
2222import { Metadata } from "../../../config/types.ts" ;
2323
2424import { kProjectRender , ProjectContext } from "../../types.ts" ;
@@ -53,10 +53,13 @@ export async function bookBibliographyPostRender(
5353
5454 // bail if there is no target refs file
5555 if ( refsHtml && outputFiles . length > 0 ) {
56- // determine the bibliography and the csl based on the first file
56+ // determine the bibliography, csl, and nocite based on the first file
5757 const file = outputFiles [ 0 ] ;
5858 const bibliography = file . format . metadata [ kBibliography ] as string [ ] ;
5959 const csl = file . format . metadata [ kCsl ] ;
60+ const nocite = typeof ( file . format . metadata [ kNoCite ] ) === "string"
61+ ? file . format . metadata [ kNoCite ] as string
62+ : undefined ;
6063 if ( ! bibliography ) {
6164 return ;
6265 }
@@ -136,6 +139,13 @@ export async function bookBibliographyPostRender(
136139 }
137140 }
138141
142+ // include citeids from nocite
143+ if ( nocite ) {
144+ citeIds . push (
145+ ...nocite . split ( "," ) . map ( ( x ) => x . trim ( ) . replace ( / ^ @ / , "" ) ) ,
146+ ) ;
147+ }
148+
139149 if ( citeIds . length > 0 ) {
140150 // either append this to the end of the references file or replace an explicit
141151 // refs div in the references file
@@ -179,8 +189,8 @@ async function generateBibliographyHTML(
179189
180190 // make the aggregated bibliography
181191 const yaml : Metadata = {
182- bibliography : biblioPaths ,
183- nocite : ld . uniq ( citeIds ) . map ( ( id ) => "@" + id ) . join ( ", " ) ,
192+ [ kBibliography ] : biblioPaths ,
193+ [ kNoCite ] : ld . uniq ( citeIds ) . map ( ( id ) => "@" + id ) . join ( ", " ) ,
184194 } ;
185195 if ( csl ) {
186196 yaml [ kCsl ] = csl ;
0 commit comments