Class: TDiary::Style::HTMLwithPygments

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
lib/tdiary/style/markdown.rb

Constant Summary collapse

@@tdiary_style_markdown_footnote_stashes =
[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.tdiary_style_markdown_footnote_stashesObject



205
206
207
# File 'lib/tdiary/style/markdown.rb', line 205

def self.tdiary_style_markdown_footnote_stashes
	@@tdiary_style_markdown_footnote_stashes
end

Instance Method Details

#block_code(code, language) ⇒ Object



209
210
211
# File 'lib/tdiary/style/markdown.rb', line 209

def block_code(code, language)
	Pygments.highlight(code, lexer: language)
end

#footnote_def(content, num) ⇒ Object



217
218
219
220
221
# File 'lib/tdiary/style/markdown.rb', line 217

def footnote_def(content, num)
	raw_content = content.gsub(/<p>(.+?)<\/p>\n/){ $1 }
	@@tdiary_style_markdown_footnote_stashes.push([num, raw_content])
	""
end

#footnote_ref(num) ⇒ Object



223
224
225
# File 'lib/tdiary/style/markdown.rb', line 223

def footnote_ref(num)
	"<%=fn %Q(@@tdiary-style-markdown-footnote-#{num}@@)%>"
end

#footnotes(content) ⇒ Object



213
214
215
# File 'lib/tdiary/style/markdown.rb', line 213

def footnotes(content)
	""
end