qt.rb 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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] = '.b-sidebar__content'
  13. options[:max_image_size] = 256_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. "qdoc-index.html",
  51. "qmake-manual.html",
  52. "classes.html",
  53. "qtmodules.html",
  54. "modules-qml.html",
  55. "modules-cpp.html",
  56. "functions.html",
  57. "namespaces.html",
  58. "qmltypes.html",
  59. "qt3d-qml.html",
  60. "qmlbasictypes.html",
  61. "guibooks.html",
  62. "annotated.html",
  63. "overviews-main.html",
  64. "reference-overview.html",
  65. # Tutorials
  66. "qtvirtualkeyboard-build.html",
  67. # Copyright
  68. "trademarks.html",
  69. "lgpl.html",
  70. "bughowto.html",
  71. # Changelogs
  72. "changes.html",
  73. "qtlocation-changes.html",
  74. "sourcebreaks.html",
  75. # Best practice guides
  76. "accessible.html",
  77. "accessible-qtquick.html",
  78. "sharedlibrary.html",
  79. "exceptionsafety.html",
  80. "scalability.html",
  81. "session.html",
  82. "appicon.html",
  83. "accelerators.html",
  84. # Other
  85. "ecmascript.html",
  86. "qtremoteobjects-interaction.html",
  87. ]
  88. options[:attribution] = <<-HTML
  89. &copy; The Qt Company Ltd<br>
  90. Licensed under the GNU Free Documentation License, Version 1.3.
  91. HTML
  92. version '6.9' do
  93. self.release = '6.9'
  94. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  95. end
  96. version '6.8' do
  97. self.release = '6.8'
  98. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  99. end
  100. version '6.2' do
  101. self.release = '6.2'
  102. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  103. end
  104. version '6.1' do
  105. self.release = '6.1'
  106. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  107. end
  108. version '6.0' do
  109. self.release = '6.0'
  110. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  111. end
  112. version '5.15' do
  113. self.release = '5.15'
  114. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  115. end
  116. version '5.14' do
  117. self.release = '5.14'
  118. self.base_url = "https://doc.qt.io/qt-#{self.release}/"
  119. end
  120. version '5.13' do
  121. self.release = '5.13'
  122. self.base_url = "https://doc.qt.io/archives/qt-#{self.release}/"
  123. end
  124. version '5.12' do
  125. self.release = '5.12'
  126. self.base_url = "https://doc.qt.io/archives/qt-#{self.release}/"
  127. end
  128. version '5.11' do
  129. self.release = '5.11'
  130. self.base_url = "https://doc.qt.io/archives/qt-#{self.release}/"
  131. end
  132. version '5.9' do
  133. self.release = '5.9'
  134. self.base_url = "https://doc.qt.io/archives/qt-#{self.release}/"
  135. end
  136. version '5.6' do
  137. self.release = '5.6'
  138. self.base_url = "https://doc.qt.io/archives/qt-#{self.release}/"
  139. end
  140. def get_latest_version(opts)
  141. doc = fetch_doc('https://doc.qt.io/qt-6/index.html', opts)
  142. doc.at_css('.mainContent h1.title').content.sub(/Qt /, '')
  143. end
  144. end
  145. end