middleman-syntax 3.2.0 → 3.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2938584ddd836e4ce6674e01ad8eab8ac96d87f319261d1d642d0e1975d4d495
4
- data.tar.gz: 3fd48b680357a1c4fc8c965495e5540cce89910b0697bcfc68056602a4385180
3
+ metadata.gz: e10bda9e80f47020802183bad3a3849929d927afd99d2da43f0bf67547213028
4
+ data.tar.gz: f930e8d69b461e426ae8e3ad63b3111d6b2607df9b66cee73fcd7f88e5d9fda8
5
5
  SHA512:
6
- metadata.gz: 693ec6000db5121c3e111e6d52c424c3cf9cff277f952b1c05485d25a60580b82b2ffd5ad782c98c61774d4245efa7fa46a28380068d4e62bdc16778b0cfbbb5
7
- data.tar.gz: 85be352460bc44e32b05f3d114da90ce9e620aeb996bb0582a43d14f9926de0aae58aaaee63342ee74235f758c260f8ea2b1bee42b8056bafff7a878969ec54f
6
+ metadata.gz: b7d960fc8adae60a7f21b67ba7ebbfd7c103121ac000ff94361fee9fcdb64e2df6c8a57161f125103c296c4c242943d5b5593e7f9b29b621d2a0b2c223ecaa52
7
+ data.tar.gz: 141ea649e0a810ecfde705d7072290a85377bc2d73194fed063da2adb5bd03e85a74b09c35f87fb9fef7aab40f74e5af501ae1c581b3063ae8e0f8108a3b76af
@@ -0,0 +1,19 @@
1
+ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/ruby/.devcontainer/base.Dockerfile
2
+
3
+ # [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster
4
+ ARG VARIANT="3.1-bullseye"
5
+ FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
6
+
7
+ # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8
+ ARG NODE_VERSION="none"
9
+ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10
+
11
+ # [Optional] Uncomment this section to install additional OS packages.
12
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
13
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
14
+
15
+ # [Optional] Uncomment this line to install additional gems.
16
+ # RUN gem install <your-gem-names-here>
17
+
18
+ # [Optional] Uncomment this line to install global node packages.
19
+ # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
@@ -0,0 +1,37 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2
+ // https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/ruby
3
+ {
4
+ "name": "Ruby",
5
+ "build": {
6
+ "dockerfile": "Dockerfile",
7
+ "args": {
8
+ // Update 'VARIANT' to pick a Ruby version: 3, 3.1, 3.0, 2, 2.7
9
+ // Append -bullseye or -buster to pin to an OS version.
10
+ // Use -bullseye variants on local on arm64/Apple Silicon.
11
+ "VARIANT": "2.7",
12
+ // Options
13
+ "NODE_VERSION": "lts/*"
14
+ }
15
+ },
16
+
17
+ // Configure tool-specific properties.
18
+ "customizations": {
19
+ // Configure properties specific to VS Code.
20
+ "vscode": {
21
+ // Add the IDs of extensions you want installed when the container is created.
22
+ "extensions": [
23
+ "rebornix.Ruby"
24
+ ]
25
+ }
26
+ },
27
+
28
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
29
+ // "forwardPorts": [],
30
+
31
+ // Use 'postCreateCommand' to run commands after the container is created.
32
+ // "postCreateCommand": "ruby --version",
33
+
34
+ // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
35
+ "remoteUser": "vscode"
36
+
37
+ }
@@ -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,17 +1,31 @@
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).
14
+
1
15
  # 3.2.0
2
16
 
3
- - Prep for Middleman v5
17
+ - Prep for Middleman v5.
4
18
 
5
19
  # 3.0.0
6
20
 
7
- - Upgrade to Rouge 2.0. #66.
8
- - 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).
9
23
  - Lexer options are properly passed down to the highlighter.
10
24
 
11
25
  # 2.1.0
12
26
 
13
- - Version compatibility with Middleman 4. #58
14
- - 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).
15
29
  - Fixed tests and code reorganization.
16
30
 
17
31
  # 2.0.0
@@ -30,17 +44,17 @@
30
44
  # 1.2.0
31
45
 
32
46
  - Support Kramdown as Markdown engine in addition to Redcarpet.
33
- - Switch to Rouge from Pygments.rb
47
+ - Switch to Rouge from Pygments.rb.
34
48
  - Fix bugs around setting language options.
35
49
 
36
50
  # 1.1.1
37
51
 
38
- - Properly merge language attribute for Markdown. #14
52
+ - Properly merge language attribute for Markdown (#14).
39
53
 
40
54
  # 1.1.0
41
55
 
42
- - Avoid errors when language is empty. #9
43
- - Allow passing options to Pygments. #5 & #7
56
+ - Avoid errors when language is empty (#9).
57
+ - Allow passing options to Pygments (#5, #7).
44
58
 
45
59
  # 1.0.1
46
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"
@@ -11,3 +11,15 @@ Feature: Haml :code filter.
11
11
  When I go to "/code_haml_filter.html"
12
12
  Then I should see '<span class="k">def</span>'
13
13
  Then I should see '<pre class="highlight plaintext"><code>This is some code'
14
+
15
+ Scenario: Filter doesn't keep trailing blank lines
16
+ Given a fixture app "test-app"
17
+ And a file named "config.rb" with:
18
+ """
19
+ set :haml, { :ugly => false }
20
+ activate :syntax
21
+ """
22
+ Given the Server is running at "test-app"
23
+ When I go to "/code_haml_filter.html"
24
+ Then I should see '<span class="k">def</span>'
25
+ Then I should see '<pre class="highlight plaintext"><code>This is some code</code></pre>'
@@ -9,6 +9,7 @@ module Middleman
9
9
  class SyntaxExtension < Extension
10
10
  option :css_class, 'highlight', 'Class name applied to the syntax-highlighted output.'
11
11
  option :line_numbers, false, 'Generate line numbers.'
12
+ option :line_numbers_div, false, 'Generate line numbers with wrapping divs.'
12
13
  option :start_line, 1, 'Start the line numbering (if enabled) at the desired integer'
13
14
  option :inline_theme, nil, 'A Rouge::CSSTheme that will be used to highlight the output with inline styles instead of using CSS classes.'
14
15
  option :wrap, true, 'Wrap the highlighted content in a container (<pre> or <div>, depending on whether :line_numbers is on).'
@@ -12,6 +12,8 @@ module Middleman
12
12
  end
13
13
 
14
14
  @formatter = Rouge::Formatters::HTMLTable.new(@formatter, opts) if opts[:line_numbers]
15
+
16
+ @formatter = Rouge::Formatters::HTMLLinewise.new(@formatter, class:'line-%i') if opts[:line_numbers_div]
15
17
 
16
18
  if opts.fetch(:wrap, true)
17
19
  @formatter = Rouge::Formatters::HTMLPygments.new(@formatter, opts.fetch(:css_class, 'codehilite'))
@@ -1,21 +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.encode(Encoding::UTF_8)
16
+ Middleman::Syntax::Highlighter.highlight(code, language)
17
+ end
18
+ end
10
19
 
11
- # Allow language to be specified via a special comment like:
12
- # # lang: ruby
13
- if code.lines.first =~ /\A\s*#\s*lang:\s*(\w+)$/
14
- language = $1
15
- 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])]
16
28
  end
29
+ end
17
30
 
18
- 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
19
40
  end
20
41
  end
21
42
  end
@@ -9,6 +9,9 @@ module Middleman
9
9
  if attribute == "line_numbers" and value == "false"
10
10
  return { line_numbers: false }
11
11
  end
12
+ if attribute == "line_numbers_div" and value == "false"
13
+ return { line_numbers_div: false }
14
+ end
12
15
  end
13
16
  {}
14
17
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Syntax
3
- VERSION = "3.2.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.2.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: 2019-07-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
  - - ">="
@@ -129,8 +115,10 @@ executables: []
129
115
  extensions: []
130
116
  extra_rdoc_files: []
131
117
  files:
118
+ - ".devcontainer/Dockerfile"
119
+ - ".devcontainer/devcontainer.json"
120
+ - ".github/workflows/ci.yml"
132
121
  - ".gitignore"
133
- - ".travis.yml"
134
122
  - CHANGELOG.md
135
123
  - CONTRIBUTING.md
136
124
  - Gemfile
@@ -166,7 +154,7 @@ homepage: https://github.com/middleman/middleman-syntax
166
154
  licenses:
167
155
  - MIT
168
156
  metadata: {}
169
- post_install_message:
157
+ post_install_message:
170
158
  rdoc_options: []
171
159
  require_paths:
172
160
  - lib
@@ -181,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
169
  - !ruby/object:Gem::Version
182
170
  version: '0'
183
171
  requirements: []
184
- rubygems_version: 3.0.4
185
- signing_key:
172
+ rubygems_version: 3.4.10
173
+ signing_key:
186
174
  specification_version: 4
187
175
  summary: Code syntax highlighting plugin via rouge for Middleman
188
176
  test_files:
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