@@ -73,11 +73,6 @@ import { ensureDirSync } from "fs/mod.ts";
7373import { mappedStringFromFile } from "../mapped-text.ts" ;
7474import { error } from "log/mod.ts" ;
7575import { withCriClient } from "../cri/cri.ts" ;
76- /* import {
77- extractHtmlFromElements,
78- extractImagesFromElements,
79- } from "../puppeteer.ts";
80- */
8176const handlers : Record < string , LanguageHandler > = { } ;
8277
8378let globalFigureCounter : Record < string , number > = { } ;
@@ -114,33 +109,19 @@ function makeHandlerContext(
114109 return options . state ! [ options . name ] ;
115110 } ,
116111
117- async extractHtml ( opts : {
112+ //deno-lint-ignore require-await
113+ async extractHtml ( _opts : {
118114 html : string ;
119115 selector : string ;
120116 resources ?: [ string , string ] [ ] ;
121117 } ) : Promise < string [ ] > {
122- const {
123- html : content ,
124- selector,
125- } = opts ;
126- const nonEmptyHtmlResources : [ string , string ] [ ] = opts . resources ||
127- [ ] ;
128- const dirName = context . options . temp . createDir ( ) ;
129- // create temporary resources
130- for ( const [ name , content ] of nonEmptyHtmlResources ) {
131- Deno . writeTextFileSync ( join ( dirName , name ) , content ) ;
132- }
133- const fileName = join ( dirName , "index.html" ) ;
134- Deno . writeTextFileSync ( fileName , content ) ;
135- const url = `file://${ fileName } ` ;
136-
137- return await withCriClient ( async ( client ) => {
138- await client . open ( url ) ;
139- return await client . contents ( selector ) ;
140- } ) ;
118+ throw new Error (
119+ "Internal error: temporarily disabled until deno 1.28.* gets puppeteer support" ,
120+ ) ;
141121 } ,
142122
143- async createPngsFromHtml ( opts : {
123+ //deno-lint-ignore require-await
124+ async createPngsFromHtml ( _opts : {
144125 prefix : string ;
145126 html : string ;
146127 deviceScaleFactor : number ;
@@ -150,51 +131,9 @@ function makeHandlerContext(
150131 filenames : string [ ] ;
151132 elements : string [ ] ;
152133 } > {
153- const {
154- prefix,
155- html : content ,
156- deviceScaleFactor,
157- selector,
158- } = opts ;
159- const nonEmptyHtmlResources : [ string , string ] [ ] = opts . resources ||
160- [ ] ;
161- const dirName = context . options . temp . createDir ( ) ;
162-
163- // create temporary resources
164- for ( const [ name , content ] of nonEmptyHtmlResources ) {
165- Deno . writeTextFileSync ( join ( dirName , name ) , content ) ;
166- }
167- const fileName = join ( dirName , "index.html" ) ;
168- Deno . writeTextFileSync ( fileName , content ) ;
169- const url = `file://${ fileName } ` ;
170-
171- const { elements, images } = await withCriClient ( async ( client ) => {
172- await client . open ( url ) ;
173- const elements = await client . contents ( selector ) ;
174- const screenshots = await client . screenshots (
175- selector ,
176- deviceScaleFactor ,
177- ) ;
178- return {
179- elements,
180- images : screenshots . map ( ( x ) => x . data ) ,
181- } ;
182- } ) ;
183-
184- // write figures to disk
185- const sourceNames : string [ ] = [ ] ;
186-
187- for ( let i = 0 ; i < images . length ; ++ i ) {
188- const { sourceName, fullName } = context
189- . uniqueFigureName ( prefix , ".png" ) ;
190- sourceNames . push ( sourceName ) ;
191- Deno . writeFileSync ( fullName , images [ i ] ) ;
192- }
193-
194- return {
195- filenames : sourceNames ,
196- elements,
197- } ;
134+ throw new Error (
135+ "Internal error: temporarily disabled until deno 1.28.* gets puppeteer support" ,
136+ ) ;
198137 } ,
199138
200139 cellContent ( cell : QuartoMdCell ) : MappedString {
0 commit comments