diff options
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r-- | src/Hakyll/Web/Template/Canonicalize.hs | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/Hakyll/Web/Template/Canonicalize.hs b/src/Hakyll/Web/Template/Canonicalize.hs new file mode 100644 index 0000000..13f9d67 --- /dev/null +++ b/src/Hakyll/Web/Template/Canonicalize.hs @@ -0,0 +1,86 @@ +-------------------------------------------------------------------------------- +-- | TODO +module Hakyll.Web.Template.Canonicalize + ( canonicalize + ) where + + +-------------------------------------------------------------------------------- +import Hakyll.Web.Template.Internal + + +-------------------------------------------------------------------------------- +-- +-- Some initial implementation notes. Note: Not valid syntax etc. +-- +-- +-- Top level ONLY: +-- [TrimL, t, TrimR] = [t] +-- +-- Dedupe: +-- +-- List: +-- +-- [t1, TrimR, TrimR, t2] = [t1, TrimR, t2] +-- +-- [t1, TrimL, TrimL, t2] = [t1, TrimL, t2] +-- +-- If: +-- +-- [t1, TrimR, If ex [TrimR, t] e, t2] = [t1, If ex [TrimR, t] e, t2] +-- +-- [t1, If ex t [e, TrimL], TrimL, t2] = [t1, If ex t [e, TrimL], t2] +-- +-- [t1, If ex [t, TrimL] Nothing, TrimL, t2] = [t1, If ex [t, TrimL] Nothing, t2] +-- +-- For: +-- +-- [t1, TrimR, For e [TrimR, b] sep, t2] = [t1, For e [TrimR, b] sep, t2] +-- +-- [t1, For e b [sep, TrimL], TrimL, t2] = [t1, For e b [sep, TrimL], t2] +-- +-- [t1, For e [b, TrimL] Nothing, TrimL, t2] = [t1, For e [b, TrimL] Nothing, t2] +-- +-- +-- Sink: +-- +-- If: +-- +-- [t1, TrimR, If ex t e, t2] = [t1, If ex [TrimR, t] e, t2] +-- +-- [t1, If ex t e, TrimL, t2] = if isJust e +-- then [t1, If ex t [e, TrimL], t2] +-- else [t1, If ex [t, TrimL] e, t2] +-- +-- For: +-- +-- [t1, TrimR, For e b sep, t2] = [t1, For e [TrimR, b] sep, t2] +-- +-- [t1, For e b sep, TrimL, t2] = if isJust sep +-- then [t1, For e b [sep, TrimL], t2] +-- else [t1, For e [b, TrimL] sep, t2] +-- +-- +-- Shift/Lift: +-- +-- If: +-- +-- If ex [t1, TrimR] (Just e) = If ex t1 [TrimR, e] +-- +-- If ex [t1, TrimR] Nothing = [If ex t1 Nothing, TrimR] +-- +-- If ex t [TrimL, e] = If ex [t, TrimL] e +-- +-- +-- For: +-- +-- For e [t1, TrimR] (Just sep) = For e t1 [TrimR, sep] +-- +-- For e [t1, TrimR] Nothing = For e t1 [TrimR, sep] +-- +-- For e b [TrimL, sep] = For e [b, TrimL] sep +-- +-- +-- +canonicalize :: Template -> Template +canonicalize = undefined |