Skip to content

Instantly share code, notes, and snippets.

@billie66
Last active August 29, 2015 14:18
Show Gist options
  • Save billie66/95dbf927d3baaff34deb to your computer and use it in GitHub Desktop.
Save billie66/95dbf927d3baaff34deb to your computer and use it in GitHub Desktop.
# encoding: utf-8
str = ''
File.open("tasks.md", 'r') do |f|
str = f.read
end
str = str.gsub(/^###\s?(.*?)\s?$/, "<h3>\\1</h3>\n").
gsub(/^任务:\s?(.*?)\n$/, "<div>\n<h3>\\1</h3>\n<ul>").
gsub(/^\-\s+视频:\s?(.*?)$/, "</ul>\n<a href='\\1'>视频</a>\n</div>\n").
gsub(/^\-\s?(.*?)$/, "<li>\\1</li>")
File.open("result.html", 'w') do |f|
f.write(str)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment