tcl_tk.rb 974 B

12345678910111213141516171819202122232425262728293031323334
  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(opts)
  26. doc = fetch_doc('https://www.tcl.tk/man/tcl/contents.htm', opts)
  27. doc.at_css('h2').content.scan(/Tk([0-9.]+)/)[0][0]
  28. end
  29. end
  30. end