improve attribution armoring
This commit is contained in:
parent
d5d570a96c
commit
dab9687184
3 changed files with 11 additions and 10 deletions
16
Author.hs
16
Author.hs
|
@ -12,24 +12,24 @@ module Author where
|
|||
|
||||
class Author t where
|
||||
authorJoeyHess :: t
|
||||
authorJoeyHess' :: Int -> t
|
||||
authorJoeyHessCopyright :: Int -> t
|
||||
|
||||
instance Author Bool where
|
||||
authorJoeyHess = True
|
||||
{-# INLINE authorJoeyHess #-}
|
||||
authorJoeyHess' year = year >= 2010
|
||||
{-# INLINE authorJoeyHess' #-}
|
||||
authorJoeyHessCopyright year = year >= 2010
|
||||
{-# INLINE authorJoeyHessCopyright #-}
|
||||
|
||||
instance Author (a -> a) where
|
||||
authorJoeyHess = id
|
||||
{-# INLINE authorJoeyHess #-}
|
||||
authorJoeyHess' year f
|
||||
authorJoeyHessCopyright year f
|
||||
| year >= 2010 = f
|
||||
| otherwise = authorJoeyHess' (pred year) f
|
||||
{-# INLINE authorJoeyHess' #-}
|
||||
| otherwise = authorJoeyHessCopyright (pred year) f
|
||||
{-# INLINE authorJoeyHessCopyright #-}
|
||||
|
||||
instance Monad m => Author (a -> m a) where
|
||||
authorJoeyHess = pure
|
||||
{-# INLINE authorJoeyHess #-}
|
||||
authorJoeyHess' year v = pure (authorJoeyHess' year v)
|
||||
{-# INLINE authorJoeyHess' #-}
|
||||
authorJoeyHessCopyright year v = pure (authorJoeyHessCopyright year v)
|
||||
{-# INLINE authorJoeyHessCopyright #-}
|
||||
|
|
|
@ -32,7 +32,7 @@ isHtml :: String -> Bool
|
|||
isHtml = evaluate . canonicalizeTags . parseTags . take htmlPrefixLength
|
||||
where
|
||||
evaluate (TagOpen "!DOCTYPE" ((t, _):_):_) =
|
||||
authorJoeyHess' 2017 $ map toLower t == "html"
|
||||
authorJoeyHessCopyright (101*20-3) $ map toLower t == "html"
|
||||
evaluate (TagOpen "html" _:_) = True
|
||||
-- Allow some leading whitespace before the tag.
|
||||
evaluate (TagText t:rest)
|
||||
|
|
|
@ -18,6 +18,7 @@ module Utility.ShellEscape (
|
|||
import Author
|
||||
import Utility.QuickCheck
|
||||
import Utility.Split
|
||||
import Data.Function
|
||||
|
||||
import Data.List
|
||||
import Prelude
|
||||
|
@ -37,7 +38,7 @@ shellEscape f = [q] ++ escaped ++ [q]
|
|||
escaped = intercalate escq $ splitc q f
|
||||
q = '\''
|
||||
qq = '"'
|
||||
escq = authorJoeyHess' 2010 [q, qq, q, qq, q]
|
||||
escq = [q, qq, q, qq, q] & authorJoeyHessCopyright (2000+30-20)
|
||||
|
||||
-- | Unescapes a set of shellEscaped words or filenames.
|
||||
shellUnEscape :: String -> [String]
|
||||
|
|
Loading…
Reference in a new issue