Skip to content

Commit

Permalink
Support .It [stuff] Xo
Browse files Browse the repository at this point in the history
Add a command test since these seem annoying to write in the other
format.
  • Loading branch information
silby committed Oct 31, 2024
1 parent 56670bb commit b5a23f6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Text/Pandoc/Readers/Mdoc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -954,16 +954,15 @@ parseDefinitionList = do
where
dlItem = do
macro "It"
dt <- (xoListHead <|> listHead)
dt <- (try xoListHead) <|> parseInline
dd <- mconcat <$> many parseRegularBlock
return (dt, [dd])
-- TODO refactor, maybe extract the bodies of
-- lineEnclosure/multilineEnclosure
listHead = parseInline
xoListHead = do
before <- option mempty parseInline
macro "Xo"
optional eol
many1Till parseInlines (emptyMacro "Xc") >>= spacify
after <- many1Till parseInlines (emptyMacro "Xc")
spacify (before:after)

parseColumnList :: PandocMonad m => MdocParser m Blocks
parseColumnList = do
Expand Down
24 changes: 24 additions & 0 deletions test/command/mdoc-Bl-tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```
% pandoc -f mdoc -t native
.Bl -tag
.It one
one
.It Xo
two
.Xc
two
.It Em three Xo
three
.Xc
three
.El
^D
[ DefinitionList
[ ( [ Str "one" ] , [ [ Para [ Str "one" ] ] ] )
, ( [ Str "two" ] , [ [ Para [ Str "two" ] ] ] )
, ( [ Emph [ Str "three" ] , Space , Str "three" ]
, [ [ Para [ Str "three" ] ] ]
)
]
]
```

0 comments on commit b5a23f6

Please # to comment.