parent
2b7a541dd0
commit
9593b375d7
3 changed files with 36 additions and 4 deletions
|
@ -497,9 +497,8 @@ parsePara = para . trimInlines <$> parseInlines
|
|||
|
||||
parseInlines :: PandocMonad m => ManParser m Inlines
|
||||
parseInlines = do
|
||||
inls <- many1 (lineInl <|> comment)
|
||||
let withspaces = intersperse B.space inls
|
||||
return $ mconcat withspaces
|
||||
inls <- many1 (lineInl <|> comment <|> parseLink <|> parseEmailLink)
|
||||
return $ mconcat $ intersperse B.space inls
|
||||
|
||||
lineInl :: PandocMonad m => ManParser m Inlines
|
||||
lineInl = do
|
||||
|
@ -605,6 +604,26 @@ definitionListItem = try $ do
|
|||
parseDefinitionList :: PandocMonad m => ManParser m Blocks
|
||||
parseDefinitionList = definitionList <$> many1 definitionListItem
|
||||
|
||||
parseLink :: PandocMonad m => ManParser m Inlines
|
||||
parseLink = try $ do
|
||||
MMacro _ args <- mmacro "UR"
|
||||
contents <- mconcat <$> many1 (lineInl <|> comment)
|
||||
mmacro "UE"
|
||||
let url = case args of
|
||||
[] -> ""
|
||||
(x:_) -> linePartsToString x
|
||||
return $ link url "" contents
|
||||
|
||||
parseEmailLink :: PandocMonad m => ManParser m Inlines
|
||||
parseEmailLink = do
|
||||
MMacro _ args <- mmacro "MT"
|
||||
contents <- mconcat <$> many1 (lineInl <|> comment)
|
||||
mmacro "ME"
|
||||
let url = case args of
|
||||
[] -> ""
|
||||
(x:_) -> "mailto:" ++ linePartsToString x
|
||||
return $ link url "" contents
|
||||
|
||||
parseMacroDef :: PandocMonad m => ManParser m Blocks
|
||||
parseMacroDef = do
|
||||
MMacro _ args <- mmacro "de"
|
||||
|
|
|
@ -197,3 +197,13 @@ Plus: +
|
|||
.PP
|
||||
Minus: \-
|
||||
.PP
|
||||
.SH Links
|
||||
.PP
|
||||
.UR http://\:example.com
|
||||
some random
|
||||
site
|
||||
.UE
|
||||
.PP
|
||||
.MT me@example.com
|
||||
my email address.
|
||||
.ME
|
||||
|
|
|
@ -98,4 +98,7 @@ Pandoc (Meta {unMeta = fromList [("date",MetaInlines [Str "Oct",Space,Str "17,",
|
|||
,Para [Str "Period:",Space,Str "."]
|
||||
,Para [Str "Bang:",Space,Str "!"]
|
||||
,Para [Str "Plus:",Space,Str "+"]
|
||||
,Para [Str "Minus:",Space,Str "-"]]
|
||||
,Para [Str "Minus:",Space,Str "-"]
|
||||
,Header 1 ("",[],[]) [Str "Links"]
|
||||
,Para [Link ("",[],[]) [Str "some",Space,Str "randomsite"] ("http://example.com","")]
|
||||
,Para [Link ("",[],[]) [Str "my",Space,Str "email",Space,Str "address."] ("mailto:me@example.com","")]]
|
||||
|
|
Loading…
Reference in a new issue