neat-interpolation 0.2.2.1 → 0.2.3
raw patch · 4 files changed
+18/−4 lines, 4 filesdep ~HTF
Dependency ranges changed: HTF
Files
- executables/APITests.hs +5/−1
- library/NeatInterpolation.hs +9/−0
- library/NeatInterpolation/Parsing.hs +2/−1
- neat-interpolation.cabal +2/−2
executables/APITests.hs view
@@ -8,10 +8,13 @@ main = htfMain $ htf_thisModulesTests -test_demo =+test_demo = do assertEqual "function(){\n function(){\n {\n indented line\n indented line\n }\n }\n return {\n indented line\n indented line\n }\n}\n" (template a a)+ assertEqual+ "this_could_be_one_long_identifier\n"+ (escaped "one") where template a b = [string|@@ -22,5 +25,6 @@ return $b } |]+ escaped name = [string|this_could_be_${name}_long_identifier|] a = "{\n indented line\n indented line\n}"
library/NeatInterpolation.hs view
@@ -60,6 +60,15 @@ -- -- See how it neatly preserved the indentation levels of lines the -- variable placeholders were at? +--+-- If you need to separate variable placeholder from the following text to+-- prevent treating the rest of line as variable name, use escaped variable:+--+-- > f name = [string|this_could_be_${name}_long_identifier|]+--+-- So+--+-- > f "one" == "this_could_be_one_long_identifier" module NeatInterpolation (string, indentQQPlaceholder) where import BasePrelude
library/NeatInterpolation/Parsing.hs view
@@ -22,7 +22,8 @@ countIndent = fmap length $ try $ lookAhead $ many $ char ' ' content = try identifier <|> contentText identifier = fmap LineContentIdentifier $ - string "$" *> many1 (alphaNum <|> char '\'' <|> char '_')+ char '$' *> (try identifier' <|> between (char '{') (char '}') identifier')+ identifier' = many1 (alphaNum <|> char '\'' <|> char '_') contentText = do text <- manyTill anyChar end if null text
neat-interpolation.cabal view
@@ -1,7 +1,7 @@ name: neat-interpolation version:- 0.2.2.1+ 0.2.3 synopsis: A quasiquoter for neat and simple multiline text interpolation description:@@ -68,7 +68,7 @@ APITests.hs build-depends: neat-interpolation,- HTF >= 0.11 && < 0.13,+ HTF >= 0.11 && < 0.14, base-prelude == 0.1.* default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples