@@ -172,19 +172,6 @@ recordAnchorId :: String -> OrgParser ()
172172recordAnchorId i = updateState $ \s ->
173173 s{ orgStateAnchorIds = i : (orgStateAnchorIds s) }
174174
175−addBlockAttribute :: String -> String -> OrgParser ()
176−addBlockAttribute key val = updateState $ \s ->
177− let attrs = orgStateBlockAttributes s
178− in s{ orgStateBlockAttributes = M.insert key val attrs }
179−
180−lookupBlockAttribute :: String -> OrgParser (Maybe String)
181−lookupBlockAttribute key =
182− M.lookup key . orgStateBlockAttributes <$> getState
183−
184−resetBlockAttributes :: OrgParser ()
185−resetBlockAttributes = updateState $ \s ->
186− s{ orgStateBlockAttributes = orgStateBlockAttributes def }
187−
188175updateLastForbiddenCharPos :: OrgParser ()
189176updateLastForbiddenCharPos = getPosition >>= \p ->
190177 updateState $ \s -> s{ orgStateLastForbiddenCharPos = Just p}
@@ -312,9 +299,18 @@ block = choice [ mempty <$ blanklines
312299 , paraOrPlain
313300 ] <?> "block"
314301
302+--
303+-- Block Attributes
304+--
305+
306+-- | Parse optional block attributes (like #+TITLE or #+NAME)
315307optionalAttributes :: OrgParser (F Blocks) -> OrgParser (F Blocks)
316308optionalAttributes parser = try $
317309 resetBlockAttributes *> parseBlockAttributes *> parser
310+ where
311+ resetBlockAttributes :: OrgParser ()
312+ resetBlockAttributes = updateState $ \s ->
313+ s{ orgStateBlockAttributes = orgStateBlockAttributes def }
318314
319315parseBlockAttributes :: OrgParser ()
320316parseBlockAttributes = do
@@ -339,6 +335,15 @@ lookupInlinesAttr attr = try $ do
339335 (fmap Just . parseFromString parseInlines)
340336 val
341337
338+addBlockAttribute :: String -> String -> OrgParser ()
339+addBlockAttribute key val = updateState $ \s ->
340+ let attrs = orgStateBlockAttributes s
341+ in s{ orgStateBlockAttributes = M.insert key val attrs }
342+
343+lookupBlockAttribute :: String -> OrgParser (Maybe String)
344+lookupBlockAttribute key =
345+ M.lookup key . orgStateBlockAttributes <$> getState
346+
342347
343348--
344349-- Org Blocks (#+BEGIN_... / #+END_...)