@@ -112,12 +112,14 @@ newBlockTags = ["haskell","syntaxhighlight","source","gallery","references"]
112isBlockTag' :: Tag Text -> Bool
112isBlockTag' :: Tag Text -> Bool
113isBlockTag' tag@(TagOpen t _) = (isBlockTag tag || t `elem` newBlockTags) &&
113isBlockTag' tag@(TagOpen t _) = (isBlockTag tag || t `elem` newBlockTags) &&
114 t `notElem` eitherBlockOrInline
114 t `notElem` eitherBlockOrInline
115+isBlockTag' (TagClose "ref") = True -- needed so 'special' doesn't parse it
115isBlockTag' tag@(TagClose t) = (isBlockTag tag || t `elem` newBlockTags) &&
116isBlockTag' tag@(TagClose t) = (isBlockTag tag || t `elem` newBlockTags) &&
116 t `notElem` eitherBlockOrInline
117 t `notElem` eitherBlockOrInline
117isBlockTag' tag = isBlockTag tag
118isBlockTag' tag = isBlockTag tag
119isInlineTag' :: Tag Text -> Bool
120isInlineTag' :: Tag Text -> Bool
120isInlineTag' (TagComment _) = True
121isInlineTag' (TagComment _) = True
122+isInlineTag' (TagClose "ref") = False -- see below inlineTag
121isInlineTag' t = not (isBlockTag' t)
123isInlineTag' t = not (isBlockTag' t)
123eitherBlockOrInline :: [Text]
125eitherBlockOrInline :: [Text]
@@ -554,11 +556,17 @@ variable = try $ do
554 contents <- manyTillChar anyChar (try $ string "}}}")
556 contents <- manyTillChar anyChar (try $ string "}}}")
555 return $ "{{{" <> contents <> "}}}"
557 return $ "{{{" <> contents <> "}}}"
559+singleParaToPlain :: Blocks -> Blocks
560+singleParaToPlain bs =
562+ [Para ils] -> B.fromList [Plain ils]
557inlineTag :: PandocMonad m => MWParser m Inlines
565inlineTag :: PandocMonad m => MWParser m Inlines
558inlineTag = do
566inlineTag = do
559 (tag, _) <- lookAhead $ htmlTag isInlineTag'
567 (tag, _) <- lookAhead $ htmlTag isInlineTag'
560 case tag of
568 case tag of
561− TagOpen "ref" _ -> B.note . B.plain <$> inlinesInTags "ref"
569+ TagOpen "ref" _ -> B.note . singleParaToPlain <$> blocksInTags "ref"
562 TagOpen "nowiki" _ -> try $ do
570 TagOpen "nowiki" _ -> try $ do
563 (_,raw) <- htmlTag (~== tag)
571 (_,raw) <- htmlTag (~== tag)
564 if T.any (== '/') raw
572 if T.any (== '/') raw