Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest

strategy:
matrix: { ruby: ['3.1', '3.2', '3.3'] }
matrix: { ruby: ['3.2', '3.3', '3.4', '4.0'] }

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install OS dependencies
run: sudo apt-get -y install libyaml-dev
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.gem
/.yardoc
/coverage
/debug.rb
/debug.runfile
/dev
/doc
/Gemfile.lock
Expand Down
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require:
plugins:
- rubocop-performance
- rubocop-rspec

Expand All @@ -9,8 +9,8 @@ inherit_gem:

AllCops:
TargetRubyVersion: 3.1
SuggestExtensions: false
Exclude:
- debug.rb
- dev/**/*

RSpec/AnyInstance:
Expand Down
9 changes: 2 additions & 7 deletions Runfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require "debug"
require "lp"
require 'lp'
require 'madman/version'

title "Madman Developer Toolbelt"
summary "Runfile tasks for building the Madman gem"
version Madman::VERSION

import_gem 'runfile-tasks/gem', gemname: 'madman'
import 'debug'

help "Inject usage to README"
action :usage do
Expand All @@ -19,11 +19,6 @@ action :usage do
doc.save
end

help "Count lines of code"
action :cloc do
system "cloc . --exclude-dir coverage,spec,templates,tmp,dev --exclude-ext yml"
end

helpers do
def usage_commands
{
Expand Down
2 changes: 1 addition & 1 deletion lib/madman/refinements/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def to_markdown
end

def to_html
Commonmarker.to_html to_markdown, options: { extension: { table: true } }
Renderers::Default.render to_markdown
end
end
end
2 changes: 1 addition & 1 deletion lib/madman/refinements/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def slug
end

def to_html
Commonmarker.to_html self, options: { extension: { table: true } }
Renderers::Default.render self
end
end
end
14 changes: 9 additions & 5 deletions lib/madman/renderers/default.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
module Madman
module Renderers
class Default
def self.render(text, _opts = {})
Commonmarker.to_html text, options: {
render: { unsafe: true },
extension: { table: true },
}
def self.render(text, *)
Commonmarker.to_html text,
options: {
render: { unsafe: true },
extension: { table: true },
},
plugins: {
syntax_highlighter: { theme: 'InspiredGitHub' },
}
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/madman/server_base.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Madman
class ServerBase < Sinatra::Base
set :views, File.expand_path('../views', __dir__)
set :protection, except: :host_authorization
set :host_authorization, permitted_hosts: []

Slim::Engine.set_options pretty: true

Expand Down
5 changes: 2 additions & 3 deletions lib/madman/yamldoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ def counter

def tree!(data = nil, indent = 0, caption = 2)
data ||= yaml
result = []
caption = 6 if caption > 6

data.each do |key, value|
result.push render_pair key, value, indent, caption
result = data.map do |key, value|
render_pair key, value, indent, caption
end

result.join "\n"
Expand Down
13 changes: 7 additions & 6 deletions madman.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ Gem::Specification.new do |s|

s.add_dependency 'addressable', '~> 2.7'
s.add_dependency 'coffee-script', '~> 2.4'
s.add_dependency 'colsole', '>= 0.8.1', '< 2'
s.add_dependency 'commonmarker', '~> 1.0'
s.add_dependency 'colsole', '~> 1.0'
s.add_dependency 'commonmarker', '~> 2.6'
s.add_dependency 'mister_bin', '~> 0.7'
s.add_dependency 'octokit', '~> 8.0'
s.add_dependency 'puma', '>= 5.1', '< 7'
s.add_dependency 'octokit', '~> 10.0'
s.add_dependency 'puma', '~> 7.1'
s.add_dependency 'rackup', '~> 2.3'
s.add_dependency 'requires', '~> 1.0'
s.add_dependency 'sassc', '~> 2.4'
s.add_dependency 'sinatra', '>= 3.0', '< 5'
s.add_dependency 'slim', '>= 4.0', '< 6'
s.add_dependency 'sinatra', '~> 4.2'
s.add_dependency 'slim', '~> 5.2'
s.add_dependency 'string-direction', '~> 1.2'

s.metadata['rubygems_mfa_required'] = 'true'
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/bin/render/basic
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Hello Ace</h1>
<h1><a href="#hello-ace" aria-hidden="true" class="anchor" id="hello-ace"></a>Hello Ace</h1>
<ul>
<li>like</li>
<li>a</li>
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/document/render
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Hello Ace</h1>
<h1><a href="#hello-ace" aria-hidden="true" class="anchor" id="hello-ace"></a>Hello Ace</h1>
<ul>
<li>like</li>
<li>a</li>
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/renderer/default
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1>hello world</h1>
<h1><a href="#hello-world" aria-hidden="true" class="anchor" id="hello-world"></a>hello world</h1>
2 changes: 1 addition & 1 deletion spec/approvals/renderer/default-htmlcode
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h1>hello</h1>
<h1><a href="#hello" aria-hidden="true" class="anchor" id="hello"></a>hello</h1>
<p style='background: #fff'></p>
2 changes: 1 addition & 1 deletion spec/approvals/renderer/github
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="markdown-heading"><h1 class="heading-element">hello world</h1><a id="user-content-hello-world" class="anchor-element" aria-label="Permalink: hello world" href="#hello-world"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>
<div class="markdown-heading"><h1 class="heading-element">hello world</h1><a id="user-content-hello-world" class="anchor" aria-label="Permalink: hello world" href="#hello-world"><span aria-hidden="true" class="octicon octicon-link"></span></a></div>