diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-07-04 14:50:51 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-07-04 14:54:28 +0000 |
commit | e5321e16eccea02d77066f8cf12359f2d55878e8 (patch) | |
tree | 262bfca4624c3a395f3f47f472129412c274abde | |
parent | 6d0829a8ac150970a16122a0f4c555960a296c6e (diff) | |
download | acf-weblog-e5321e16eccea02d77066f8cf12359f2d55878e8.tar.bz2 acf-weblog-e5321e16eccea02d77066f8cf12359f2d55878e8.tar.xz |
Bug fix to ignore blank lines in word lists
(cherry picked from commit 68f37a3b6addeb96cf462fd58df16718b1209a6e)
-rw-r--r-- | weblog-model.lua | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/weblog-model.lua b/weblog-model.lua index eca067a..e5dd096 100644 --- a/weblog-model.lua +++ b/weblog-model.lua @@ -465,11 +465,15 @@ local function checkwords(logentry) if not thisline then break end - _,instcnt = string.lower(logentry.URL):gsub(format.escapemagiccharacters(thisline), " ") - if instcnt ~= 0 then - logentry.ignoreme = true - --logme("ignoring...") - break + + -- ignore blank lines + if string.find(thisline, "%S") then + _,instcnt = string.lower(logentry.URL):gsub(format.escapemagiccharacters(thisline), " ") + if instcnt ~= 0 then + logentry.ignoreme = true + --logme("ignoring...") + break + end end end @@ -480,12 +484,15 @@ local function checkwords(logentry) break end - _,instcnt = string.lower(logentry.URL):gsub(format.escapemagiccharacters(thisline), " ") - if instcnt ~= 0 then - -- logme("instcnt = "..instcnt) - isbad=1 - wrdcnt= wrdcnt + instcnt - badwordloc[#badwordloc+1] = thisline + -- ignore blank lines + if string.find(thisline, "%S") then + _,instcnt = string.lower(logentry.URL):gsub(format.escapemagiccharacters(thisline), " ") + if instcnt ~= 0 then + -- logme("instcnt = "..instcnt) + isbad=1 + wrdcnt= wrdcnt + instcnt + badwordloc[#badwordloc+1] = thisline + end end end @@ -523,15 +530,19 @@ local function checkwords(logentry) if not goodline then break end - _,instcnt = string.lower(logentry.URL):gsub(format.escapemagiccharacters(goodline), " ") - --if string.find(logentry.URL,goodline) then - if instcnt ~= 0 then - if wrdcnt >= instcnt then - wrdcnt = wrdcnt - instcnt - else - wrdcnt = 0 + + -- ignore blank lines + if string.find(thisline, "%S") then + _,instcnt = string.lower(logentry.URL):gsub(format.escapemagiccharacters(goodline), " ") + --if string.find(logentry.URL,goodline) then + if instcnt ~= 0 then + if wrdcnt >= instcnt then + wrdcnt = wrdcnt - instcnt + else + wrdcnt = 0 + end + goodwordloc[#goodwordloc+1] = goodline end - goodwordloc[#goodwordloc+1] = goodline end end end |