middleman-syntax 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '069a5916deb149f37860dd78cd181278367e1ae343d4053e619d902e2fb3f87e'
4
- data.tar.gz: 3e3e12eef81c32dfc9d683f8925e65d1fc22ed714b869880a8719acaf1c8e50a
3
+ metadata.gz: e10bda9e80f47020802183bad3a3849929d927afd99d2da43f0bf67547213028
4
+ data.tar.gz: f930e8d69b461e426ae8e3ad63b3111d6b2607df9b66cee73fcd7f88e5d9fda8
5
5
  SHA512:
6
- metadata.gz: 98e67a62f908fa76c4588dbd32b39f1374831a944efd604794ee157a9693c45c87b657bcb7497d36c1d162fbd7928fd0e94549c3350b018685419554335222ce
7
- data.tar.gz: 1e1c3c2dcf955bbe33b8ca8ffbacb77fcd96896123927971bba2fe3bdeb78a762bdaf53d5aae7ac799a1f5a7e19ea1c064438a3e15b3630d1390470133ce8f44
6
+ metadata.gz: b7d960fc8adae60a7f21b67ba7ebbfd7c103121ac000ff94361fee9fcdb64e2df6c8a57161f125103c296c4c242943d5b5593e7f9b29b621d2a0b2c223ecaa52
7
+ data.tar.gz: 141ea649e0a810ecfde705d7072290a85377bc2d73194fed063da2adb5bd03e85a74b09c35f87fb9fef7aab40f74e5af501ae1c581b3063ae8e0f8108a3b76af
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ name: ubuntu-ruby-${{ matrix.ruby-version }}
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby-version: ["3.3", "3.2", "3.1", "3.0", "2.7", "2.6", "2.5"]
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ bundler-cache: true
20
+ - name: Runs tests
21
+ run: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,19 +1,31 @@
1
- - Fixed HAML :code filter to remove trailing blank lines
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ # 3.4.0
6
+
7
+ - Haml 6 support (#82, #84).
8
+ - Migrate CI from Travis to GitHub Actions (#83).
9
+
10
+ # 3.3.0
11
+
12
+ - Remove trailing blank lines from HAML's :code filter (#79).
13
+ - Allow for Linewise Rouge formatter (#78).
2
14
 
3
15
  # 3.2.0
4
16
 
5
- - Prep for Middleman v5
17
+ - Prep for Middleman v5.
6
18
 
7
19
  # 3.0.0
8
20
 
9
- - Upgrade to Rouge 2.0. #66.
10
- - Added the ability to disable the line numbers on a specific code block when using Markdown and Redcarpet. #63.
21
+ - Upgrade to Rouge 2.0 (#66).
22
+ - Added the ability to disable the line numbers on a specific code block when using Markdown and Redcarpet (#63).
11
23
  - Lexer options are properly passed down to the highlighter.
12
24
 
13
25
  # 2.1.0
14
26
 
15
- - Version compatibility with Middleman 4. #58
16
- - Allow passing Rouge formatter options from the `code` helper. #50.
27
+ - Version compatibility with Middleman 4 (#58).
28
+ - Allow passing Rouge formatter options from the `code` helper (#50).
17
29
  - Fixed tests and code reorganization.
18
30
 
19
31
  # 2.0.0
@@ -32,17 +44,17 @@
32
44
  # 1.2.0
33
45
 
34
46
  - Support Kramdown as Markdown engine in addition to Redcarpet.
35
- - Switch to Rouge from Pygments.rb
47
+ - Switch to Rouge from Pygments.rb.
36
48
  - Fix bugs around setting language options.
37
49
 
38
50
  # 1.1.1
39
51
 
40
- - Properly merge language attribute for Markdown. #14
52
+ - Properly merge language attribute for Markdown (#14).
41
53
 
42
54
  # 1.1.0
43
55
 
44
- - Avoid errors when language is empty. #9
45
- - Allow passing options to Pygments. #5 & #7
56
+ - Avoid errors when language is empty (#9).
57
+ - Allow passing options to Pygments (#5, #7).
46
58
 
47
59
  # 1.0.1
48
60
 
data/Gemfile CHANGED
@@ -1,27 +1,24 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "middleman-core", :git => "https://github.com/middleman/middleman.git", :branch => '4.x'
3
+ gem "middleman-core", git: "https://github.com/middleman/middleman.git"
4
4
 
5
5
  # Specify your gem's dependencies in middleman-syntax.gemspec
6
6
  gemspec
7
7
 
8
8
  # Build and doc tools
9
- gem 'rake', '~> 10.3', require: false
10
- gem 'yard', '~> 0.8', require: false
9
+ gem 'rake', '~> 13.1', require: false
10
+ gem 'yard', '~> 0.9', require: false
11
11
 
12
12
  # Test tools
13
13
  gem 'pry', '~> 0.10', group: :development
14
- gem 'aruba', '~> 0.10.0'
14
+ gem 'aruba', '~> 1.0.0'
15
15
  gem 'rspec', '~> 3.0'
16
16
  gem 'cucumber', '~> 2.0'
17
17
  gem 'capybara', '~> 2.5.0'
18
+ gem 'haml', RUBY_VERSION > '3.0' ? '< 7' : '< 6'
19
+ gem 'slim', '>= 3', '< 5'
20
+ gem 'kramdown'
21
+ gem "redcarpet"
18
22
 
19
- platforms :ruby do
20
- gem "redcarpet"
21
- end
22
-
23
- # Code Quality
24
- gem "cane", :platforms => [:mri_19, :mri_20], :require => false
25
-
26
- # For old rubies
27
- gem 'nokogiri', ['~> 1.5', '< 1.7']
23
+ # For old Rubies
24
+ gem 'nokogiri', '~> 1.12.0'
data/README.md CHANGED
@@ -3,8 +3,7 @@
3
3
  `middleman-syntax` is an extension for the [Middleman] static site generator that adds syntax highlighting via [Rouge](https://github.com/jayferd/rouge).
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/middleman-syntax.svg)][gem]
6
- [![Build Status](https://travis-ci.org/middleman/middleman-syntax.svg)][travis]
7
- [![Dependency Status](https://gemnasium.com/middleman/middleman-syntax.svg?travis)][gemnasium]
6
+ [![CI](https://github.com/middleman/middleman-syntax/actions/workflows/ci.yml/badge.svg)](https://github.com/middleman/middleman-syntax/actions/workflows/ci.yml)
8
7
  [![Code Quality](https://codeclimate.com/github/middleman/middleman-syntax.svg)][codeclimate]
9
8
 
10
9
  ## Installation
@@ -16,9 +15,7 @@ gem install middleman
16
15
  middleman init MY_PROJECT
17
16
  ```
18
17
 
19
- If you already have a Middleman project: Add `gem "middleman-syntax"` to your `Gemfile` and run `bundle install`.
20
-
21
- **This plugin will not work on Ruby 1.8!** Rouge requires 1.9+, so we do too.
18
+ If you already have a Middleman project, add `gem "middleman-syntax"` to your `Gemfile` and run `bundle install`.
22
19
 
23
20
  ## Configuration
24
21
 
@@ -197,7 +194,7 @@ The best way to get quick responses to your issues and swift fixes to your bugs
197
194
 
198
195
  ## Donate
199
196
 
200
- [Click here to lend your support to Middleman](https://spacebox.io/s/4dXbHBorC3)
197
+ [Click here to lend your support to Middleman](https://github.com/sponsors/tdreyno)
201
198
 
202
199
  ## License
203
200
 
@@ -205,7 +202,5 @@ Copyright (c) 2012-2014 Benjamin Hollis. MIT Licensed, see [LICENSE] for details
205
202
 
206
203
  [middleman]: http://middlemanapp.com
207
204
  [gem]: https://rubygems.org/gems/middleman-syntax
208
- [travis]: http://travis-ci.org/middleman/middleman-syntax
209
- [gemnasium]: https://gemnasium.com/middleman/middleman-syntax
210
205
  [codeclimate]: https://codeclimate.com/github/middleman/middleman-syntax
211
206
  [LICENSE]: https://github.com/middleman/middleman-syntax/blob/master/LICENSE.md
data/Rakefile CHANGED
@@ -1,6 +1,4 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
1
+ require 'bundler/gem_tasks'
4
2
  require 'cucumber/rake/task'
5
3
 
6
4
  Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
@@ -9,23 +7,7 @@ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
9
7
  t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
10
8
  end
11
9
 
12
- require 'rake/clean'
13
-
14
10
  task :test => ["cucumber"]
15
-
16
- begin
17
- require 'cane/rake_task'
18
-
19
- desc "Run cane to check quality metrics"
20
- Cane::RakeTask.new(:quality) do |cane|
21
- cane.no_style = true
22
- cane.no_doc = true
23
- cane.abc_glob = "lib/middleman-syntax/**/*.rb"
24
- end
25
- rescue LoadError
26
- # warn "cane not available, quality task not provided."
27
- end
28
-
29
11
  task :default => :test
30
12
 
31
13
  desc "Build HTML documentation"
@@ -1,22 +1,42 @@
1
1
  # If Haml is around, define a :code filter that can be used to more conveniently output highlighted code.
2
+
2
3
  if defined? Haml
3
- module Haml
4
- module Filters
5
- module Code
6
- include Base
4
+ module HamlMonkeyPatch
5
+ def render(code)
6
+ code = code.rstrip
7
+ code = code.encode(Encoding::UTF_8)
8
+
9
+ # Allow language to be specified via a special comment like:
10
+ # # lang: ruby
11
+ if code.lines.first =~ /\A\s*#\s*lang:\s*(\w+)$/
12
+ language = $1
13
+ code = code.lines.to_a[1..-1].join # Strip first line
14
+ end
7
15
 
8
- def render(code)
9
- code = code.rstrip
10
- code = code.encode(Encoding::UTF_8)
16
+ Middleman::Syntax::Highlighter.highlight(code, language)
17
+ end
18
+ end
11
19
 
12
- # Allow language to be specified via a special comment like:
13
- # # lang: ruby
14
- if code.lines.first =~ /\A\s*#\s*lang:\s*(\w+)$/
15
- language = $1
16
- code = code.lines.to_a[1..-1].join # Strip first line
20
+ if Gem::Version.new(Haml::VERSION) >= Gem::Version.new("6.0.0")
21
+ module Haml
22
+ class Filters
23
+ class Code < Base
24
+ include HamlMonkeyPatch
25
+
26
+ def compile(node)
27
+ [:static, render(node.value[:text])]
17
28
  end
29
+ end
18
30
 
19
- Middleman::Syntax::Highlighter.highlight(code, language)
31
+ register :code, Code
32
+ end
33
+ end
34
+ else
35
+ module Haml
36
+ module Filters
37
+ module Code
38
+ include Base
39
+ extend HamlMonkeyPatch
20
40
  end
21
41
  end
22
42
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Syntax
3
- VERSION = "3.3.0"
3
+ VERSION = "3.4.0"
4
4
  end
5
5
  end
@@ -1,6 +1,4 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "middleman-syntax/version"
1
+ require "./lib/middleman-syntax/version"
4
2
 
5
3
  Gem::Specification.new do |s|
6
4
  s.name = "middleman-syntax"
@@ -17,9 +15,8 @@ Gem::Specification.new do |s|
17
15
  s.require_paths = ["lib"]
18
16
  s.add_runtime_dependency("middleman-core", [">= 3.2"])
19
17
  s.add_runtime_dependency("rouge", ["~> 3.2"])
20
- s.add_development_dependency("aruba", "~> 0.5.1")
21
- s.add_development_dependency("cucumber", "~> 1.3.1")
22
- s.add_development_dependency("fivemat")
18
+ s.add_development_dependency("aruba")
19
+ s.add_development_dependency("cucumber")
23
20
  s.add_development_dependency("haml")
24
21
  s.add_development_dependency("kramdown")
25
22
  s.add_development_dependency("slim")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-syntax
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hollis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-06 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -42,32 +42,18 @@ dependencies:
42
42
  name: aruba
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.1
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.1
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cucumber
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 1.3.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 1.3.1
69
- - !ruby/object:Gem::Dependency
70
- name: fivemat
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
@@ -131,8 +117,8 @@ extra_rdoc_files: []
131
117
  files:
132
118
  - ".devcontainer/Dockerfile"
133
119
  - ".devcontainer/devcontainer.json"
120
+ - ".github/workflows/ci.yml"
134
121
  - ".gitignore"
135
- - ".travis.yml"
136
122
  - CHANGELOG.md
137
123
  - CONTRIBUTING.md
138
124
  - Gemfile
@@ -168,7 +154,7 @@ homepage: https://github.com/middleman/middleman-syntax
168
154
  licenses:
169
155
  - MIT
170
156
  metadata: {}
171
- post_install_message:
157
+ post_install_message:
172
158
  rdoc_options: []
173
159
  require_paths:
174
160
  - lib
@@ -183,8 +169,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
169
  - !ruby/object:Gem::Version
184
170
  version: '0'
185
171
  requirements: []
186
- rubygems_version: 3.1.6
187
- signing_key:
172
+ rubygems_version: 3.4.10
173
+ signing_key:
188
174
  specification_version: 4
189
175
  summary: Code syntax highlighting plugin via rouge for Middleman
190
- test_files: []
176
+ test_files:
177
+ - features/haml_filter.feature
178
+ - features/helper.feature
179
+ - features/markdown.feature
180
+ - features/markdown_line_numbers_disabled.feature
181
+ - features/markdown_line_numbers_enabled.feature
182
+ - features/support/env.rb
183
+ - features/support/step_definitions.rb
184
+ - fixtures/test-app/config.rb
185
+ - fixtures/test-app/source/code.html.markdown
186
+ - fixtures/test-app/source/code_haml.html.haml
187
+ - fixtures/test-app/source/code_haml_filter.html.haml
188
+ - fixtures/test-app/source/code_html.html.erb
189
+ - fixtures/test-app/source/code_slim.html.slim
190
+ - fixtures/test-app/source/code_with_disabled_line_numbers.html.markdown
191
+ - fixtures/test-app/source/code_with_enabled_line_numbers.html.markdown
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- rvm:
2
- - ruby-head
3
- - 2.6.3
4
- - 2.5.5
5
- os:
6
- - linux
7
- matrix:
8
- fast_finish: true
9
- allow_failures:
10
- - rvm: ruby-head
11
- script: "bundle exec rake test"
12
-
13
- env: TEST=true
14
- sudo: false