Commit d40a8148 authored by Ilan Arad's avatar Ilan Arad

I hate bugs! Hackish censored counting.

parent 792ae4e3
......@@ -114,15 +114,20 @@ switch
#?{user,password}=argv
auth={user,password} # HTTP Basic.
# Filter content.
count=0 #? Ugly?
content=content
count=empty:0,hacks:0 #? Ugly?
censored=(s)->switch
when s is '' # Remove empty lines.
count.empty++
false
when /^<(meta|script|link)[^>]*>(.*<\/script>)?$/i.test s # Remove hacks for local dev.
count.hacks++
false
else true
content=m[2]
.split '\n'
.filter (s)->
if s is '' then return false # Remove empty lines.
if /^<(meta|script|link)[^>]*>(.*<\/script>)?$/i.test s then return false # Remove hacks for local dev.
++count
.filter (s)->censored s
.join '\n'
if count then console.error "#{count} lines filtered.".red
if count.empty or count.hacks then console.error "Censored lines:".red,count
# Payload must follow schema spec…
payload={content} #?payload=JSON.stringify content:m[2]
wpsuck_api
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment