tcl_tk.rb 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. module Docs
  2. class TclTk < UrlScraper
  3. self.name = 'Tcl/Tk'
  4. self.type = 'tcl_tk'
  5. self.slug = 'tcl_tk'
  6. self.release = '8.6.6'
  7. self.base_url = 'https://www.tcl.tk/man/tcl/'
  8. self.root_path = 'contents.htm'
  9. html_filters.push 'tcl_tk/entries', 'tcl_tk/clean_html', 'title'
  10. options[:root_title] = 'Tcl/Tk Documentation'
  11. options[:trailing_slash] = false
  12. options[:skip] = %w(siteinfo.htm)
  13. options[:skip_patterns] = [
  14. # ignore keyword list pages
  15. /\AKeywords\//,
  16. # ignore C-API, only required for extension developers
  17. /\ATclLib\//,
  18. /\ATkLib\//,
  19. /\AItclLib\//,
  20. /\ATdbcLib\//
  21. ]
  22. options[:attribution] = <<-HTML
  23. Licensed under <a href="http://tcl.tk/software/tcltk/license.html">Tcl/Tk terms</a>
  24. HTML
  25. def get_latest_version(options, &block)
  26. fetch_doc('https://www.tcl.tk/man/tcl/contents.htm', options) do |doc|
  27. label = doc.at_css('h2').content
  28. block.call label.scan(/Tk([0-9.]+)/)[0][0]
  29. end
  30. end
  31. end
  32. end