github.com/decred/dcrlnd@v0.7.6/docs/ruby-thing.rb (about)

     1  #!/usr/bin/env ruby
     2  
     3  File.open("INSTALL.md", 'r') do |f|
     4    f.each_line do |line|
     5      forbidden_words = ['Table of contents', 'define', 'pragma']
     6      next if !line.start_with?("#") || forbidden_words.any? { |w| line =~ /#{w}/ }
     7       
     8      title = line.gsub("#", "").strip
     9      href = title.gsub(" ", "-").downcase
    10      puts "  " * (line.count("#")-1) + "* [#{title}](\##{href})"
    11    end
    12  end