Class: Jekyll::Tags::RustPlaygroundHighlight
- Inherits:
-
HighlightBlock
- Object
- HighlightBlock
- Jekyll::Tags::RustPlaygroundHighlight
- Defined in:
- lib/rust_playground_highlight.rb
Instance Attribute Summary collapse
-
#gist_id ⇒ Object
Returns the value of attribute gist_id.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #add_code_tag(code) ⇒ Object
-
#options_hash ⇒ Object
The @options ivar was renamed to @highlight_options in commit: github.com/jekyll/jekyll/commit/a7730914df272d003de6d3b63669e8e8417e0c61.
- #playground_url ⇒ Object
- #render(context) ⇒ Object
Instance Attribute Details
#gist_id ⇒ Object
Returns the value of attribute gist_id.
5 6 7 |
# File 'lib/rust_playground_highlight.rb', line 5 def gist_id @gist_id end |
#raw ⇒ Object
Returns the value of attribute raw.
5 6 7 |
# File 'lib/rust_playground_highlight.rb', line 5 def raw @raw end |
Instance Method Details
#add_code_tag(code) ⇒ Object
7 8 9 |
# File 'lib/rust_playground_highlight.rb', line 7 def add_code_tag(code) super.sub(/\n*<\/pre>/,"</pre><a href='#{playground_url}' target='_new' class='playground btn btn-xs btn-primary active' role='button'>Run</a>").strip end |
#options_hash ⇒ Object
The @options ivar was renamed to @highlight_options in commit: github.com/jekyll/jekyll/commit/a7730914df272d003de6d3b63669e8e8417e0c61
20 21 22 |
# File 'lib/rust_playground_highlight.rb', line 20 def instance_variable_get(:@highlight_options) || instance_variable_get(:@options) end |
#playground_url ⇒ Object
24 25 26 |
# File 'lib/rust_playground_highlight.rb', line 24 def playground_url PlaygroundLink.build(self).url end |
#render(context) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rust_playground_highlight.rb', line 11 def render(context) #calls render on Liquid::Block, which returns the content of the block self.raw = self.method(:render).super_method.super_method.call(context).to_s.strip self.gist_id = [:playground_id] super end |