> module Singleinv
>        (singleinv)
>        where

> import Data.String.Utils

> import Delimiters (nlm5)
> import Process
> import Puncs

> marker :: [Char]
> marker = "^^&&^^"

> newlines :: [Char] -> [Char]
> newlines s = replace "\n" [nlm5] s

> unnewlines :: [Char] -> [Char]
> unnewlines s = replace [nlm5] "\n" s

> ip :: [Char] -> Bool
> ip s = last s `elem` puncs && last (init s) == '\'' 

> inside :: [Char] -> Bool
> inside s = ('\'' `elem` s && '\'' /= head s && '\'' /= last s && not (ip s)) || ('\'' == last s && (not ('`' `elem` s)))

> mark :: [Char] -> [Char]
> mark s | inside s = replace "'" marker s
>        | otherwise = s

> unmark :: [Char] -> [Char]
> unmark = replace marker "'"

> p :: [Char] -> [Char]
> p = process '\'' '\'' "<lq/>" "<rq/>"

> singleinv :: [Char] -> [Char]
> singleinv s = unnewlines $ unmark (p
>                                   (join " "
>                                   (map mark (words (newlines s)))))


> a = "the recipients' spam mailboxes can't foo"
