@@ -627,45 +627,34 @@ pPlain = do
627627pParaWithWrapper :: PandocMonad m => Attr -> TagParser m Blocks
628628pParaWithWrapper (ident, classes, kvs) = do
629629 guardEnabled Ext_native_divs -- Ensure native_divs is enabled for this behavior
630- pInhalt <- trimInlines <$> pInTags " p" inline
630+ contents <- trimInlines <$> pInTags " p" inline
631631 (do guardDisabled Ext_empty_paragraphs
632- guard (null pInhalt )
632+ guard (null contents )
633633 return mempty ) <|> do
634634 let wrapperAttr = (" wrapper" , " 1" )
635- let alignValue = lookup " align" kvs
636- let otherKVs = filter (\ (k,_) -> k /= " align" ) kvs
637- let validAlignKV = case alignValue of
638- Just algn | algn `elem` [" left" ," right" ," center" ," justify" ] -> [(" align" , algn)]
639- _ -> []
640- let finalKVs = wrapperAttr : (validAlignKV ++ otherKVs)
635+ let finalKVs = wrapperAttr : kvs
641636 let finalAttrs = (ident, classes, finalKVs)
642- return $ B. divWith finalAttrs (B. para pInhalt )
637+ return $ B. divWith finalAttrs (B. para contents )
643638
644- -- Helper function for pPara when only align or no attributes are present
645- pParaSimple :: PandocMonad m => Maybe Text -> TagParser m Blocks
646- pParaSimple alignValue = do
639+ -- Helper function for pPara when no significant attributes are present
640+ pParaSimple :: PandocMonad m => TagParser m Blocks
641+ pParaSimple = do
647642 contents <- trimInlines <$> pInTags " p" inline
648- let paraBlock = B. para contents
649643 (do guardDisabled Ext_empty_paragraphs
650644 guard (null contents)
651645 return mempty ) <|>
652- return (case alignValue of
653- Just algn | algn `elem` [" left" ," right" ," center" ," justify" ] ->
654- B. divWith (" " , [] , [(" align" , algn)]) paraBlock
655- _ -> paraBlock)
646+ return (B. para contents)
656647
657648pPara :: PandocMonad m => TagParser m Blocks
658649pPara = do
659650 TagOpen _ attr' <- lookAhead $ pSatisfy (matchTagOpen " p" [] )
660651 let attr@ (ident, classes, kvs) = toAttr attr'
661- let alignValue = lookup " align" kvs
662- -- "Significant" attributes are any id, class, or key-value pair other than 'align'.
663- let significantKVs = filter (\ (k,_) -> k /= " align" ) kvs
664- let hasSignificantAttributes = not (T. null ident) || not (null classes) || not (null significantKVs)
652+ -- "Significant" attributes are any id, class, or key-value pair.
653+ let hasSignificantAttributes = not (T. null ident) || not (null classes) || not (null kvs)
665654
666655 if hasSignificantAttributes
667656 then pParaWithWrapper attr
668- else pParaSimple alignValue
657+ else pParaSimple
669658
670659pFigure :: PandocMonad m => TagParser m Blocks
671660pFigure = do
0 commit comments