@@ -311,6 +311,7 @@ lexComment = do
311lexMacro :: PandocMonad m => RoffLexer m RoffTokens
311lexMacro :: PandocMonad m => RoffLexer m RoffTokens
312lexMacro = do
312lexMacro = do
313 pos <- getPosition
313 pos <- getPosition
314+ guard $ sourceColumn pos == 1
314 char '.' <|> char '\''
315 char '.' <|> char '\''
315 skipMany spacetab
316 skipMany spacetab
316 macroName <- many (satisfy (not . isSpace))
317 macroName <- many (satisfy (not . isSpace))
@@ -369,7 +370,9 @@ lexTableRows = do
369 return $ zip aligns rows
370 return $ zip aligns rows
371tableCell :: PandocMonad m => RoffLexer m RoffTokens
372tableCell :: PandocMonad m => RoffLexer m RoffTokens
372−tableCell = (enclosedCell <|> simpleCell) >>= lexRoff . T.pack
375+ (enclosedCell <|> simpleCell) >>= lexRoff pos . T.pack
374 enclosedCell = do
377 enclosedCell = do
375 try (string "T{")
378 try (string "T{")
@@ -642,9 +645,10 @@ linePartsToString = mconcat . map go
642 go _ = mempty
645 go _ = mempty
644-- | Tokenize a string as a sequence of groff tokens.
647-- | Tokenize a string as a sequence of groff tokens.
645−lexRoff :: PandocMonad m => T.Text -> m RoffTokens
648+lexRoff :: PandocMonad m => SourcePos -> T.Text -> m RoffTokens
646−lexRoff txt = do
649+lexRoff pos txt = do
650+ eithertokens <- readWithM (do setPosition pos
647− eithertokens <- readWithM (mconcat <$> many manToken) def (T.unpack txt)
651+ mconcat <$> many manToken) def (T.unpack txt)
648 case eithertokens of
652 case eithertokens of
649 Left e -> throwError e
653 Left e -> throwError e
650 Right tokenz -> return tokenz
654 Right tokenz -> return tokenz