diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..2b819da42 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,4 @@ +# Omakase Ruby styling for Rails +inherit_gem: + rubocop-rails-omakase: rubocop.yml +# Your own specialized rules go here diff --git a/Gemfile b/Gemfile index 701424dd0..930dc036b 100755 --- a/Gemfile +++ b/Gemfile @@ -2,14 +2,21 @@ source 'https://rubygems.org' -gem 'github-linguist', '~> 7.24' +gem 'rubocop', require: false +gem 'rubocop-rails-omakase', require: false, group: [ :development ] -gem 'jekyll', '~> 4.3.0' -gem 'kramdown-parser-gfm', '~> 1.1' +gem 'github-linguist' + +gem 'jekyll' +gem 'kramdown-parser-gfm' group :jekyll_plugins do gem 'jekyll-redirect-from' gem 'jekyll-relative-links' + gem 'jekyll-sitemap' + gem 'jekyll-seo-tag' + # gem 'jekyll-asset-path', git: 'https://github.com/OpenINF/openinf-jekyll-asset-path-plugin' + # gem 'jekyll-assets', git: 'https://github.com/envygeeks/jekyll-assets' # gem 'jekyll-paginate-v2' # gem 'jekyll-auto-authors' end @@ -23,7 +30,7 @@ gem 'dotenv' gem 'rb-inotify' -# Preparing for Ruby 3.4.0; these deps will no longer be present. +# Dig out bundled core deps as we prep to begin Ruby 3.4.0 support. gem 'csv' gem 'base64' gem 'bigdecimal' diff --git a/Gemfile.lock b/Gemfile.lock index 1e01de931..7b7a1bae8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,29 @@ GEM remote: https://rubygems.org/ specs: + activesupport (7.1.3.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) + ast (2.4.2) base64 (0.2.0) bigdecimal (3.1.7) cgi (0.4.1) charlock_holmes (0.7.7) colorator (1.1.0) concurrent-ruby (1.2.3) + connection_pool (2.4.1) csv (3.3.0) dotenv (3.1.0) + drb (2.2.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) @@ -59,18 +72,30 @@ GEM jekyll (>= 3.3, < 5.0) jekyll-sass-converter (3.0.0) sass-embedded (~> 1.54) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) + json (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) + language_server-protocol (3.17.0.3) liquid (4.0.4) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) mini_mime (1.1.5) + minitest (5.22.3) + mutex_m (0.2.0) + parallel (1.24.0) + parser (3.3.0.5) + ast (~> 2.4.1) + racc pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (5.0.5) @@ -78,11 +103,45 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + regexp_parser (2.9.0) rexml (3.2.6) rouge (4.2.1) + rubocop (1.62.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) + rubocop-minitest (0.35.0) + rubocop (>= 1.61, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.24.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails-omakase (1.0.0) + rubocop + rubocop-minitest + rubocop-performance + rubocop-rails + ruby-progressbar (1.13.0) rugged (1.7.2) safe_yaml (1.0.5) - sass-embedded (1.74.1-aarch64-linux-android) + sass-embedded (1.72.0) + google-protobuf (>= 3.25, < 5.0) + rake (>= 13.0.0) + sass-embedded (1.72.0-aarch64-linux-android) google-protobuf (>= 3.25, < 5.0) sass-embedded (1.74.1-aarch64-linux-gnu) google-protobuf (>= 3.25, < 5.0) @@ -112,6 +171,8 @@ GEM google-protobuf (>= 3.25, < 5.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) webrick (1.8.1) yaml-lint (0.1.2) @@ -125,11 +186,13 @@ PLATFORMS arm-linux-gnueabihf arm-linux-musleabihf arm64-darwin + ruby x86-linux x86-linux-android x86-linux-gnu x86-linux-musl x86_64-darwin + x86_64-linux x86_64-linux-android x86_64-linux-gnu x86_64-linux-musl @@ -139,12 +202,16 @@ DEPENDENCIES bigdecimal csv dotenv - github-linguist (~> 7.24) - jekyll (~> 4.3.0) + github-linguist + jekyll jekyll-redirect-from jekyll-relative-links - kramdown-parser-gfm (~> 1.1) + jekyll-seo-tag + jekyll-sitemap + kramdown-parser-gfm rb-inotify + rubocop + rubocop-rails-omakase webrick yaml-lint diff --git a/_config.yml b/_config.yml index 306e21346..39082798b 100755 --- a/_config.yml +++ b/_config.yml @@ -1,72 +1,110 @@ -# Welcome to Jekyll! - -# This master configuration file contains global configurations and variable -# definitions that are meant for settings that affect the whole microsite with -# values that are expected to be set up once and that rarely need to be edited -# after that, which is why they are only read once at execution time. -# -# For technical reasons, changes made to this file are *NOT* reloaded -# automatically during automatic regeneration when using 'jekyll serve'. If -# you change this file, please restart the server process as changes are not -# loaded until the next execution. -# -# Note: Data Files _are_ included and reloaded during automatic regeneration. -# -# Site personalization settings accessed in templates via {{ site.myvariable }}. +--- title: OpenINF -email: code@open.inf.is -description: >- - Aggregate, curate, disseminate, and apply information derived from diverse - sources. +email: code@inf.is +description: Aggregate, curate, disseminate, and apply information derived from + diverse sources. baseurl: '' -url: 'https://open.inf.is' +url: https://open.inf.is twitter_username: OpenINF github_username: OpenINF repository: OpenINF/openinf.github.io -# Site build settings. +# Site build settings markdown: kramdown plugins: - jekyll-redirect-from - jekyll-relative-links + - jekyll-sitemap + - jekyll-seo-tag + # - jekyll-asset-path + # - jekyll-assets +compress_html: + clippings: all + comments: + - '' + endings: all + ignore: + envs: + - local + blanklines: false + profile: false + startings: + - html + - head + - body -# Document collections. +## Content collections +# @see https://jekyllrb.com/docs/collections collections_dir: collections - collections: authors: output: true docs: - permalink: '/:collection/:path/' + permalink: :collection/:path output: true posts: - permalink: '/news/:year/:month/:day/:title/' + permalink: news/:year/:month/:day/:title output: true defaults: + - scope: + path: '' + type: pages + values: + ## + # @see https://github.com/OpenINF/openinf.github.io/blob/HEAD/_layouts/compress.html + layout: compress + locale: en + - scope: + path: _layouts + type: pages + values: + ## + # @see https://github.com/OpenINF/openinf.github.io/blob/HEAD/_layouts/default.html + layout: default - scope: path: _docs type: docs values: + ## + # @see https://github.com/OpenINF/openinf.github.io/blob/HEAD/_layouts/docs.html layout: docs + editable: true + toc: true + breadcrumbs: true + body_classes: + - hide-butterbar - scope: path: _posts type: posts values: + ## + # @see https://github.com/OpenINF/openinf.github.io/blob/HEAD/_layouts/news_item.html layout: news_item + editable: true + toc: true + breadcrumbs: true + body_classes: + - hide-butterbar +sass: + sass_dir: _sass + style: compressed + load_paths: + - _includes/assets/scss -# Exclude from processing. +# Exclude from processing exclude: + - AUTHORS - build/ + - CNAME - Gemfile - Gemfile.lock + - LICENSE - node_modules/ - package.json - pnpm-lock.json - project-terms.txt - - AUTHORS - - CNAME - - LICENSE - README.md - - tools/ - tmp/ + - tools/ - vendor/ diff --git a/_includes/head.html b/_includes/head.html index 5b008dd56..098922880 100755 --- a/_includes/head.html +++ b/_includes/head.html @@ -12,7 +12,7 @@ crossorigin="anonymous" /> + content="{{ site.description }}" /> - - - {% if page.class != 'home' %}{{ page.title }} · {% endif %}{{ - site.title }} - + {% if page.custom_css %}{% for stylesheet_hotlink in page.custom_css -%} + + {%- endfor %}{% endif %} + + {% if post.status == 'unpublished' or page.status == 'unpublished' %} + + {% endif %} + {% if page.permalink == '/' %}{{ site.title }}{% else %}{{ page.title }} · {{ site.title }}{% endif %} + + {% if page.permalink == '/' %} + + {% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 02aa6774b..f62fe822f 100755 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,12 +1,14 @@ --- -editable: false +layout: compress --- - - - {%- include head.html -%} + + +{%- include head.html -%} - - {%- include header.html -%} {{- content -}} {%- include footer.html -%} - +{%- assign classes = page.body_classes | join: " " | where: 'page.body_classes', empty -%} + + + {%- include header.html -%} {{- content -}} {%- include footer.html -%} + diff --git a/_layouts/docs.html b/_layouts/docs.html index b771a6bfb..d5d9baee8 100755 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -1,10 +1,9 @@ --- -layout: default -editable: true -class: docs +body_classes: + - docs --- -
+
diff --git a/_layouts/page.html b/_layouts/page.html old mode 100644 new mode 100755 diff --git a/_plugins/markdownblock.rb b/_plugins/markdownblock.rb new file mode 100755 index 000000000..e6ec35a57 --- /dev/null +++ b/_plugins/markdownblock.rb @@ -0,0 +1,16 @@ +module Jekyll # :nodoc: all + class MarkdownBlock < Liquid::Block + def initialize(tag_name, text, tokens) + super + require "kramdown" + end + + def render(context) + content = super + + String.new(Kramdown::Document.new(content).to_html).to_s.chomp + end + end +end + +Liquid::Template.register_tag("markdown", Jekyll::MarkdownBlock) diff --git a/_plugins/modulo.filter.rb b/_plugins/modulo.filter.rb new file mode 100755 index 000000000..51fa0b550 --- /dev/null +++ b/_plugins/modulo.filter.rb @@ -0,0 +1,18 @@ +# Modulo filter for Jekyll +# +# Adds modulo functionality to Jekyll. It's already in the Liquid core, but that +# version doesn't appear to be in Jekyll. +# +# That's about it. + +module Jekyll # :nodoc: all + module ModuloFilter + # Returns the modulo of the input based on the supplied modulus + # Called 'mod' to avoid conflict with newer Liquid's 'modulo' filter + def mod(input, modulus) + input.to_i % modulus.to_i + end + end +end + +Liquid::Template.register_filter(Jekyll::ModuloFilter) diff --git a/_sass/main.scss b/_sass/main.scss new file mode 100644 index 000000000..de36db9d2 --- /dev/null +++ b/_sass/main.scss @@ -0,0 +1 @@ +$base-color: #a7978b; diff --git a/assets/scss/collections.scss b/assets/scss/collections.scss new file mode 100644 index 000000000..a0df9b994 --- /dev/null +++ b/assets/scss/collections.scss @@ -0,0 +1,26 @@ +--- +--- +@import "main"; + +body { + max-width: 700px; + margin: 1rem auto 0; + padding: 1rem; + + > * + * { + margin-top: 4rem; + } +} + +h2 { + display: flex; + align-items: center; + font-size: 1.5rem; +} + +h2:after { + content: ""; + flex: 1; + border: 1px solid rgba($base-color, 0.88); + margin-inline-start: 0.5rem; +} diff --git a/bin/bundle b/bin/bundle new file mode 100644 index 000000000..50da5fdf9 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,109 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN) + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../Gemfile", __dir__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_requirement + @bundler_requirement ||= + env_var_version || + cli_arg_version || + bundler_requirement_for(lockfile_version) + end + + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version + + bundler_gem_version = Gem::Version.new(version) + + bundler_gem_version.approximate_recommendation + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/rubocop b/bin/rubocop new file mode 100644 index 000000000..369a05bed --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +bundle_binstub = File.expand_path("bundle", __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/collections/index.html b/collections/index.html index a374d37e2..46fa7ac39 100644 --- a/collections/index.html +++ b/collections/index.html @@ -5,33 +5,10 @@ - hide-butterbar layout: default permalink: /collections/ +custom_css: + - collections --- - -

All Collections

Collections are curated stories showcasing the best of our builders, experiments, tools, and resources.

diff --git a/index.html b/index.html index e6e4fbad6..a7e075c1c 100755 --- a/index.html +++ b/index.html @@ -1,7 +1,9 @@ --- -class: home +title: Welcome layout: default permalink: / +body_classes: + - error ---