@@ -185,22 +185,22 @@ block = choice [ codeBlock
185185-- field list
186186--
187187
188−rawFieldListItem :: String -> RSTParser (String, String)
189−rawFieldListItem indent = try $ do
190− string indent
188+rawFieldListItem :: Int -> RSTParser (String, String)
189+rawFieldListItem minIndent = try $ do
190+ indent <- length <$> many (char ' ')
191+ guard $ indent >= minIndent
191192 char ':'
192193 name <- many1Till (noneOf "\n") (char ':')
193194 (() <$ lookAhead newline) <|> skipMany1 spaceChar
194195 first <- anyLine
195− rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
196+ rest <- option "" $ try $ do lookAhead (count indent (char ' ') >> spaceChar)
196197 indentedBlock
197198 let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
198− return (name, raw)
199+ return (name, trimr raw)
199200
200−fieldListItem :: String
201− -> RSTParser (Inlines, [Blocks])
202−fieldListItem indent = try $ do
203− (name, raw) <- rawFieldListItem indent
201+fieldListItem :: Int -> RSTParser (Inlines, [Blocks])
202+fieldListItem minIndent = try $ do
203+ (name, raw) <- rawFieldListItem minIndent
204204 let term = B.str name
205205 contents <- parseFromString parseBlocks raw
206206 optional blanklines
@@ -208,7 +208,7 @@ fieldListItem indent = try $ do
208208
209209fieldList :: RSTParser Blocks
210210fieldList = try $ do
211− indent <- lookAhead $ many spaceChar
211+ indent <- length <$> lookAhead (many spaceChar)
212212 items <- many1 $ fieldListItem indent
213213 case items of
214214 [] -> return mempty
@@ -521,11 +521,11 @@ directive' = do
521521 skipMany spaceChar
522522 top <- many $ satisfy (/='\n')
523523 <|> try (char '\n' <*
524− notFollowedBy' (rawFieldListItem " ") <*
524+ notFollowedBy' (rawFieldListItem 3) <*
525525 count 3 (char ' ') <*
526526 notFollowedBy blankline)
527527 newline
528− fields <- many $ rawFieldListItem " "
528+ fields <- many $ rawFieldListItem 3
529529 body <- option "" $ try $ blanklines >> indentedBlock
530530 optional blanklines
531531 let body' = body ++ "\n\n"
@@ -576,6 +576,9 @@ directive' = do
576576 role -> role })
577577 "code" -> codeblock (lookup "number-lines" fields) (trim top) body
578578 "code-block" -> codeblock (lookup "number-lines" fields) (trim top) body
579+ "aafig" -> do
580+ let attribs = ("", ["aafig"], fields)
581+ return $ B.codeBlockWith attribs $ stripTrailingNewlines body
579582 "math" -> return $ B.para $ mconcat $ map B.displayMath
580583 $ toChunks $ top ++ "\n\n" ++ body
581584 "figure" -> do