tcllib.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. module Docs
  2. class Tcllib < UrlScraper
  3. self.name = 'Tcllib'
  4. self.type = 'simple'
  5. self.slug = 'tcllib'
  6. self.release = '2.0'
  7. self.base_url = 'https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/'
  8. self.root_path = 'toc0.md'
  9. self.links = {
  10. home: 'https://core.tcl-lang.org/tcllib/doc/trunk/embedded/index.md',
  11. code: 'https://sourceforge.net/projects/tcllib/files/tcllib/'
  12. }
  13. html_filters.push 'tcllib/entries', 'tcllib/clean_html', 'title'
  14. # The docs have incorrect <base> elements, so we should just skip that
  15. html_filters.replace('apply_base_url', 'tcllib/nop')
  16. options[:root_title] = 'Tcllib Documentation'
  17. options[:container] = '.content'
  18. options[:skip] = [
  19. # Full of broken links, path improperly duplicates "tcllib" segment
  20. 'tcllib/toc.md',
  21. # The other ones aren't terribly useful
  22. 'toc.md', 'toc1.md', 'toc2.md',
  23. # Keyword index
  24. 'index.md'
  25. ]
  26. options[:attribution] = <<-HTML
  27. Licensed under the <a href="https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/devdoc/tcllib_license.md">BSD license</a>
  28. HTML
  29. def get_latest_version(opts)
  30. doc = fetch_doc('https://core.tcl-lang.org/tcllib/doc/trunk/embedded/index.md', opts)
  31. doc.at_css('strong').content.scan(/([0-9.]+)/)[0][0]
  32. end
  33. end
  34. end