File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed
resources/filters/quarto-init Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import {
3636} from "../../config/types.ts" ;
3737import {
3838 isBeamerOutput ,
39+ isDocxOutput ,
3940 isEpubOutput ,
4041 isHtmlDocOutput ,
4142 isHtmlFileOutput ,
@@ -69,7 +70,11 @@ import {
6970 pandocDefaultsMessage ,
7071 writeDefaultsFile ,
7172} from "./defaults.ts" ;
72- import { filterParamsJson , removeFilterParmas } from "./filters.ts" ;
73+ import {
74+ filterParamsJson ,
75+ quartoInitFilter ,
76+ removeFilterParmas ,
77+ } from "./filters.ts" ;
7378import {
7479 kAbstract ,
7580 kAbstractTitle ,
@@ -866,6 +871,35 @@ export async function runPandoc(
866871 ) ;
867872 }
868873
874+ // for docx books we need to run a resolveRefs pass
875+ // workaround until this issue is resolved: https://github.com/jgm/pandoc/issues/8099
876+ if ( isDocxOutput ( options . format . pandoc ) && projectIsBook ( options . project ) ) {
877+ const docxCmd = [
878+ pandocBinaryPath ( ) ,
879+ inputTemp ,
880+ "--to" ,
881+ "markdown" ,
882+ "--output" ,
883+ inputTemp ,
884+ "--lua-filter" ,
885+ quartoInitFilter ( ) ,
886+ "--data-dir" ,
887+ resourcePath ( "pandoc/datadir" ) ,
888+ ] ;
889+ const docxResult = await execProcess (
890+ {
891+ cmd : docxCmd ,
892+ cwd,
893+ env : {
894+ "QUARTO_FILTER_PARAMS" : base64Encode ( paramsJson ) ,
895+ } ,
896+ } ,
897+ ) ;
898+ if ( ! docxResult . success ) {
899+ throw new Error ( ) ;
900+ }
901+ }
902+
869903 // run pandoc
870904 const result = await execProcess (
871905 {
Original file line number Diff line number Diff line change 22-- Copyright (C) 2020 by RStudio, PBC
33
44function resourceRefs ()
5+
6+ -- for docx single single file books we've already processed the refs
7+ -- as part of a workaround for this issue https://github.com/jgm/pandoc/issues/8099
8+ if param (" single-file-book" , false ) and _quarto .format .isDocxOutput () then
9+ return {}
10+ end
11+
512 return {
613 Image = function (el )
714 local file = currentFileMetadataState ().file
You can’t perform that action at this time.
0 commit comments