Class: MarkdownExtension::Summary
- Inherits:
-
Object
- Object
- MarkdownExtension::Summary
- Defined in:
- lib/markdown_extension/summary.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#markdown ⇒ Object
Returns the value of attribute markdown.
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(config) ⇒ Summary
constructor
A new instance of Summary.
- #pre_processing ⇒ Object
Constructor Details
#initialize(config) ⇒ Summary
Returns a new instance of Summary.
7 8 9 10 11 12 13 14 15 |
# File 'lib/markdown_extension/summary.rb', line 7 def initialize(config) @config = config file = config.src+"/summary.md" if File.exist?(file) @markdown = File.read(file) else @markdown = "" end end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/markdown_extension/summary.rb', line 6 def config @config end |
#markdown ⇒ Object
Returns the value of attribute markdown.
6 7 8 |
# File 'lib/markdown_extension/summary.rb', line 6 def markdown @markdown end |
Instance Method Details
#html ⇒ Object
26 27 28 29 |
# File 'lib/markdown_extension/summary.rb', line 26 def html pre_processing() return Kramdown::Document.new(@markdown, input: 'GFM').to_html end |
#pre_processing ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/markdown_extension/summary.rb', line 17 def pre_processing if @config.preprocessing["backlinks"] @markdown = @markdown.gsub(/\[\[(.*)\]\]/) do |s| s = s[2..-3] "[#{s}](#{s}.html)" end end end |