- 小法师系列
- 每个程序员上辈纸都是法力无边的巫师
ruby README.md
to generate SUMMARY.MD
- 每个程序员上辈纸都是法力无边的巫师
- 来源(书栈小编注)
小法师系列
每个程序员上辈纸都是法力无边的巫师
ruby README.md
to generate SUMMARY.MD
def main
files = Dir['Contents/*.md']
url = "Contents/"
lists = {}
for file in files
File.open(file) do | text |
text.each_line { |line|
if line.include?"\#"
lists[file.delete("Contents/" ".md")] = line.chomp.delete("\#")
break
end
}
end
end
lists.keys.sort
File.open("SUMMARY.md", "w") do |file|
for k, v in lists
link = "1. " + "[" + v + "](" + url + k +".md)"
file.puts link
end
end
end
if __FILE__ == $0
main()
end
来源(书栈小编注)
https://github.com/Artwalk/LittleMaster