showcase-rails 0.4.3 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/showcase/version.rb +1 -1
- data/lib/showcase.rb +16 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e437d814d89cdc6a3d023edce093a5ebe92da961b5658013cd57bae84af123
|
4
|
+
data.tar.gz: 7eef04b815c656c4c2eba45164ed0c1e7c6d2352053e5dc3c11854959b88e726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96caaccee98301814f06c6e3022a7e01b222a865deedb5c5198da5b39540596174f5f03a4b4f6b7746a973d81050cd2a747fba3b7241b19a82d3c57d7d8c9e7e
|
7
|
+
data.tar.gz: c59ef24d8e7a378ab4151f092be16aafd7a8e8027a745256f5d96e050ed7c703b2101c0fa361773673f5c07e4f5f7f4a42288cf6dd6bda0e34f38d7e66077a20
|
data/README.md
CHANGED
@@ -175,7 +175,7 @@ Add these lines to your application's Gemfile. See next section for why Showcase
|
|
175
175
|
```ruby
|
176
176
|
group :development, :test do
|
177
177
|
gem "showcase-rails"
|
178
|
-
gem "rouge" #
|
178
|
+
gem "rouge", require: false # Syntax highlighting, `require: false` lets Showcase handle loading and saves boot time.
|
179
179
|
end
|
180
180
|
```
|
181
181
|
|
@@ -228,7 +228,7 @@ end
|
|
228
228
|
|
229
229
|
### Syntax Highlighting
|
230
230
|
|
231
|
-
Add `gem "rouge"` to your Gemfile and Showcase will set syntax highlighting up for you. Any denoted syntaxes in your samples are then highlighted, e.g.:
|
231
|
+
Add `gem "rouge", require: false` to your Gemfile and Showcase will set syntax highlighting up for you. Any denoted syntaxes in your samples are then highlighted, e.g.:
|
232
232
|
|
233
233
|
```erb
|
234
234
|
# app/views/showcase/previews/_plain_ruby.ruby
|
data/lib/showcase/version.rb
CHANGED
data/lib/showcase.rb
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
require_relative "showcase/version"
|
2
2
|
|
3
|
-
# Activate the app-bundled Rouge gem to setup default syntax highlighting.
|
4
|
-
begin
|
5
|
-
gem "rouge"
|
6
|
-
require "rouge"
|
7
|
-
rescue LoadError
|
8
|
-
end
|
9
|
-
|
10
3
|
module Showcase
|
11
4
|
autoload :PreviewsTest, "showcase/previews_test"
|
12
5
|
autoload :RouteHelper, "showcase/route_helper"
|
@@ -19,16 +12,22 @@ module Showcase
|
|
19
12
|
end
|
20
13
|
self.tree_opens = true # All open by default
|
21
14
|
|
22
|
-
singleton_class.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
15
|
+
singleton_class.attr_writer :sample_renderer
|
16
|
+
|
17
|
+
def self.sample_renderer
|
18
|
+
@sample_renderer ||=
|
19
|
+
begin
|
20
|
+
gem "rouge" # Activate the app-bundled Rouge gem to setup default syntax highlighting.
|
21
|
+
require "rouge"
|
22
|
+
|
23
|
+
formatter = Rouge::Formatters::HTML.new
|
24
|
+
@sample_renderer = ->(source, syntax) do
|
25
|
+
lexed = Rouge::Lexer.find(syntax).lex(source)
|
26
|
+
formatter.format(lexed).html_safe
|
27
|
+
end
|
28
|
+
rescue LoadError
|
29
|
+
proc { _1 }
|
30
|
+
end
|
32
31
|
end
|
33
32
|
|
34
33
|
def self.previews
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: showcase-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pence
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-06-
|
12
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|