From e0acb24528cbf409ae5723e537acb0c2ed4e2d91 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Mon, 11 Aug 2025 19:54:23 +0200 Subject: Refactor highlighting options [API Change] A new command line option `--syntax-highlighting` is provided; it takes the values `none`, `default`, `idiomatic`, a style name, or a path to a theme file. It replaces the `--no-highlighting`, `--highlighting-style`, and `--listings` options. The `writerListings` and `writerHighlightStyle` fields of the `WriterOptions` type are replaced with `writerHighlightStyle`. Closes: #10525 --- .../src/Text/Pandoc/Lua/Marshal/WriterOptions.hs | 13 ++++--------- pandoc-lua-engine/test/lua/module/globals.lua | 7 ++----- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'pandoc-lua-engine') diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs index 0375059b0..8bdbb077f 100644 --- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs +++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/WriterOptions.hs @@ -115,10 +115,10 @@ typeWriterOptions = deftype "WriterOptions" (pushExtensions, writerExtensions) (peekExtensions, \opts x -> opts{ writerExtensions = x }) - , property "highlight_style" - "Style to use for highlighting (nil = no highlighting)" - (maybe pushnil pushViaJSON, writerHighlightStyle) - (optional . peekViaJSON, \opts x -> opts{ writerHighlightStyle = x }) + , property "highlight_method" + "Method to use for code highlighting ('none'|'default'|'idiomatic'|style)" + (pushViaJSON, writerHighlightMethod) + (peekViaJSON, \opts x -> opts{ writerHighlightMethod = x }) , property "html_math_method" "How to print math in HTML" @@ -155,11 +155,6 @@ typeWriterOptions = deftype "WriterOptions" (pushBool, writerListOfTables) (peekBool, \opts x -> opts{ writerListOfTables = x }) - , property "listings" - "Use listings package for code" - (pushBool, writerListings) - (peekBool, \opts x -> opts{ writerListings = x }) - , property "number_offset" "Starting number for section, subsection, ..." (pushPandocList pushIntegral, writerNumberOffset) diff --git a/pandoc-lua-engine/test/lua/module/globals.lua b/pandoc-lua-engine/test/lua/module/globals.lua index 11b003981..1e5882c47 100644 --- a/pandoc-lua-engine/test/lua/module/globals.lua +++ b/pandoc-lua-engine/test/lua/module/globals.lua @@ -41,8 +41,8 @@ return { assert.are_equal(type(v), 'string') end end), - test('highlight_style', function () - assert.are_equal(type(PANDOC_WRITER_OPTIONS.highlight_style), 'table') + test('highlight_method', function () + assert.are_equal(type(PANDOC_WRITER_OPTIONS.highlight_method), 'string') end), test('html_math_method', function () assert.are_equal(type(PANDOC_WRITER_OPTIONS.html_math_method), 'string') @@ -56,9 +56,6 @@ return { test('incremental', function () assert.are_equal(type(PANDOC_WRITER_OPTIONS.incremental), 'boolean') end), - test('listings', function () - assert.are_equal(type(PANDOC_WRITER_OPTIONS.listings), 'boolean') - end), test('number_offset', function () assert.are_equal(type(PANDOC_WRITER_OPTIONS.number_offset), 'table') for _, v in ipairs(PANDOC_WRITER_OPTIONS.number_offset) do -- cgit v1.2.3