Commits

Luke Plant committed ec9975d

Cleanups

Comments (0)

Files changed (2)

src/Blog/Formats.hs

 
 import Blog.Utils (regexReplace, regexReplaceCustom, regexReplaceS)
 import Control.Arrow ((>>>))
-import Data.ByteString.Lazy.Char8 (ByteString)
 import Data.Data
 import Data.Maybe (fromJust)
 import Data.Typeable
 import Ella.GenUtils (utf8)
-import qualified Data.ByteString.Lazy.Char8 as BL
+import qualified Data.ByteString.Lazy.Char8 as LB
 import qualified Data.ByteString.Lazy.UTF8 as UTF8
 import qualified Data.Map as Map
 import qualified Text.Pandoc as Pandoc
     "(?::\\d+)?"                                   ++ -- optional port
     "(?:/\\S+|/?)"
 
-escapeHtml = regexReplace "&" (BL.pack "&") >>>
-             regexReplace "<" (BL.pack "&lt;") >>>
-             regexReplace ">" (BL.pack "&gt;")
+escapeHtml = regexReplace "&" (LB.pack "&amp;") >>>
+             regexReplace "<" (LB.pack "&lt;") >>>
+             regexReplace ">" (LB.pack "&gt;")
 
-escapeQuotes = regexReplace "\"" (BL.pack "&quot;")
+escapeQuotes = regexReplace "\"" (LB.pack "&quot;")
 
-normaliseCRLF = regexReplace "\r\n" (BL.pack "\n")
+normaliseCRLF = regexReplace "\r\n" (LB.pack "\n")
 normaliseCRLF_S = regexReplaceS "\r\n" "\n"
 
 -- | Convert HTTP URLS in HTML strings into anchors
-linkify = regexReplaceCustom url_regex (\s -> (BL.pack "<a href=\"") `BL.append` (escapeQuotes s) `BL.append` (BL.pack "\">") `BL.append` s `BL.append` (BL.pack "</a>"))
+linkify = regexReplaceCustom url_regex (\s -> (LB.pack "<a href=\"") `LB.append` (escapeQuotes s) `LB.append` (LB.pack "\">") `LB.append` s `LB.append` (LB.pack "</a>"))
 
-preserveLeadingWhitespace = regexReplaceCustom "^(\\s+)" (regexReplace " " (BL.pack "&nbsp;"))
+preserveLeadingWhitespace = regexReplaceCustom "^(\\s+)" (regexReplace " " (LB.pack "&nbsp;"))
 
-nl2br = regexReplace "\n" (BL.pack "<br />\n")
+nl2br = regexReplace "\n" (LB.pack "<br />\n")
 
 formatPlaintext :: String -> String
 formatPlaintext   = utf8 >>>

src/Blog/Templates.hs

                                       , ("response", ToSElemD $ emptyToNothingBS $ Cm.response cm)
                                       ]
 
-emptyToNothing s = if null s then Nothing else Just s
 emptyToNothingBS s = if LB.null s then Nothing else Just s
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.