qt.rb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. module Docs
  2. class Qt < UrlScraper
  3. self.name = 'Qt'
  4. self.type = 'qt'
  5. self.initial_paths = %w(classes.html qmltypes.html)
  6. self.root_path = 'index.html'
  7. self.links = {
  8. home: 'https://www.qt.io',
  9. code: 'https://code.qt.io/cgit/'
  10. }
  11. html_filters.push 'qt/entries', 'qt/clean_html'
  12. options[:container] = '.main'
  13. options[:max_image_size] = 156_000
  14. options[:skip_patterns] = [
  15. # License, copyright attributions
  16. /3rdparty/,
  17. /attribution/,
  18. /license/,
  19. /licensing/,
  20. # Examples, guides, tutorials
  21. /example/,
  22. /guide$/,
  23. /tutorial/,
  24. /porting/,
  25. /usecase/,
  26. /topic/,
  27. /^modelview/,
  28. /deploy(ing|ment)/,
  29. /building/,
  30. # Old versions, changelog
  31. /obsolete/,
  32. /compatibility/,
  33. /^whatsnew/,
  34. /^newclasses/,
  35. # Deprecated modules
  36. /(qtopengl|qgl)/,
  37. /qt?script/,
  38. # Indexes
  39. /members/,
  40. /module/,
  41. /overview/,
  42. /^qopenglfunctions/,
  43. # Tooling
  44. /^(qt)?(linguist|assistant|qdbusviewer)/,
  45. ]
  46. options[:skip] = [
  47. "qt5-intro.html",
  48. "compatmap.html",
  49. # Indexes
  50. "classes.html",
  51. "qtmodules.html",
  52. "modules-qml.html",
  53. "modules-cpp.html",
  54. "functions.html",
  55. "namespaces.html",
  56. "qmltypes.html",
  57. "qt3d-qml.html",
  58. "qmlbasictypes.html",
  59. "guibooks.html",
  60. "annotated.html",
  61. "overviews-main.html",
  62. "reference-overview.html",
  63. # Tutorials
  64. "qtvirtualkeyboard-build.html",
  65. # Copyright
  66. "trademarks.html",
  67. "lgpl.html",
  68. "bughowto.html",
  69. # Changelogs
  70. "changes.html",
  71. "qtlocation-changes.html",
  72. "sourcebreaks.html",
  73. # Best practice guides
  74. "accessible.html",
  75. "accessible-qtquick.html",
  76. "sharedlibrary.html",
  77. "exceptionsafety.html",
  78. "scalability.html",
  79. "session.html",
  80. "appicon.html",
  81. "accelerators.html",
  82. # Other
  83. "ecmascript.html",
  84. "qtremoteobjects-interaction.html",
  85. ]
  86. options[:attribution] = <<-HTML
  87. &copy; The Qt Company Ltd<br>
  88. Licensed under the GNU Free Documentation License, Version 1.3.
  89. HTML
  90. version '5.13' do
  91. self.release = '5.13'
  92. self.base_url = 'https://doc.qt.io/qt-5.13/'
  93. end
  94. version '5.12' do
  95. self.release = '5.12'
  96. self.base_url = 'https://doc.qt.io/qt-5.12/'
  97. end
  98. version '5.11' do
  99. self.release = '5.11'
  100. self.base_url = 'https://doc.qt.io/archives/qt-5.11/'
  101. end
  102. version '5.9' do
  103. self.release = '5.9'
  104. self.base_url = 'https://doc.qt.io/qt-5.9/'
  105. end
  106. version '5.6' do
  107. self.release = '5.6'
  108. self.base_url = 'https://doc.qt.io/archives/qt-5.6/'
  109. end
  110. def get_latest_version(opts)
  111. doc = fetch_doc('https://doc.qt.io/qt-5/index.html', opts)
  112. doc.at_css('.mainContent h1.title').content.sub(/Qt /, '')
  113. end
  114. end
  115. end