@@ -35,6 +35,7 @@ import qualified Commonmark.Parser as Commonmark
35
35
import Commonmark.Types (HasAttributes (.. ), IsBlock (.. ), IsInline (.. ), Rangeable (.. ), SourceRange (.. ))
36
36
import Commonmark.Pandoc (Cm (unCm ))
37
37
import qualified Toml
38
+ import qualified Toml.Pretty as Toml
38
39
import qualified Toml.FromValue as Toml
39
40
import qualified Toml.FromValue.Matcher as Toml
40
41
import qualified Toml.ToValue as Toml
@@ -77,7 +78,7 @@ data ParseAdvisoryError
77
78
= MarkdownError Commonmark. ParseError T. Text
78
79
| MarkdownFormatError T. Text
79
80
| TomlError String T. Text
80
- | AdvisoryError [String ] T. Text
81
+ | AdvisoryError [Toml. MatchMessage ] T. Text
81
82
deriving stock (Eq , Show , Generic )
82
83
83
84
-- | The main parsing function. 'OutOfBandAttributes' are handled
@@ -126,10 +127,10 @@ parseAdvisory policy attrs raw = do
126
127
(Commonmark. commonmark " input" raw :: Either Commonmark. ParseError (Html () ))
127
128
128
129
case parseAdvisoryTable attrs policy doc summary details html table of
129
- Toml. Failure es -> Left (AdvisoryError es (T. pack (unlines es )))
130
+ Toml. Failure es -> Left (AdvisoryError es (T. pack (unlines ( map Toml. prettyMatchMessage es) )))
130
131
Toml. Success warnings adv
131
132
| null warnings -> pure adv
132
- | otherwise -> Left (AdvisoryError warnings (T. pack (unlines warnings))) -- treat warnings as errors
133
+ | otherwise -> Left (AdvisoryError warnings (T. pack (unlines ( map Toml. prettyMatchMessage warnings) ))) -- treat warnings as errors
133
134
134
135
where
135
136
firstPretty
@@ -154,7 +155,7 @@ parseAdvisoryTable
154
155
-> T. Text -- ^ details
155
156
-> T. Text -- ^ rendered HTML
156
157
-> Toml. Table
157
- -> Toml. Result Advisory
158
+ -> Toml. Result Toml. MatchMessage Advisory
158
159
parseAdvisoryTable oob policy doc summary details html tab =
159
160
Toml. runMatcher $
160
161
do fm <- Toml. fromValue (Toml. Table tab)
0 commit comments