Wordlint 0.1.0.1 → 0.1.0.2
raw patch · 5 files changed
+62/−41 lines, 5 files
Files
- Wordlint.cabal +2/−1
- Wordlint.hs +16/−15
- changelog +13/−0
- doc/Wordlint.haddock +16/−13
- man/man1/wordlint.1 +15/−12
Wordlint.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: Wordlint-version: 0.1.0.1+version: 0.1.0.2 synopsis: Plaintext prose redundancy linter. description: Wordlint locates matching pairs of words repeated within a user-defined@@ -35,6 +35,7 @@ category: Text build-type: Simple cabal-version: >=1.10+extra-source-files: changelog extra-doc-files: doc/Wordlint.haddock man/man1/wordlint.1
Wordlint.hs view
@@ -11,6 +11,7 @@ cargs <- cmdArgs cliargs let sortflag = sort_ cargs let wordlen = wordlength cargs+ let fname = file cargs -- If human-readable flag is present, print header checkIfHumanHeader cargs -- Acquire String data from file or stdin@@ -31,8 +32,8 @@ putStrLn "" summaryData (length checkedwords) (wordlength cargs) (length dat) else - if sortflag == "vim" - then putStrLn $ processDataVim checkedwords+ if sortflag == "error" + then putStrLn $ processDataError checkedwords fname else processMachineWordData checkedwords where dist = checkDistanceOrAll cargs "word" -> do@@ -44,8 +45,8 @@ putStrLn "" summaryData (length checkedwords) (wordlength cargs) (length dat) else - if sortflag == "vim"- then putStrLn $ processDataVim checkedwords+ if sortflag == "error"+ then putStrLn $ processDataError checkedwords fname else processMachineWordData checkedwords where dist = checkDistanceOrAll cargs "line" -> do@@ -56,8 +57,8 @@ putStrLn "" summaryData (length checkedwords) (wordlength cargs) (length dat) else - if sortflag == "vim"- then putStrLn $ processDataVim checkedwords+ if sortflag == "error"+ then putStrLn $ processDataError checkedwords fname else processMachineLineData checkedwords where dist = checkDistanceOrAll cargs "percentage" -> do @@ -68,8 +69,8 @@ putStrLn "" summaryData (length checkedwords) (wordlength cargs) (length dat) else - if sortflag == "vim"- then putStrLn $ processDataVim checkedwords+ if sortflag == "error"+ then putStrLn $ processDataError checkedwords fname else processMachinePercentageData checkedwords where dist = checkDistanceOrAll cargs @@ -82,8 +83,8 @@ putStrLn "" summaryData (length checkedwords) (wordlength cargs) (length dat) else - if sortflag == "vim" - then putStrLn $ processDataVim checkedwords+ if sortflag == "error" + then putStrLn $ processDataError checkedwords fname else processMachineWordData checkedwords where dist = checkDistanceOrAll cargs -- run*Check functions are run with a maybe to account for --all flag@@ -218,11 +219,11 @@ 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+processDataError :: (NumOps a) => Wordpairs a -> String -> String+processDataError [] _ = ""+processDataError (x:xs) fname = (fname ++ ":" ++ linum1 ++ ":" ++ colnum1 ++ ":" ++ word ++ "\n") +++ (fname ++ ":" ++ linum2 ++ ":" ++ colnum2 ++ ":" ++ word ++ "\n") +++ processDataError xs fname where word = getWordPairString x coordinates' = getWordpairCoords x coordinates1 ((r1,_),(_,_)) = show r1
+ changelog view
@@ -0,0 +1,13 @@+2014-12-01 - version 0.1.0.2+============================++Changed "-s vim" to "-s error".++Changed output of "-s error" to produce better, text editor-agnostic output.++2014-11-25 - version 0.1.0.1 +=============================++Added labels to machine-readable output table.++Minor documntation fixes
doc/Wordlint.haddock view
@@ -20,10 +20,11 @@ user-defined list of words from the list of potential matches. Various modes exist for data output, which is machine-readable by-default. Results may be sorted by alphabetically by word, by position-(line number), or by intervening distance between matches; and may be-used with a human-readable mode. Additionally, a Vim mode provides-output for a plugin.+default with column-based formatting. Results may be sorted by+alphabetically by word, by position (line number), or by intervening+distance between matches; and may be used with a human-readable mode.+Additionally, an \"error\" mode may supersede these options to provide+output designed for easy integration with text editors. = Options #options#@@ -80,16 +81,16 @@ distance. Deactivates -d parameter. [-h, --human] Return human-readable output. Compatible with all sorting except for- @--show vim@, which will supersede @--human@.-[-s, --sort /word|position|distance|vim/]+ @--show error@, which will supersede @--human@.+[-s, --sort /word|position|distance|error/] Sort word pairs alphabetically, by line number, or by intervening- distance; or provides Vim plugin output respective to the following- options:+ distance; or provides output designed for error checking in text+ editors---respective to the following options: > - word > - position (default) > - distance- > - vim+ > - error = Examples #examples#@@ -98,7 +99,8 @@ 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.+words. The results are in a machine-readable table format (i.e. for easy+use with @awk@, @sed@, and the like). > wordlint --type line --distance 20 --wordlength 7 --file file.txt @@ -110,13 +112,14 @@ Finds all matching, five-characters-or-longer strings within a 2.5% distance of one-another within the file, and returns the output sorted-alphabetically and in human-readable form.+alphabetically and in \"human-readable form. -> wordlint -f file.txt -b dir/blacklist.txt --nopunct --nocaps+> wordlint -f file.txt -b dir/blacklist.txt --nopunct --nocaps -s error Finds matching strings consisting of 5 characters or more, and which have had punctuation, a list of words, and all capitalization stripped-from the possible matches. Returns machine-readable table.+from the possible matches. Returns output designed for use in text+editors (i.e. Vim\'s \'erororformat\' option). = See Also #see-also#
man/man1/wordlint.1 view
@@ -1,4 +1,4 @@-.TH "WORDLINT" "1" "2014\-11\-22" "0.1.0.1+.TH "WORDLINT" "1" "2014\-11\-22" "0.1.0.2 .SH Name .PP wordlint \- plaintext redundancy linter@@ -17,11 +17,12 @@ user\-defined list of words from the list of potential matches. .PP Various modes exist for data output, which is machine\-readable by-default.+default with column\-based formatting. Results may be sorted by alphabetically by word, by position (line number), or by intervening distance between matches; and may be used with a human\-readable mode.-Additionally, a Vim mode provides output for a plugin.+Additionally, an "error" mode may supersede these options to provide+output designed for easy integration with text editors. .SH Options .TP .B \-\-help@@ -102,15 +103,15 @@ .TP .B \-h, \-\-human Return human\-readable output.-Compatible with all sorting except for \f[C]\-\-show\ vim\f[], which+Compatible with all sorting except for \f[C]\-\-show\ error\f[], which will supersede \f[C]\-\-human\f[]. .RS .RE .TP-.B \-s, \-\-sort \f[I]word|position|distance|vim\f[]+.B \-s, \-\-sort \f[I]word|position|distance|error\f[] Sort word pairs alphabetically, by line number, or by intervening-distance; or provides Vim plugin output respective to the following-options:+distance; or provides output designed for error checking in text+editors\-\-\-respective to the following options: .RS .IP .nf@@ -118,7 +119,7 @@ \-\ word \-\ position\ (default) \-\ distance-\-\ vim+\-\ error \f[] .fi .RE@@ -133,7 +134,8 @@ 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.+The results are in a machine\-readable table format (i.e.+for easy use with \f[C]awk\f[], \f[C]sed\f[], and the like). .IP .nf \f[C]@@ -153,18 +155,19 @@ .PP Finds all matching, five\-characters\-or\-longer strings within a 2.5% distance of one\-another within the file, and returns the output sorted-alphabetically and in human\-readable form.+alphabetically and in "human\-readable form. .IP .nf \f[C]-wordlint\ \-f\ file.txt\ \-b\ dir/blacklist.txt\ \-\-nopunct\ \-\-nocaps+wordlint\ \-f\ file.txt\ \-b\ dir/blacklist.txt\ \-\-nopunct\ \-\-nocaps\ \-s\ error \f[] .fi .PP Finds matching strings consisting of 5 characters or more, and which have had punctuation, a list of words, and all capitalization stripped from the possible matches.-Returns machine\-readable table.+Returns output designed for use in text editors (i.e.+Vim\[aq]s \[aq]erororformat\[aq] option). .SH See Also .PP A Vim front\-end to Wordlint, creatively named Wordlint.vim, is