@@ -80,6 +80,10 @@ newtype PropertyValue = PropertyValue { fromValue :: String }
80toPropertyValue :: String -> PropertyValue
80toPropertyValue :: String -> PropertyValue
81toPropertyValue = PropertyValue
81toPropertyValue = PropertyValue
83+-- | Check whether the property value is non-nil (i.e. truish).
84+isNonNil :: PropertyValue -> Bool
85+isNonNil p = map toLower (fromValue p) `notElem` ["()", "{}", "nil"]
83-- | Key/value pairs from a PROPERTIES drawer
87-- | Key/value pairs from a PROPERTIES drawer
84type Properties = [(PropertyKey, PropertyValue)]
88type Properties = [(PropertyKey, PropertyValue)]
@@ -200,12 +204,16 @@ propertiesToAttr properties =
200 toStringPair prop = (fromKey (fst prop), fromValue (snd prop))
204 toStringPair prop = (fromKey (fst prop), fromValue (snd prop))
201 customIdKey = toPropertyKey "custom_id"
205 customIdKey = toPropertyKey "custom_id"
202 classKey = toPropertyKey "class"
206 classKey = toPropertyKey "class"
207+ unnumberedKey = toPropertyKey "unnumbered"
208+ specialProperties = [customIdKey, classKey, unnumberedKey]
203 id' = fromMaybe mempty . fmap fromValue . lookup customIdKey $ properties
209 id' = fromMaybe mempty . fmap fromValue . lookup customIdKey $ properties
204 cls = fromMaybe mempty . fmap fromValue . lookup classKey $ properties
210 cls = fromMaybe mempty . fmap fromValue . lookup classKey $ properties
205− kvs' = map toStringPair . filter ((`notElem` [customIdKey, classKey]) . fst)
211+ kvs' = map toStringPair . filter ((`notElem` specialProperties) . fst)
206 $ properties
212 $ properties
214+ fromMaybe False . fmap isNonNil . lookup unnumberedKey $ properties
208− (id', words cls, kvs')
216+ (id', words cls ++ (if isUnnumbered then ["unnumbered"] else []), kvs')
210tagTitle :: Inlines -> [Tag] -> Inlines
218tagTitle :: Inlines -> [Tag] -> Inlines
211tagTitle title tags = title <> (mconcat $ map tagToInline tags)
219tagTitle title tags = title <> (mconcat $ map tagToInline tags)