datalog-theme 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +188 -0
  3. data/CITATION.cff +2 -2
  4. data/README.md +25 -17
  5. data/_data/cdn-integrity.yml +0 -30
  6. data/_data/i18n/en.yml +297 -0
  7. data/_data/i18n/es.yml +297 -0
  8. data/_data/i18n/pt.yml +297 -0
  9. data/_data/js_manifest.json +16 -0
  10. data/_includes/analytics/dashboard.html +3 -1
  11. data/_includes/components/api-function.html +20 -1
  12. data/_includes/components/author-bio.html +21 -11
  13. data/_includes/components/author-list.html +32 -0
  14. data/_includes/components/citation-tools.html +33 -25
  15. data/_includes/components/comments-thread.html +90 -0
  16. data/_includes/components/contact-form.html +120 -0
  17. data/_includes/components/correction-report.html +82 -0
  18. data/_includes/components/enhanced-code-block.html +1 -1
  19. data/_includes/components/enhanced-toc.html +6 -7
  20. data/_includes/components/license-link.html +13 -0
  21. data/_includes/components/license-notice.html +28 -0
  22. data/_includes/components/moderation-inbox.html +139 -0
  23. data/_includes/components/reactions.html +49 -0
  24. data/_includes/components/reading-list.html +31 -0
  25. data/_includes/components/reading-mode-toggle.html +65 -0
  26. data/_includes/components/reading-state-bookmark.html +27 -0
  27. data/_includes/components/reading-state-panel.html +71 -0
  28. data/_includes/components/reproducibility.html +61 -0
  29. data/_includes/components/responsive-image.html +3 -3
  30. data/_includes/components/revision-history.html +39 -0
  31. data/_includes/components/revision-notice.html +35 -0
  32. data/_includes/components/series-nav.html +64 -0
  33. data/_includes/components/subscribe-form.html +88 -0
  34. data/_includes/components/subscription-manage.html +68 -0
  35. data/_includes/components/webmentions.html +48 -0
  36. data/_includes/csp-meta.html +135 -11
  37. data/_includes/footer.html +22 -20
  38. data/_includes/head.html +111 -63
  39. data/_includes/header/navigation.html +12 -15
  40. data/_includes/header.html +28 -19
  41. data/_includes/layouts/default/article.html +9 -7
  42. data/_includes/meta/dynamic-services-config.html +14 -0
  43. data/_includes/meta/math-config.html +18 -10
  44. data/_includes/meta/person-json.html +27 -0
  45. data/_includes/meta/publisher.html +45 -0
  46. data/_includes/meta/schema.html +67 -30
  47. data/_includes/meta/scholarly.html +121 -0
  48. data/_includes/meta/scripts-loader.html +18 -32
  49. data/_includes/meta/webmention-discovery.html +14 -0
  50. data/_includes/post/related-posts.html +4 -7
  51. data/_includes/scripts.html +57 -0
  52. data/_includes/search/index-data.json +9 -34
  53. data/_layouts/dataset.html +5 -3
  54. data/_layouts/default.html +16 -8
  55. data/_layouts/notebook.html +1 -0
  56. data/_layouts/package.html +4 -2
  57. data/_layouts/page.html +15 -0
  58. data/_layouts/portfolio.html +1 -0
  59. data/_layouts/post.html +102 -23
  60. data/_layouts/project.html +4 -3
  61. data/_layouts/research.html +20 -8
  62. data/_plugins/analytics_dashboard.rb +9 -3
  63. data/_plugins/authors.rb +133 -0
  64. data/_plugins/config_validator.rb +231 -23
  65. data/_plugins/critical_css_check.rb +42 -0
  66. data/_plugins/csp_generator.rb +18 -28
  67. data/_plugins/datalog_bibliography.rb +9 -7
  68. data/_plugins/datalog_comments.rb +8 -5
  69. data/_plugins/datalog_slides.rb +9 -8
  70. data/_plugins/i18n.rb +13 -12
  71. data/_plugins/image_optimizer.rb +241 -178
  72. data/_plugins/licenses.rb +135 -0
  73. data/_plugins/math_preprocessor.rb +59 -7
  74. data/_plugins/notebook_converter.rb +23 -4
  75. data/_plugins/plugin_loader.rb +3 -1
  76. data/_plugins/publications_generator.rb +8 -2
  77. data/_plugins/references.rb +238 -0
  78. data/_plugins/reproducibility.rb +150 -0
  79. data/_plugins/revisions.rb +101 -0
  80. data/_plugins/rouge_highlight_filter.rb +42 -0
  81. data/_plugins/scholarly.rb +50 -0
  82. data/_plugins/search_code_blocks.rb +30 -0
  83. data/_plugins/search_normalizer.rb +15 -53
  84. data/_plugins/search_pages.rb +3 -4
  85. data/_plugins/series.rb +104 -0
  86. data/_plugins/statements.rb +87 -0
  87. data/_sass/_academic-dashboard.scss +262 -0
  88. data/_sass/_base.scss +20 -1
  89. data/_sass/_comments-thread.scss +159 -0
  90. data/_sass/_components.scss +64 -1153
  91. data/_sass/_features.scss +17 -0
  92. data/_sass/_layout.scss +385 -1
  93. data/_sass/_mathematical.scss +27 -0
  94. data/_sass/_moderation.scss +222 -0
  95. data/_sass/_notebooks.scss +322 -0
  96. data/_sass/_open-science-badges.scss +56 -0
  97. data/_sass/{_phase1-enhancements.scss → _post-components.scss} +5 -3
  98. data/_sass/_print.scss +291 -0
  99. data/_sass/_reactions.scss +89 -0
  100. data/_sass/_reading-state.scss +290 -0
  101. data/_sass/_search-page.scss +530 -0
  102. data/_sass/_search.scss +46 -0
  103. data/_sass/_service-forms.scss +204 -0
  104. data/_sass/_subscriptions.scss +140 -0
  105. data/_sass/_syntax-highlighting.scss +212 -97
  106. data/_sass/_theme.scss +40 -19
  107. data/_sass/_typography.scss +130 -0
  108. data/_sass/_utilities.scss +5 -0
  109. data/_sass/_variables.scss +6 -0
  110. data/_sass/_webmentions.scss +125 -0
  111. data/assets/css/main.scss +14 -0
  112. data/assets/js/dist/academic.js +1 -1
  113. data/assets/js/dist/analytics-dashboard.js +1 -1
  114. data/assets/js/dist/chunks/chunk-2DYDWUFX.js +1 -0
  115. data/assets/js/dist/chunks/chunk-PATLC23F.js +1 -0
  116. data/assets/js/dist/chunks/chunk-V7734B2G.js +1 -0
  117. data/assets/js/dist/comments.js +2 -0
  118. data/assets/js/dist/contact.js +1 -0
  119. data/assets/js/dist/core.js +1 -1
  120. data/assets/js/dist/corrections.js +1 -0
  121. data/assets/js/dist/loader.js +1 -1
  122. data/assets/js/dist/math.js +1 -1
  123. data/assets/js/dist/moderation.js +1 -0
  124. data/assets/js/dist/notebook.js +1 -1
  125. data/assets/js/dist/reactions.js +1 -0
  126. data/assets/js/dist/reading-state.js +1 -0
  127. data/assets/js/dist/search.js +1 -1
  128. data/assets/js/dist/sources.json +52 -0
  129. data/assets/js/dist/subscriptions.js +1 -0
  130. data/assets/js/dist/visualizations.js +11 -2
  131. data/assets/js/dist/webmentions.js +1 -0
  132. data/assets/js/loader.js +37 -1
  133. data/datalog-theme.gemspec +35 -23
  134. data/lib/datalog/cli.rb +43 -15
  135. data/lib/datalog/critical_css.rb +168 -0
  136. data/lib/datalog/plugin_system/dependency_resolver.rb +0 -2
  137. data/lib/datalog/plugins/comments.rb +33 -3
  138. data/lib/datalog/theme/installed_files.rb +113 -0
  139. data/lib/datalog/theme/package.rb +57 -0
  140. data/lib/datalog/theme/repository_checkout.rb +94 -0
  141. data/lib/datalog/theme/version.rb +5 -1
  142. data/lib/datalog/warning_filter.rb +5 -11
  143. data/lib/datalog-theme.rb +6 -0
  144. metadata +96 -147
  145. data/_data/academic.yml +0 -217
  146. data/_data/config/author.yml +0 -121
  147. data/_data/datasets.yml +0 -28
  148. data/_data/js_meta.json +0 -371
  149. data/_data/navigation.yml +0 -145
  150. data/_data/projects.yml +0 -41
  151. data/_data/publications.yml +0 -28
  152. data/_data/social.yml +0 -73
  153. data/_data/visualizations.yml +0 -51
  154. data/_includes/components/advanced-search.html +0 -682
  155. data/_includes/components/bookmark-system.html +0 -96
  156. data/_includes/components/comments.html +0 -244
  157. data/_includes/components/content-recommendations.html +0 -228
  158. data/_includes/components/email-preferences.html +0 -200
  159. data/_includes/components/enhanced-metadata.html +0 -228
  160. data/_includes/components/language-switcher.html +0 -396
  161. data/_includes/components/navigation-enhancements.html +0 -454
  162. data/_includes/components/newsletter-signup.html +0 -178
  163. data/_includes/components/popular-posts.html +0 -233
  164. data/_includes/components/reading-progress.html +0 -133
  165. data/_includes/components/reading-time.html +0 -121
  166. data/_includes/components/series-navigation.html +0 -124
  167. data/_includes/components/social-proof.html +0 -34
  168. data/_includes/components/user-preferences.html +0 -566
  169. data/_includes/meta/syntax-config.html +0 -19
  170. data/_layouts/archive.html +0 -282
  171. data/_layouts/post-sidebar.html +0 -183
  172. data/_sass/_phase3-enhancements.scss +0 -874
  173. data/_sass/_phase4-enhancements.scss +0 -1214
  174. data/_sass/_phase5-enhancements.scss +0 -414
  175. data/assets/js/academic.js +0 -262
  176. data/assets/js/analytics-dashboard.js +0 -382
  177. data/assets/js/core/dark-mode.js +0 -79
  178. data/assets/js/core/github-cards.js +0 -123
  179. data/assets/js/core/language-filter.js +0 -69
  180. data/assets/js/core/navigation.js +0 -184
  181. data/assets/js/core/scroll-progress.js +0 -45
  182. data/assets/js/core/search-hotkeys.js +0 -62
  183. data/assets/js/core/skip-links.js +0 -62
  184. data/assets/js/dist/manifest.json +0 -22
  185. data/assets/js/dist/meta.json +0 -371
  186. data/assets/js/main.js +0 -23
  187. data/assets/js/math.js +0 -818
  188. data/assets/js/notebook.js +0 -158
  189. data/assets/js/search/analytics.js +0 -91
  190. data/assets/js/search/app.js +0 -271
  191. data/assets/js/search/autocomplete.js +0 -120
  192. data/assets/js/search/engine.js +0 -260
  193. data/assets/js/search/filters.js +0 -45
  194. data/assets/js/search/render.js +0 -217
  195. data/assets/js/search/utils.js +0 -99
  196. data/assets/js/search.js +0 -354
  197. data/assets/js/visualizations.js +0 -816
  198. data/assets/publications/datalog-publications.bib +0 -8
  199. data/assets/publications/datalog-publications.ris +0 -9
  200. data/assets/publications/publications.bib +0 -30
  201. data/assets/templates/diogo-ribeiro-cv.md +0 -31
  202. data/assets/templates/diogo-ribeiro-cv.tex +0 -32
  203. data/lib/datalog/theme/theme.rb +0 -18
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require_relative "package"
5
+
6
+ module Datalog
7
+ module Theme
8
+ # A site that installs the theme from a Git checkout or a local path
9
+ # (`gem "datalog-theme", github: ...` or `path: ...`) gets the whole
10
+ # repository as its theme, and the repository is also the demo site. Jekyll
11
+ # merges the demo's _config.yml into the site's configuration, reads the
12
+ # demo's _data as theme data and copies the demo's downloads from assets/.
13
+ # The site then inherits the maintainer's name, contact addresses and social
14
+ # profiles, and jekyll-feed stops the build on a datasets feed for a
15
+ # collection the site does not have. The packaged gem contains none of those
16
+ # files; these hooks give a checkout the same contents.
17
+ module RepositoryCheckout
18
+ module_function
19
+
20
+ # The packaged gem ships no _config.yml, so one at the theme root means
21
+ # the theme is a copy of the repository.
22
+ def applies_to?(site)
23
+ theme = site.theme
24
+ !theme.nil? && theme.name == "datalog-theme" && File.file?(File.join(theme.root, "_config.yml"))
25
+ end
26
+
27
+ # Jekyll merges the theme configuration before any theme code runs, so it
28
+ # cannot be taken back out here: Jekyll's own `ignore_theme_config` switch
29
+ # is the only way to keep it out. A site that sets the switch to false has
30
+ # chosen to inherit the demo configuration.
31
+ def check_configuration(site)
32
+ return unless applies_to?(site)
33
+ return if site.config.key?("ignore_theme_config")
34
+
35
+ raise Jekyll::Errors::FatalException, <<~MESSAGE
36
+ datalog-theme is installed from a copy of its repository (#{site.theme.root}),
37
+ which is also the theme's demo site. Jekyll merges the demo's _config.yml into
38
+ your configuration, so your site would carry the demo's author, contact
39
+ addresses, social profiles and feeds.
40
+
41
+ Add this line to your _config.yml:
42
+
43
+ ignore_theme_config: true
44
+
45
+ The theme then also leaves out the demo's _data files and downloads. Set it to
46
+ false instead only if you mean to inherit the demo configuration.
47
+ MESSAGE
48
+ end
49
+
50
+ def remove_demo_content(site)
51
+ return unless applies_to?(site) && site.config["ignore_theme_config"] == true
52
+
53
+ remove_demo_assets(site)
54
+ remove_demo_data(site)
55
+ end
56
+
57
+ # A checkout also holds the script sources the bundles are built from,
58
+ # which no page loads. The site gets the theme assets the gem would give it.
59
+ def remove_demo_assets(site)
60
+ root = File.join(site.theme.root, "")
61
+ site.static_files.reject! do |file|
62
+ file.path.start_with?(root) && !Package.theme_file?(file.path.delete_prefix(root))
63
+ end
64
+ end
65
+
66
+ # site.data holds the theme's data with the site's merged over it. Each key
67
+ # the demo contributed goes back to the site's own value, or away.
68
+ def remove_demo_data(site)
69
+ theme_data_dir = File.join(site.theme.root, "_data")
70
+ return unless File.directory?(theme_data_dir)
71
+
72
+ demo_keys = Dir.children(theme_data_dir).map { |name| File.basename(name, ".*") } - Package.data_keys
73
+ return if demo_keys.empty?
74
+
75
+ own = Jekyll::DataReader.new(site).read(site.config["data_dir"])
76
+ demo_keys.each do |key|
77
+ if own.key?(key)
78
+ site.data[key] = own[key]
79
+ else
80
+ site.data.delete(key)
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ Jekyll::Hooks.register :site, :after_init do |site|
89
+ Datalog::Theme::RepositoryCheckout.check_configuration(site)
90
+ end
91
+
92
+ Jekyll::Hooks.register :site, :post_read do |site|
93
+ Datalog::Theme::RepositoryCheckout.remove_demo_content(site)
94
+ end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Datalog
4
4
  module Theme
5
- VERSION = "0.7.0" unless const_defined?(:VERSION)
5
+ VERSION = "0.9.0" unless const_defined?(:VERSION)
6
+ # The Ruby the gem installs on, for the gemspec and `datalog check`. The
7
+ # release workflow rewrites every quoted version assigned to a name ending
8
+ # in VERSION in this file, so this name must not end that way.
9
+ RUBY_REQUIREMENT = ">= 3.2" unless const_defined?(:RUBY_REQUIREMENT)
6
10
  end
7
11
  end
@@ -1,13 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Datalog
4
+ # Silences two warnings that every build repeats. Kernel#warn reports through
5
+ # Warning.warn, so prepending here covers both. A Kernel#warn override used to
6
+ # sit alongside it, and it printed keyword arguments such as `uplevel:` and
7
+ # `category:` as a hash after the message instead of honouring them.
4
8
  module WarningFilter
5
9
  FILTERS = [
6
10
  /literal string will be frozen/,
7
11
  /already initialized constant Datalog::Theme::VERSION/
8
12
  ].freeze
9
13
 
10
- def warn(message)
14
+ def warn(message, **options)
11
15
  return if FILTERS.any? { |pattern| pattern.match?(message) }
12
16
 
13
17
  super
@@ -16,13 +20,3 @@ module Datalog
16
20
  end
17
21
 
18
22
  Warning.singleton_class.prepend(Datalog::WarningFilter) if defined?(Warning)
19
-
20
- module Kernel
21
- alias __datalog_warn warn
22
-
23
- def warn(message = nil, *args)
24
- return if message && Datalog::WarningFilter::FILTERS.any? { |pattern| pattern.match?(message) }
25
-
26
- __datalog_warn(message, *args)
27
- end
28
- end
data/lib/datalog-theme.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "datalog/theme/version"
4
+ # The layouts render their page-independent includes with {% include_cached %},
5
+ # which comes from jekyll-include-cache rather than Jekyll itself.
6
+ require "jekyll-include-cache"
4
7
 
5
8
  module Datalog
6
9
  module Theme
@@ -31,3 +34,6 @@ module Datalog
31
34
  end
32
35
 
33
36
  Datalog::Theme.load_plugins
37
+
38
+ require_relative "datalog/theme/repository_checkout"
39
+ require_relative "datalog/theme/installed_files"