Wordlint 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+41/−21 lines, 4 files
Files
- Wordlint.cabal +1/−1
- Wordlint.hs +22/−19
- doc/Wordlint.haddock +6/−0
- man/man1/wordlint.1 +12/−1
Wordlint.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: Wordlint-version: 0.1.0.0+version: 0.1.0.1 synopsis: Plaintext prose redundancy linter. description: Wordlint locates matching pairs of words repeated within a user-defined
Wordlint.hs view
@@ -118,25 +118,11 @@ -- machine-based outputs drawn from -- http://www.tedreed.info/programming/2012/06/02/how-to-use-textprettyprintboxes/ processMachineWordData :: Wordpairs Int -> IO ()-processMachineWordData x = printBox $ hsep 2 left (map (vcat left . map text) (transpose $ processMachineWordData' x))+processMachineWordData x = printBox $ hsep 2 left (map (vcat left . map text)+ (transpose $ ["Coord1", "Coord2", "Word", "Distance"]:processMachineWordData' x)) -processDataVim :: (NumOps a) => Wordpairs a -> String-processDataVim [] = ""-processDataVim (x:xs) = ("lnum=" ++ "\'" ++ linum1 ++ "\', " ++ "col=" ++ "\'" ++ colnum1 ++ "\', " ++ "text=" ++ "\'" ++ word ++ "\'\n") ++- ("lnum=" ++ "\'" ++ linum2 ++ "\', " ++ "col=" ++ "\'" ++ colnum2 ++ "\', " ++ "text=" ++ "\'" ++ word ++ "\'\n") ++- processDataVim xs- where word = getWordPairString x- coordinates' = getWordpairCoords x- coordinates1 ((r1,_),(_,_)) = show r1- coordinates1' ((_,_),(r1,_)) = show r1- linum1 = coordinates1 coordinates'- linum2 = coordinates1' coordinates'- coordinates2 ((_,s1),(_,_)) = show s1 - coordinates2' ((_,_),(_,s1)) = show s1 - colnum1 = coordinates2 coordinates'- colnum2 = coordinates2' coordinates'- + processMachineWordData' :: Wordpairs Int -> [[String]] processMachineWordData' [] = [] processMachineWordData' (x:xs) = words (coordinates1 coordinates'@@ -174,7 +160,8 @@ distance' = show (pdiff x) processMachineLineData :: Wordpairs Int -> IO ()-processMachineLineData x = printBox $ hsep 2 left (map (vcat left . map text) (transpose $ processMachineLineData' x))+processMachineLineData x = printBox $ hsep 2 left (map (vcat left . map text)+ (transpose $ ["Coord1", "Coord2", "Word", "Distance"]:processMachineLineData' x)) processMachineLineData' :: Wordpairs Int -> [[String]] processMachineLineData' [] = []@@ -214,7 +201,7 @@ processMachinePercentageData :: Wordpairs Double -> IO () processMachinePercentageData x = printBox $ hsep 2 left (map (vcat left . map text) - (transpose $ processMachinePercentageData' x))+ (transpose $ ["Coord1", "Coord2", "Word", "Distance"]:processMachinePercentageData' x)) processMachinePercentageData' :: Wordpairs Double -> [[String]] processMachinePercentageData' [] = []@@ -231,6 +218,22 @@ coordinates2 ((_,_),(r2,s2)) = show r2 ++ "," ++ show s2 distance' = take 7 $ show (pdiff x) +processDataVim :: (NumOps a) => Wordpairs a -> String+processDataVim [] = ""+processDataVim (x:xs) = ("lnum=" ++ "\'" ++ linum1 ++ "\', " ++ "col=" ++ "\'" ++ colnum1 ++ "\', " ++ "text=" ++ "\'" ++ word ++ "\'\n") +++ ("lnum=" ++ "\'" ++ linum2 ++ "\', " ++ "col=" ++ "\'" ++ colnum2 ++ "\', " ++ "text=" ++ "\'" ++ word ++ "\'\n") +++ processDataVim xs+ where word = getWordPairString x+ coordinates' = getWordpairCoords x+ coordinates1 ((r1,_),(_,_)) = show r1+ coordinates1' ((_,_),(r1,_)) = show r1+ linum1 = coordinates1 coordinates'+ linum2 = coordinates1' coordinates'+ coordinates2 ((_,s1),(_,_)) = show s1 + coordinates2' ((_,_),(_,s1)) = show s1 + colnum1 = coordinates2 coordinates'+ colnum2 = coordinates2' coordinates'+ -- Function that provides summary totals when -h flag is passed summaryData :: Int -> Int -> Int -> IO() summaryData x y z = do
doc/Wordlint.haddock view
@@ -94,6 +94,12 @@ = Examples #examples# +> wordlint --file file.txt++Runs the default check: a word-based check on words of five or more+characters. The distance between each match is to be no more than 250+words. The results are in a machine-readable table format.+ > wordlint --type line --distance 20 --wordlength 7 --file file.txt Finds matching strings consisting of seven characters or more and which
man/man1/wordlint.1 view
@@ -1,4 +1,4 @@-.TH "WORDLINT" "1" "2014\-11\-22" "0.1.0.0+.TH "WORDLINT" "1" "2014\-11\-22" "0.1.0.1 .SH Name .PP wordlint \- plaintext redundancy linter@@ -123,6 +123,17 @@ .fi .RE .SH Examples+.IP+.nf+\f[C]+wordlint\ \-\-file\ file.txt+\f[]+.fi+.PP+Runs the default check: a word\-based check on words of five or more+characters.+The distance between each match is to be no more than 250 words.+The results are in a machine\-readable table format. .IP .nf \f[C]