mirror of
https://github.com/srid/ema.git
synced 2024-11-29 09:25:14 +03:00
parent
1c2d30351d
commit
7363c3f059
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,9 +1,11 @@
|
||||
# Revision history for ema
|
||||
|
||||
## Unreleased
|
||||
## Unreleased (0.2.0.0)
|
||||
|
||||
- Remove Ex03_Documentation.hs (moved to separate repo, `ema-docs`)
|
||||
- Add `Ord` instance to `Slug`
|
||||
- `Ema.Slug`
|
||||
- Add `Ord` instance to `Slug`
|
||||
- Unicode normalize slugs using NFC
|
||||
- Add default implementation based on Enum for `staticRoute`
|
||||
- Helpers.FileSystem
|
||||
- add `mountOnLVar`
|
||||
- Helpers.Tailwind
|
||||
@ -11,8 +13,9 @@
|
||||
- Add twind shim *before* application's head
|
||||
- Helpers.Markdown
|
||||
- add helpers to parse markdown; `parseMarkdownWithFrontMatter` and `parseMarkdown`
|
||||
- Add Ex03_Basic.hs example
|
||||
- Add default implementation based on Enum for `staticRoute`
|
||||
- Examples
|
||||
- Remove Ex03_Documentation.hs (moved to separate repo, `ema-docs`)
|
||||
- Add Ex03_Basic.hs example
|
||||
|
||||
## 0.1.0.0 -- 2021-04-26
|
||||
|
||||
|
@ -56,6 +56,7 @@ library
|
||||
, unliftio
|
||||
, wai
|
||||
, wai-middleware-static
|
||||
, unicode-transforms
|
||||
, wai-websockets
|
||||
, warp
|
||||
, websockets
|
||||
|
@ -3,6 +3,7 @@
|
||||
module Ema.Route.Slug where
|
||||
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Normalize as UT
|
||||
|
||||
-- | An URL path is made of multiple slugs, separated by '/'
|
||||
newtype Slug = Slug {unSlug :: Text}
|
||||
@ -13,4 +14,8 @@ instance IsString Slug where
|
||||
fromString (toText -> s) =
|
||||
if "/" `T.isInfixOf` s
|
||||
then error ("Slug cannot contain a slash: " <> s)
|
||||
else Slug s
|
||||
else Slug (unicodeNormalize s)
|
||||
where
|
||||
-- Normalize varying non-ascii strings (in filepaths / slugs) to one
|
||||
-- representation, so that they can be reliably linked to.
|
||||
unicodeNormalize = UT.normalize UT.NFC . toText
|
||||
|
Loading…
Reference in New Issue
Block a user