@@ -87,7 +87,7 @@ import { quartoConfig } from "../../core/quarto.ts";
8787import { metadataNormalizationFilterActive } from "./normalize.ts" ;
8888import { kCodeAnnotations } from "../../format/html/format-html-shared.ts" ;
8989import { projectOutputDir } from "../../project/project-shared.ts" ;
90- import { extname , relative , resolve } from "../../deno_ral/path.ts" ;
90+ import { dirname , extname , relative , resolve } from "../../deno_ral/path.ts" ;
9191import { citeIndexFilterParams } from "../../project/project-cites.ts" ;
9292import { debug } from "../../deno_ral/log.ts" ;
9393import { kJatsSubarticle } from "../../format/jats/format-jats-types.ts" ;
@@ -755,6 +755,17 @@ export async function resolveFilters(
755755 filter . type !== kQuartoCiteProcMarker && filter . type !== kQuartoFilterMarker
756756 ) as QuartoFilterEntryPointQualifiedFull [ ] ;
757757
758+ const resolvePath = ( filter : QuartoFilterEntryPointQualifiedFull [ "path" ] ) => {
759+ switch ( filter . type ) {
760+ case "absolute" :
761+ return filter . path ;
762+ case "relative" :
763+ return resolve ( dirname ( options . source ) , filter . path ) ;
764+ case "project" :
765+ return resolve ( options . project . dir , filter . path ) ;
766+ }
767+ } ;
768+
758769 const entryPoints : QuartoFilterEntryPoint [ ] = fullFilters
759770 . map ( ( filter , i ) => {
760771 const at = filter . at === "__quarto-auto"
@@ -764,7 +775,7 @@ export async function resolveFilters(
764775 const result : QuartoFilterEntryPoint = {
765776 "at" : at ,
766777 "type" : filter . type ,
767- "path" : filter . path . path ,
778+ "path" : resolvePath ( filter . path ) ,
768779 } ;
769780 return result ;
770781 } ) ;
@@ -869,24 +880,24 @@ async function resolveFilterExtension(
869880 return { type : filter } ;
870881 }
871882 if ( typeof filter !== "string" ) {
883+ const fileType : "project" | "relative" =
884+ extname ( filter . path ) . startsWith ( "/" ) ? "project" : "relative" ;
885+ const path = {
886+ type : fileType ,
887+ path : filter . path ,
888+ } ;
872889 // deno-lint-ignore no-explicit-any
873890 if ( ( filter as any ) . at ) {
874891 const entryPoint = filter as QuartoFilterEntryPoint ;
875892 return {
876893 ...entryPoint ,
877- path : {
878- type : "relative" ,
879- path : entryPoint . path ,
880- } ,
894+ path,
881895 } ;
882896 } else {
883897 return {
884898 at : "__quarto-auto" ,
885899 type : filter . type ,
886- path : {
887- type : "relative" ,
888- path : filter . path ,
889- } ,
900+ path,
890901 } ;
891902 }
892903 }
@@ -912,15 +923,31 @@ async function resolveFilterExtension(
912923 options . project ?. dir ,
913924 ) || [ ] ;
914925
926+ const fallthroughResult = ( ) => {
927+ const filterType : "json" | "lua" = extname ( filter ) !== ".lua"
928+ ? "json"
929+ : "lua" ;
930+ const pathType : "project" | "relative" = filter . startsWith ( "/" )
931+ ? "project"
932+ : "relative" ;
933+
934+ return {
935+ at : "__quarto-auto" ,
936+ type : filterType ,
937+ path : {
938+ type : pathType ,
939+ path : filter ,
940+ } ,
941+ } ;
942+ } ;
943+
915944 if ( extensions . length === 0 ) {
916945 // There were no extensions matching this name,
917- // this should not happen
918- //
919- // Previously, we allowed it to pass, we're warning now and dropping
920- warn (
921- `No extensions matching name but filter (${ filter } ) is a string that isn't an existing path or quarto or citeproc. Ignoring` ,
922- ) ;
923- return [ ] ;
946+ // but the filter is a string that isn't an existing path
947+ // this indicates that the filter is meant to be interpreted
948+ // as a project- or file-relative path
949+
950+ return fallthroughResult ( ) ;
924951 }
925952
926953 // Filter this list of extensions
@@ -940,10 +967,7 @@ async function resolveFilterExtension(
940967 // This matches an extension, use the contributed filters
941968 const filters = extensions [ 0 ] . contributes . filters ;
942969 if ( ! filters ) {
943- warn (
944- `No extensions matching name but filter (${ filter } ) is a string that isn't an existing path or quarto or citeproc. Ignoring` ,
945- ) ;
946- return [ ] ;
970+ return fallthroughResult ( ) ;
947971 }
948972
949973 // our extension-finding service returns absolute paths
0 commit comments