@@ -434,7 +434,10 @@ include = try $ do
434 string ".. include::"
434 string ".. include::"
435 skipMany spaceChar
435 skipMany spaceChar
436 f <- trim <$> anyLine
436 f <- trim <$> anyLine
437+ fields <- many $ rawFieldListItem 3
437− -- TODO options
438+ -- options
439+ let (startLine :: Maybe Int) = lookup "start-line" fields >>= safeRead
440+ let (endLine :: Maybe Int) = lookup "end-line" fields >>= safeRead
438 guard $ not (null f)
441 guard $ not (null f)
439 oldPos <- getPosition
442 oldPos <- getPosition
440 oldInput <- getInput
443 oldInput <- getInput
@@ -448,8 +451,11 @@ include = try $ do
448 Left _e -> do
451 Left _e -> do
449 lift $ warning $ "Could not read include file " ++ f ++ "."
452 lift $ warning $ "Could not read include file " ++ f ++ "."
450 return ""
453 return ""
454+ let contents' = unlines $ maybe id (drop . (\x -> x - 1)) startLine
455+ $ maybe id (take . (\x -> x - 1)) endLine
451 setPosition $ newPos f 1 1
457 setPosition $ newPos f 1 1
452− setInput contents
458+ setInput contents'
453 bs <- optional blanklines >> (mconcat <$> many block)
459 bs <- optional blanklines >> (mconcat <$> many block)
454 setInput oldInput
460 setInput oldInput
455 setPosition oldPos
461 setPosition oldPos