tcl_tk.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. module Docs
  2. class TclTk < UrlScraper
  3. self.name = 'Tcl/Tk'
  4. self.type = 'tcl_tk'
  5. self.slug = 'tcl_tk'
  6. self.links = {
  7. home: 'https://www.tcl-lang.org/',
  8. code: 'https://sourceforge.net/projects/tcl/files/Tcl/'
  9. }
  10. html_filters.push 'tcl_tk/entries', 'tcl_tk/clean_html', 'title'
  11. options[:root_title] = 'Tcl/Tk Documentation'
  12. options[:trailing_slash] = false
  13. options[:skip] = %w(siteinfo.htm)
  14. options[:skip_patterns] = [
  15. # ignore keyword list pages
  16. /\AKeywords\//,
  17. # ignore C-API, only required for extension developers
  18. /\ATclLib\//,
  19. /\ATkLib\//,
  20. /\AItclLib\//,
  21. /\ATdbcLib\//
  22. ]
  23. options[:attribution] = <<-HTML
  24. Licensed under <a href="http://www.tcl-lang.org/software/tcltk/license.html">Tcl/Tk terms</a>
  25. HTML
  26. version '9.0' do
  27. self.base_url = "https://www.tcl-lang.org/man/tcl#{self.version}/"
  28. self.release = '9.0.2'
  29. end
  30. version '8.6' do
  31. self.base_url = "https://www.tcl-lang.org/man/tcl#{self.version}/"
  32. self.root_path = 'contents.htm'
  33. self.release = '8.6.16'
  34. end
  35. def get_latest_version(opts)
  36. doc = fetch_doc('https://www.tcl-lang.org/man/tcl/', opts)
  37. doc.at_css('h2').content.scan(/Tk([0-9.]+)/)[0][0]
  38. end
  39. end
  40. end