From 4e3707543bf39cee86df91611cee594c63bbea8c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 May 2026 15:33:45 +0200 Subject: [PATCH] Docx reader: fix bug in bitmask checking. This led to some table rows being wrongly considered header rows. We now correctly handle the example from https://github.com/jgm/pandoc/issues/8299#issuecomment-4397472060 See #8299. --- src/Text/Pandoc/Readers/Docx/Parse.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index 2c9e029cf..150e5011b 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -67,7 +67,7 @@ import Control.Monad import Control.Monad.Except import Control.Monad.Reader import Control.Monad.State.Strict -import Data.Bits ((.|.)) +import Data.Bits ((.&.)) import qualified Data.ByteString.Lazy as B import Data.Char (chr, ord, readLitChar) import Data.List @@ -807,7 +807,7 @@ testBitMask :: Text -> Int -> Bool testBitMask bitMaskS n = case (reads ("0x" ++ T.unpack bitMaskS) :: [(Int, String)]) of [] -> False - ((n', _) : _) -> (n' .|. n) /= 0 + ((n', _) : _) -> (n' .&. n) /= 0 pHeading :: ParagraphStyle -> Maybe (ParaStyleName, Int) pHeading = getParStyleField headingLev . pStyle