@@ -31,7 +31,6 @@ Conversion of Muse text to 'Pandoc' document.
3131{-
3232TODO:
3333- Page breaks (five "*")
34−- Headings with anchors (make it round trip with Muse writer)
3534- Org tables
3635- table.el tables
3736- Images with attributes (floating and width)
@@ -241,7 +240,8 @@ header = try $ do
241240 guard $ level <= 5
242241 spaceChar
243242 content <- trimInlinesF . mconcat <$> manyTill inline eol
244− attr <- registerHeader ("", [], []) (runF content defaultParserState)
243+ anchorId <- option "" parseAnchor
244+ attr <- registerHeader (anchorId, [], []) (runF content defaultParserState)
245245 return $ B.headerWith attr level <$> content
246246
247247example :: PandocMonad m => MuseParser m (F Blocks)
@@ -629,14 +629,18 @@ endline = try $ do
629629 notFollowedBy blankline
630630 returnF B.softbreak
631631
632−anchor :: PandocMonad m => MuseParser m (F Inlines)
633−anchor = try $ do
632+parseAnchor :: PandocMonad m => MuseParser m String
633+parseAnchor = try $ do
634634 getPosition >>= \pos -> guard (sourceColumn pos == 1)
635635 char '#'
636636 first <- letter
637637 rest <- many (letter <|> digit)
638638 skipMany spaceChar <|> void newline
639− let anchorId = first:rest
639+ return $ first:rest
640+
641+anchor :: PandocMonad m => MuseParser m (F Inlines)
642+anchor = try $ do
643+ anchorId <- parseAnchor
640644 return $ return $ B.spanWith (anchorId, [], []) mempty
641645
642646footnote :: PandocMonad m => MuseParser m (F Inlines)