Org reader: Fix treatment of id property under heading.

Cloess #9639.
This commit is contained in:
John MacFarlane
2024-04-06 18:24:54 -07:00
parent 5e507024b9
commit c0768e87cf
2 changed files with 16 additions and 3 deletions
+5 -3
View File
@@ -16,7 +16,7 @@ module Text.Pandoc.Readers.Org.DocumentTree
) where
import Control.Arrow ((***), first)
import Control.Monad (guard)
import Control.Monad (guard, mplus)
import Data.List (intersperse)
import Data.Maybe (mapMaybe)
import Data.Text (Text)
@@ -317,10 +317,12 @@ propertiesToAttr properties =
let
toTextPair = fromKey *** fromValue
customIdKey = toPropertyKey "custom_id"
idKey = toPropertyKey "id"
classKey = toPropertyKey "class"
unnumberedKey = toPropertyKey "unnumbered"
specialProperties = [customIdKey, classKey, unnumberedKey]
id' = maybe mempty fromValue . lookup customIdKey $ properties
specialProperties = [customIdKey, idKey, classKey, unnumberedKey]
id' = maybe mempty fromValue $
(lookup customIdKey properties `mplus` lookup idKey properties)
cls = maybe mempty fromValue . lookup classKey $ properties
kvs' = map toTextPair . filter ((`notElem` specialProperties) . fst)
$ properties
+11
View File
@@ -0,0 +1,11 @@
```
% pandoc -f org -t native
#+title: repro
* heading-name
:PROPERTIES:
:ID: 123abc
:END:
^D
[ Header 1 ( "123abc" , [] , [] ) [ Str "heading-name" ] ]
```