Skip to content

Instantly share code, notes, and snippets.

@csabahenk
Last active September 5, 2016 06:06
Show Gist options
  • Save csabahenk/c077d9d1a7601cd191434761f3a010c1 to your computer and use it in GitHub Desktop.
Save csabahenk/c077d9d1a7601cd191434761f3a010c1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'cgi'
checkopt = proc { |a|
!a.flatten.map { |o| $*.delete o }.compact.empty?
}
increment = checkopt[%w[-i --increment]]
breaknl = checkopt[%w[-b --break]]
checklist = checkopt[%w[-c --checklist]]
puts $<.read.strip.gsub(%r@chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=(.*)@) {
CGI.unescape $1
}.split("\n\n").map.with_index { |e, i|
t,l,x=e.split("\n")
if !x and l=~/\Ahttps?:/
e="[#{t}](#{l})"
end
"#{checklist ? "- [ ]" : "#{increment ? i+1 : 1}."} #{e}"
}.join("\n" * (breaknl ? 2 : 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment