From 986d178c616fccdfe9a3d711f29ca3cf66e1813f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 26 Sep 2025 14:11:47 -0400 Subject: [PATCH 1/2] Support pandoc-types 1.23, used by pandoc 3 --- dombuilder-pandoc.cabal | 2 +- src/Reflex/Dom/Builder/Pandoc.hs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/dombuilder-pandoc.cabal b/dombuilder-pandoc.cabal index 3607fce..6d386ca 100644 --- a/dombuilder-pandoc.cabal +++ b/dombuilder-pandoc.cabal @@ -20,7 +20,7 @@ library build-depends: base >=4.12 && <4.15 , containers >= 0.6 && <0.7 , html-parse >= 0.2 && <0.3 - , pandoc-types >= 1.22 && <1.23 + , pandoc-types >= 1.23 && <1.24 , reflex-dom-core >= 0.7 && < 0.9 , text >= 1.2 && <1.3 -- We don't actually need aeson, but pandoc-types has a too-lenient bound diff --git a/src/Reflex/Dom/Builder/Pandoc.hs b/src/Reflex/Dom/Builder/Pandoc.hs index 217a5dd..efa3d71 100644 --- a/src/Reflex/Dom/Builder/Pandoc.hs +++ b/src/Reflex/Dom/Builder/Pandoc.hs @@ -23,6 +23,13 @@ attr (ident, classes, other) = Map.fromListWith (\a b -> a <> " " <> b) $ , ("class", T.intercalate " " classes) ] <> other +caption :: DomBuilder t m => Caption -> m () +caption = \case + Caption (Just short) xs -> do + mapM_ inline short + mapM_ block xs + Caption Nothing xs -> mapM_ block xs + block :: DomBuilder t m => Block -> m () block = \case Plain xs -> mapM_ inline xs @@ -42,16 +49,15 @@ block = \case Header lvl a xs -> elAttr ("h" <> T.pack (show lvl)) (attr a) $ mapM_ inline xs HorizontalRule -> el "hr" $ pure () - Table a caption _colSpecs (TableHead hattrs hrows) tbody (TableFoot fattrs frows) -> + Figure a cap xs -> elAttr "figure" (attr a) $ do + el "figcaption" $ caption cap + mapM_ block xs + Table a cap _colSpecs (TableHead hattrs hrows) tbody (TableFoot fattrs frows) -> -- TODO: format columns -- TODO: format cells -- TODO: handle intermediate table heads in body elAttr "table" (attr a) $ do - el "caption" $ case caption of - (Caption (Just short) xs) -> do - mapM_ inline short - mapM_ block xs - (Caption Nothing xs) -> mapM_ block xs + el "caption" $ caption cap let mkRow cell (Row ra cs) = elAttr "tr" (attr ra) $ mapM_ (\(Cell ca _align _rowSpan _colSpan ys) -> elAttr cell (attr ca) $ mapM_ block ys) cs @@ -60,7 +66,6 @@ block = \case elAttr "tbody" (attr ba) $ mapM_ (mkRow "td") cs elAttr "tfoot" (attr fattrs) $ mapM_ (mkRow "td") frows Div a xs -> elAttr "div" (attr a) $ mapM_ block xs - Null -> blank where listStyle = \case DefaultStyle -> mempty From 8ff9744e34159e136d874fb7082da83c2144e42a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 26 Sep 2025 16:01:13 -0400 Subject: [PATCH 2/2] Try updating GitHub CI, version bounds --- .github/workflows/haskell.yml | 22 ++++++++++++++++------ dombuilder-pandoc.cabal | 8 +++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index c1c548d..0879d09 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -1,23 +1,28 @@ name: github-action -on: [push, pull_request] +on: [push, pull_request] jobs: build: strategy: + fail-fast: false matrix: - ghc: ['8.6.5', '8.8.4'] + ghc: ['8.6.5', '8.8.4', '8.10.7', '9.0.2', '9.2.5', '9.4.5', '9.6.1', '9.8.2', '9.10.1', '9.12.1'] os: ['ubuntu-latest', 'macos-latest'] runs-on: ${{ matrix.os }} name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-haskell@v1 + + - uses: actions/checkout@v3 + + - uses: haskell-actions/setup@v2.8.2 with: ghc-version: ${{ matrix.ghc }} + cabal-version: '3.10.3.0' + - name: Cache - uses: actions/cache@v1 + uses: actions/cache@v3 env: cache-name: cache-cabal with: @@ -33,7 +38,12 @@ jobs: run: | cabal update cabal build --only-dependencies --enable-tests --enable-benchmarks + - name: Build run: cabal build --enable-tests --enable-benchmarks all + - name: Run tests - run: cabal test all + run: cabal test --enable-tests all + + - name: Build Docs + run: cabal haddock diff --git a/dombuilder-pandoc.cabal b/dombuilder-pandoc.cabal index 6d386ca..64ba3da 100644 --- a/dombuilder-pandoc.cabal +++ b/dombuilder-pandoc.cabal @@ -17,14 +17,12 @@ extra-source-files: CHANGELOG.md library exposed-modules: Reflex.Dom.Builder.Pandoc Reflex.Dom.Builder.Pandoc.RawHtml - build-depends: base >=4.12 && <4.15 - , containers >= 0.6 && <0.7 + build-depends: base >=4.12 && <4.22 + , containers >= 0.6 && <0.8 , html-parse >= 0.2 && <0.3 , pandoc-types >= 1.23 && <1.24 , reflex-dom-core >= 0.7 && < 0.9 - , text >= 1.2 && <1.3 - -- We don't actually need aeson, but pandoc-types has a too-lenient bound - , aeson >= 1.4 && <2.2 + , text >= 1.2 && <2.2 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall