mirror of
https://github.com/aelve/guide.git
synced 2024-12-23 21:02:13 +03:00
Switch to Megaparsec 5
This commit is contained in:
parent
dd6b38f742
commit
752864fc30
@ -66,7 +66,7 @@ executable guide
|
|||||||
, ilist
|
, ilist
|
||||||
, iproute == 1.7.*
|
, iproute == 1.7.*
|
||||||
, lucid >= 2.9.5 && < 3
|
, lucid >= 2.9.5 && < 3
|
||||||
, megaparsec == 4.4.*
|
, megaparsec == 5.0.*
|
||||||
, microlens-platform >= 0.3.2
|
, microlens-platform >= 0.3.2
|
||||||
, mmorph == 1.*
|
, mmorph == 1.*
|
||||||
, mtl >= 2.1.1
|
, mtl >= 2.1.1
|
||||||
|
@ -48,6 +48,7 @@ import qualified Data.ByteString as BS
|
|||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
-- Parsing
|
-- Parsing
|
||||||
import Text.Megaparsec hiding (State)
|
import Text.Megaparsec hiding (State)
|
||||||
|
import Text.Megaparsec.Text
|
||||||
-- HTML
|
-- HTML
|
||||||
import Lucid
|
import Lucid
|
||||||
import Text.HTML.SanitizeXSS
|
import Text.HTML.SanitizeXSS
|
||||||
@ -212,8 +213,9 @@ parseLink :: Text -> Either String (Text, Maybe Text, Maybe Text)
|
|||||||
parseLink = either (Left . show) Right . parse p ""
|
parseLink = either (Left . show) Right . parse p ""
|
||||||
where
|
where
|
||||||
shortcut = some (alphaNumChar <|> char '-')
|
shortcut = some (alphaNumChar <|> char '-')
|
||||||
opt = char '(' *> some (noneOf ")") <* char ')'
|
opt = char '(' *> some (noneOf [')']) <* char ')'
|
||||||
text = char ':' *> some anyChar
|
text = char ':' *> some anyChar
|
||||||
|
p :: Parser (Text, Maybe Text, Maybe Text)
|
||||||
p = do
|
p = do
|
||||||
char '@'
|
char '@'
|
||||||
(,,) <$> T.pack <$> shortcut
|
(,,) <$> T.pack <$> shortcut
|
||||||
|
@ -1159,9 +1159,6 @@ renderItemNotes category item = cached (CacheItemNotes (item^.uid)) $ do
|
|||||||
section "editing" [uid_ editingSectionUid] $
|
section "editing" [uid_ editingSectionUid] $
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
-- TODO: a shortcut for editing (when you press Ctrl-something, whatever was
|
|
||||||
-- selected becomes editable)
|
|
||||||
|
|
||||||
renderItemForFeed :: Monad m => Category -> Item -> HtmlT m ()
|
renderItemForFeed :: Monad m => Category -> Item -> HtmlT m ()
|
||||||
renderItemForFeed category item = do
|
renderItemForFeed category item = do
|
||||||
h1_ $ renderItemTitle item
|
h1_ $ renderItemTitle item
|
||||||
|
Loading…
Reference in New Issue
Block a user