Skip to content

Instantly share code, notes, and snippets.

@smtm
Created June 8, 2015 11:59
Show Gist options
  • Save smtm/508c63bda54a6960ec9f to your computer and use it in GitHub Desktop.
Save smtm/508c63bda54a6960ec9f to your computer and use it in GitHub Desktop.
convert a trello board to markdown
require 'json'
def stripa(a)
a.gsub(" ","").gsub(",","").gsub("&","").gsub(":","").gsub("-","").gsub("/","").gsub("(","").gsub(")","")
end
json = JSON.parse(File.read("anz.json"))
#puts "##{json['name']}\n\n"
json["lists"].each do |list|
if list["closed"] == false
puts "\n[#{list['name']}](##{stripa(list['name'])})\n\n"
json["cards"].each do |card|
puts " * [#{card['name']}](##{stripa(card['name'])})" if card["idList"] == list["id"] if card['closed'] ==false
end
end
end
puts "\n\n\n"
json["lists"].each do |list|
if list["closed"] ==false
puts "<a name='#{stripa(list['name'])}'></a>"
puts "## #{list['name']}\n\n"
json["cards"].each do |card|
if card["idList"] == list["id"] && card["closed"] == false
puts "<a name='#{stripa(card['name'])}'></a>"
puts "### #{card['name']}\n\n"
puts "#{card['desc']}\n\n"
json["checklists"].each do |chklist|
if chklist["idCard"] == card["id"]
puts "#### #{chklist['name']}\n"
chklist["checkItems"].each do |item|
puts "* #{item['name']}"
end
puts "\n\n"
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment