1
0

gtk.rb 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. module Docs
  2. class Gtk < UrlScraper
  3. self.name = 'GTK'
  4. self.slug = 'gtk'
  5. self.type = 'gtk'
  6. self.root_path = 'index.html'
  7. self.links = {
  8. home: 'https://www.gtk.org/',
  9. code: 'https://gitlab.gnome.org/GNOME/gtk/'
  10. }
  11. html_filters.push 'gtk/entries', 'gtk/clean_html', 'title'
  12. options[:container] = '.content'
  13. # These are all "index"-ish pages with no valuable content
  14. GTK3_SKIP = %w(
  15. gtk.html
  16. gtk-resources.html gtk-question-index.html
  17. gtkobjects.html
  18. Application.html Builder.html WindowWidgets.html LayoutContainers.html
  19. DisplayWidgets.html ButtonWidgets.html NumericEntry.html
  20. TextWidgetObjects.html TreeWidgetObjects.html MenusAndCombos.html
  21. SelectorWidgets.html Ornaments.html ScrollingWidgets.html Printing.html
  22. ShortcutsOverview.html MiscObjects.html AbstractObjects.html
  23. PlugSocket.html RecentDocuments.html ApplicationChoosing.html
  24. Gestures.html DeprecatedObjects.html
  25. gtkbase.html
  26. theming.html
  27. migrating.html
  28. ch26s02.html ch28s02.html
  29. pt06.html
  30. platform-support.html
  31. glossary.html
  32. annotation-glossary.html
  33. )
  34. GTK3_SKIP_PATTERNS = [
  35. /migrating/, /checklist/, /ch30/, /ch32/, /api-index-/
  36. ]
  37. # These are all "index"-ish pages with no valuable content
  38. GTK4_SKIP = %w(
  39. gtk.html
  40. gtk-resources.html gtk-question-index.html ch02s02.html
  41. concepts.html
  42. gtkobjects.html
  43. Lists.html Trees.html Application.html Builder.html WindowWidgets.html
  44. LayoutContainers.html LayoutManagers.html DisplayWidgets.html
  45. MediaSupport.html ButtonWidgets.html NumericEntry.html
  46. MenusAndCombos.html SelectorWidgets.html DrawingWidgets.html
  47. Ornaments.html ScrollingWidgets.html Printing.html
  48. ShortcutsOverview.html MiscObjects.html AbstractObjects.html
  49. RecentDocuments.html ApplicationChoosing.html Gestures.html ch36.html
  50. ch37.html
  51. gtkbase.html
  52. theming.html
  53. migrating.html
  54. ch41s02.html ch41s03.html
  55. pt07.html
  56. platform-support.html
  57. api-index-full.html
  58. annotation-glossary.html
  59. )
  60. GTK4_SKIP_PATTERNS = [
  61. /migrating/, /ch03/, /ch09/, /ch10/
  62. ]
  63. options[:attribution] = <<-HTML
  64. &copy; 2005&ndash;2020 The GNOME Project<br>
  65. Licensed under the GNU Lesser General Public License version 2.1 or later.
  66. HTML
  67. version '4.0' do
  68. self.release = '4.0.0'
  69. self.base_url = "https://developer-old.gnome.org/gtk4/#{self.version}/"
  70. options[:root_title] = 'GTK 4 Reference Manual'
  71. options[:skip] = GTK4_SKIP
  72. options[:skip_patterns] = GTK4_SKIP_PATTERNS
  73. end
  74. version '3.24' do
  75. self.release = '3.24.24'
  76. self.base_url = "https://developer.gnome.org/gtk3/#{self.version}/"
  77. options[:root_title] = 'GTK+ 3 Reference Manual'
  78. options[:skip] = GTK3_SKIP
  79. options[:skip_patterns] = GTK3_SKIP_PATTERNS
  80. end
  81. version '3.22' do
  82. self.release = '3.22.3'
  83. self.base_url = "https://developer.gnome.org/gtk3/#{self.version}/"
  84. options[:root_title] = 'GTK+ 3 Reference Manual'
  85. options[:skip] = GTK3_SKIP
  86. options[:skip_patterns] = GTK3_SKIP_PATTERNS
  87. end
  88. version '3.20' do
  89. self.release = '3.20.4'
  90. self.base_url = "https://developer.gnome.org/gtk3/#{self.version}/"
  91. options[:root_title] = 'GTK+ 3 Reference Manual'
  92. options[:skip] = GTK3_SKIP
  93. options[:skip_patterns] = GTK3_SKIP_PATTERNS
  94. end
  95. def get_latest_version(opts)
  96. tags = get_gitlab_tags('gitlab.gnome.org', 'GNOME', 'gtk', opts)
  97. tags[0]['name']
  98. end
  99. end
  100. end