@@ -187,6 +187,73 @@ function mapPostProcessorConfig(raw: PlainRecord): PostProcessorConfig {
187187 return config ;
188188}
189189
190+ function mapPageConfig ( raw : PlainRecord ) : PlainRecord {
191+ const config : PlainRecord = { } ;
192+ assignBooleanField ( config , raw , "extract_pages" , "extractPages" ) ;
193+ assignBooleanField ( config , raw , "insert_page_markers" , "insertPageMarkers" ) ;
194+ if ( typeof raw . marker_format === "string" ) {
195+ config . markerFormat = raw . marker_format ;
196+ }
197+ return config ;
198+ }
199+
200+ function mapHtmlOptions ( raw : PlainRecord ) : PlainRecord {
201+ const config : PlainRecord = { } ;
202+ if ( typeof raw . heading_style === "string" ) {
203+ config . headingStyle = raw . heading_style ;
204+ }
205+ if ( typeof raw . list_indent_type === "string" ) {
206+ config . listIndentType = raw . list_indent_type ;
207+ }
208+ assignNumberField ( config , raw , "list_indent_width" , "listIndentWidth" ) ;
209+ if ( typeof raw . bullets === "string" ) {
210+ config . bullets = raw . bullets ;
211+ }
212+ if ( typeof raw . strong_em_symbol === "string" ) {
213+ config . strongEmSymbol = raw . strong_em_symbol ;
214+ }
215+ assignBooleanField ( config , raw , "escape_asterisks" , "escapeAsterisks" ) ;
216+ assignBooleanField ( config , raw , "escape_underscores" , "escapeUnderscores" ) ;
217+ assignBooleanField ( config , raw , "escape_misc" , "escapeMisc" ) ;
218+ assignBooleanField ( config , raw , "escape_ascii" , "escapeAscii" ) ;
219+ if ( typeof raw . code_language === "string" ) {
220+ config . codeLanguage = raw . code_language ;
221+ }
222+ assignBooleanField ( config , raw , "autolinks" , "autolinks" ) ;
223+ assignBooleanField ( config , raw , "default_title" , "defaultTitle" ) ;
224+ assignBooleanField ( config , raw , "br_in_tables" , "brInTables" ) ;
225+ assignBooleanField ( config , raw , "hocr_spatial_tables" , "hocrSpatialTables" ) ;
226+ if ( typeof raw . highlight_style === "string" ) {
227+ config . highlightStyle = raw . highlight_style ;
228+ }
229+ assignBooleanField ( config , raw , "extract_metadata" , "extractMetadata" ) ;
230+ if ( typeof raw . whitespace_mode === "string" ) {
231+ config . whitespaceMode = raw . whitespace_mode ;
232+ }
233+ assignBooleanField ( config , raw , "strip_newlines" , "stripNewlines" ) ;
234+ assignBooleanField ( config , raw , "wrap" , "wrap" ) ;
235+ assignNumberField ( config , raw , "wrap_width" , "wrapWidth" ) ;
236+ assignBooleanField ( config , raw , "convert_as_inline" , "convertAsInline" ) ;
237+ if ( typeof raw . sub_symbol === "string" ) {
238+ config . subSymbol = raw . sub_symbol ;
239+ }
240+ if ( typeof raw . sup_symbol === "string" ) {
241+ config . supSymbol = raw . sup_symbol ;
242+ }
243+ if ( typeof raw . newline_style === "string" ) {
244+ config . newlineStyle = raw . newline_style ;
245+ }
246+ if ( typeof raw . code_block_style === "string" ) {
247+ config . codeBlockStyle = raw . code_block_style ;
248+ }
249+ if ( typeof raw . encoding === "string" ) {
250+ config . encoding = raw . encoding ;
251+ }
252+ assignBooleanField ( config , raw , "debug" , "debug" ) ;
253+ assignBooleanField ( config , raw , "include_links" , "includeLinks" ) ;
254+ return config ;
255+ }
256+
190257function mapKeywordConfig ( raw : PlainRecord ) : KeywordConfig {
191258 const config : KeywordConfig = { } ;
192259 const target = config as PlainRecord ;
@@ -265,6 +332,14 @@ export function buildConfig(raw: unknown): ExtractionConfig {
265332 result . keywords = mapKeywordConfig ( source . keywords as PlainRecord ) ;
266333 }
267334
335+ if ( isPlainRecord ( source . pages ) ) {
336+ target . pages = mapPageConfig ( source . pages as PlainRecord ) ;
337+ }
338+
339+ if ( isPlainRecord ( source . html_options ) ) {
340+ target . htmlOptions = mapHtmlOptions ( source . html_options as PlainRecord ) ;
341+ }
342+
268343 if ( typeof source . output_format === "string" ) {
269344 result . outputFormat = source . output_format as string ;
270345 }
0 commit comments