summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--weblog-model.lua49
1 files changed, 30 insertions, 19 deletions
diff --git a/weblog-model.lua b/weblog-model.lua
index 3b3cc40..d3f5271 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