showcase-rails 0.4.3 → 0.4.4

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: 62a983038704732db89c5b41327a4787c562920c8ad849809e400a09990bc5b1
4
- data.tar.gz: 02d378f6e837f91d623d09547469b4bce8c7b07ffc47d394c1d8df0621c28257
3
+ metadata.gz: 2adc4a47c5a8ed232806aa549ba9f06ed31dbfdce4f5ddcc0b3870c5b98238b1
4
+ data.tar.gz: 0b020029eb9033a4bf4301d89ab8e126a830863db386f4b53379a1a3cc20c28d
5
5
  SHA512:
6
- metadata.gz: ede2f638590dd154fc5e45d0ab186ff25bea725033655361a286ea2677cf3406fd042dd459e82b00a8b0dcf266ea128ec02df3bbd352ba602e889254dfdc1181
7
- data.tar.gz: 4f0a46f8364fa27e8066c20313e3c6a10abf3e7dbfa893f656e439367d444438c34c667e713374aa3ea124e86eb205bd7d14f01b34675c23831fd6aabe108ff9
6
+ metadata.gz: 5441474266e6a2316ff5756c49bcf3c4933fc805f7f55ff24884ac68fb2696e4365bb0ca1db89237006c3e51d916e11d685862b5dab0177eca6a18fb616e5211
7
+ data.tar.gz: 1b7c20bdc9e88829e5fbfe8aedaffa31af65010d9d8460c5fffb58dae6f42d48eb6f04c9a58edc7a84a43574fd90710ffa831ecbfbc6c7f4c7196dc6566300ed
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" # Optional. For out-of-the-box syntax highlighting.
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
@@ -1,6 +1,10 @@
1
1
  <main class="sc-flex sc-flex-wrap dark:sc-bg-neutral-900 dark:sc-text-white" aria-labelledby="showcase_main_title">
2
2
  <section class="sc-grid sc-grid-cols-12 sc-w-full">
3
- <nav class="sc-col-span-3 xl:sc-col-span-2 sc-h-full sc-border-0 sc-border-r sc-border-solid sc-border-gray-200">
3
+ <nav
4
+ id="showcase-nav"
5
+ data-turbo-permanent
6
+ class="sc-col-span-3 xl:sc-col-span-2 sc-h-full sc-border-0 sc-border-r sc-border-solid sc-border-gray-200"
7
+ >
4
8
  <h1 id="showcase_main_title" class="sc-font-black sc-text-2xl sc-m-0">
5
9
  <%= link_to "Showcase", root_url, class: "sc-link sc-block sc-pt-5 sc-pb-2 sc-pl-4" %>
6
10
  </h1>
@@ -1,3 +1,3 @@
1
1
  module Showcase
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
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.attr_accessor :sample_renderer
23
- @sample_renderer = proc { _1 }
24
-
25
- if defined?(Rouge)
26
- Formatter = Rouge::Formatters::HTML.new
27
-
28
- @sample_renderer = ->(source, syntax) do
29
- lexed = Rouge::Lexer.find(syntax).lex(source)
30
- Showcase::Formatter.format(lexed).html_safe
31
- end
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.3
4
+ version: 0.4.4
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-05 00:00:00.000000000 Z
12
+ date: 2023-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails