Skip to content

Commit

Permalink
Update Middleman
Browse files Browse the repository at this point in the history
  • Loading branch information
amorde committed Nov 20, 2023
1 parent 0c1c148 commit a3a9310
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 65 deletions.
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }

ruby '3.1.1'

gem 'middleman', '~> 4.0'
gem 'middleman', '~> 4.4'

gem 'middleman-gh-pages', git: 'https://github.com/orta/middleman-gh-pages.git'
gem 'middleman-gh-pages', git: 'https://github.com/CocoaPods/middleman-gh-pages.git'
gem 'middleman-livereload'
gem 'middleman-sprockets'
gem 'middleman-syntax'
Expand All @@ -20,7 +20,6 @@ gem 'yard'

gem 'tilt'

gem 'activesupport', '~> 5.0'
gem 'github-markup'
gem 'nokogiri'
gem 'pygments.rb'
Expand All @@ -34,7 +33,7 @@ gem 'mini_racer'
gem 'webrick'

# https://github.com/middleman/middleman-syntax/issues/80
gem 'haml', '~> 5.0'
gem 'haml', '< 6.0'

gem 'cocoapods', '~> 1.0'

Expand Down
94 changes: 48 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GIT
remote: https://github.com/orta/middleman-gh-pages.git
revision: 87ce11bd60627aeaaea9af2c70a0a1f94be7b6b4
remote: https://github.com/CocoaPods/middleman-gh-pages.git
revision: 6fa2de7abe554f59f7472bb9c8997a50907ccc6f
specs:
middleman-gh-pages (0.0.3)
middleman-gh-pages (0.4.1)
rake (> 0.9.3)

GIT
Expand All @@ -17,11 +17,11 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (5.2.8.1)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
Expand All @@ -30,12 +30,12 @@ GEM
atomos (0.1.3)
backports (3.24.1)
claide (1.1.0)
cocoapods (1.14.0)
cocoapods (1.14.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.14.0)
cocoapods-core (= 1.14.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
Expand All @@ -48,7 +48,7 @@ GEM
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.0)
cocoapods-core (1.14.3)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -59,7 +59,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.0)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -73,7 +73,7 @@ GEM
coffee-script-source (1.12.2)
colored2 (3.1.2)
concurrent-ruby (1.2.2)
contracts (0.13.0)
contracts (0.16.1)
dotenv (2.8.1)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
Expand All @@ -100,47 +100,49 @@ GEM
hashie (3.6.0)
http_parser.rb (0.8.0)
httpclient (2.8.3)
i18n (0.9.5)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
json (2.6.3)
kramdown (2.4.0)
rexml
libv8-node (18.16.0.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
memoist (0.16.2)
middleman (4.3.11)
middleman (4.5.1)
coffee-script (~> 2.2)
haml (>= 4.0.5)
kramdown (>= 2.3.0)
middleman-cli (= 4.3.11)
middleman-core (= 4.3.11)
middleman-cli (4.3.11)
thor (>= 0.17.0, < 2.0)
middleman-core (4.3.11)
activesupport (>= 4.2, < 6.0)
addressable (~> 2.3)
middleman-cli (= 4.5.1)
middleman-core (= 4.5.1)
middleman-cli (4.5.1)
thor (>= 0.17.0, < 1.3.0)
middleman-core (4.5.1)
activesupport (>= 6.1, < 7.1)
addressable (~> 2.4)
backports (~> 3.6)
bundler
contracts (~> 0.13.0)
bundler (~> 2.0)
contracts (~> 0.13, < 0.17)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.9.0)
listen (~> 3.0.0)
i18n (~> 1.6.0)
listen (~> 3.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
padrino-helpers (~> 0.15.0)
parallel
rack (>= 1.4.5, < 3)
sassc (~> 2.0)
servolux
tilt (~> 2.0.9)
toml
uglifier (~> 3.0)
webrick
middleman-livereload (3.4.7)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
Expand All @@ -159,23 +161,23 @@ GEM
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nokogiri (1.15.4)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.4)
padrino-helpers (0.15.3)
i18n (>= 0.6.7, < 2)
padrino-support (= 0.15.3)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
padrino-support (0.15.3)
parallel (1.23.0)
parslet (2.0.0)
public_suffix (4.0.7)
pygments.rb (2.4.1)
racc (1.7.1)
racc (1.7.3)
rack (2.2.8)
rack-livereload (0.3.17)
rack
rake (13.0.6)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand All @@ -197,13 +199,14 @@ GEM
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
temple (0.8.2)
thor (1.3.0)
thread_safe (0.3.6)
thor (1.2.2)
tilt (2.0.11)
typhoeus (1.4.0)
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (1.2.11)
thread_safe (~> 0.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
webrick (1.8.1)
Expand All @@ -220,13 +223,12 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (~> 5.0)
cocoapods (~> 1.0)
concurrent-ruby
foreman
github-markup
haml (~> 5.0)
middleman (~> 4.0)
haml (< 6.0)
middleman (~> 4.4)
middleman-gh-pages!
middleman-livereload
middleman-sprockets
Expand Down
9 changes: 6 additions & 3 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Tools for generating data
require "lib/navigation_helpers.rb"
require "lib/html_helpers.rb"
require 'lib/doc/code_objects'
require 'lib/doc'

set :encoding, 'utf-8'
set :relative_links, true
Expand All @@ -22,6 +22,8 @@
set :markdown, :tables => true, :autolink => true, :gh_blockcode => true, :fenced_code_blocks => true, :with_toc_data => true
set :markdown_engine, :redcarpet

set :sass_assets_paths, ['source/shared/sass']

activate :automatic_image_sizes
activate :syntax
activate :sprockets
Expand All @@ -38,6 +40,9 @@


helpers do
def asset_data_uri(*args)
asset_url(*args)
end

def shared_partial(*sources)
sources.inject([]) do |combined, source|
Expand Down Expand Up @@ -80,5 +85,3 @@ def shared_partial(*sources)
:locals => { :name => 'commands', :guides_page_title => "Command-line Reference", :fullwidth => true },
:ignore => true,
}

data.store(:site, ["guides"])
2 changes: 1 addition & 1 deletion lib/doc.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOC_ROOT = Pathname.new(File.expand_path('../', __FILE__))
DOC_ROOT = Pathname.new(__dir__)
$:.unshift((DOC_ROOT).to_s)

require 'doc/code_objects'
Expand Down
9 changes: 9 additions & 0 deletions lib/html_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

require 'redcarpet'

class RubyHTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
Pygments.highlight(code, lexer: "ruby")
end
end

module HTMLHelpers

# Converts a markdown string to HTML.
Expand Down
3 changes: 1 addition & 2 deletions lib/navigation_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'active_support'

module NavigationHelpers

# The title of the current page. If not specified with YAML
# Frontmatter it is inferred from the file name.
#
Expand Down Expand Up @@ -32,7 +31,7 @@ def page_browser_title
#
def deserialize(name)
@cached_doc_datas ||= {}
@cached_doc_datas[name] ||= YAML::load(File.open("docs_data/#{parameterize name}.yaml"))
@cached_doc_datas[name] ||= YAML.unsafe_load(File.open("docs_data/#{parameterize name}.yaml"))
end

#-----------------------------------------------------------------------------#
Expand Down
10 changes: 1 addition & 9 deletions source/layouts/quality_indexes.slim
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
ruby:
# Make the code renderer ruby by default
class HTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
Pygments.highlight(code, lexer: "ruby")
end
end


quality = File.read "external/cocoadocs-api/quality_modifiers.rb"
markdown = quality.split("#### <---- Start of Markdown").last.split("#### End of Markdown --->").first
markdown = markdown.lines.map { |l| l[1...-1] }.join("\n")

# These procs are getting a bit unweildy for users to see now IMO
markdown = markdown.gsub("Proc.new { |spec, cd_stats, stats, cp_stats, owners|", "{ |...|")

renderer = Redcarpet::Markdown.new(HTMLwithPygments)
renderer = Redcarpet::Markdown.new(RubyHTMLwithPygments)
result = renderer.render(markdown)

= wrap_layout :layout do
Expand Down

0 comments on commit a3a9310

Please sign in to comment.