class MarkdownToTeX::Renderer
Public Instance Methods
autolink(link, link_type)
click to toggle source
Span-level calls A return value of ‘nil` will not output any data If the method for a document element is not implemented, the contents of the span will be copied verbatim
# File lib/markdown_to_tex/renderer.rb, line 69 def autolink(link, link_type) "{{autolink:<#{link}>, title:<#{title}>, content:<#{content}>}}" end
block_code(code, language)
click to toggle source
Block-level calls If the return value of the method is ‘nil`, the block will be skipped. If the method for a document element is not implemented, the block will be skipped.
Example:
class RenderWithoutCode < Redcarpet::Render::HTML def block_code(code, language) nil end end
# File lib/markdown_to_tex/renderer.rb, line 33 def block_code(code, language) wrap_environment("verbatim", code) end
codespan(code)
click to toggle source
# File lib/markdown_to_tex/renderer.rb, line 73 def codespan(code) qchar = if code =~ /\+/ then "!" else "+" end "\\verb#{qchar}#{code}#{qchar}" end
doc_header()
click to toggle source
Header of the document Rendered before any another elements
# File lib/markdown_to_tex/renderer.rb, line 102 def doc_header() "% start-of-output\n" end
header(text, header_level)
click to toggle source
block_quote(quote) block_html(raw_html
)
# File lib/markdown_to_tex/renderer.rb, line 39 def header(text, header_level) TextProcessor.process_header(text, header_level) end
linebreak()
click to toggle source
double_emphasis(text) emphasis(text) image(link, title, alt_text)
# File lib/markdown_to_tex/renderer.rb, line 80 def linebreak() "\n%\n" end
link(link, title, content)
click to toggle source
# File lib/markdown_to_tex/renderer.rb, line 84 def link(link, title, content) "#{content}\\nobreak\\footnote{\\url{#{link}}}" end
list(contents, list_type)
click to toggle source
hrule()
# File lib/markdown_to_tex/renderer.rb, line 45 def list(contents, list_type) environment = case list_type when "ordered" then "enumerated" when "unordered" then "itemize" end wrap_environment("itemize", contents) end
list_item(text, list_type)
click to toggle source
# File lib/markdown_to_tex/renderer.rb, line 53 def list_item(text, list_type) "\\item #{text}\n" end
paragraph(text)
click to toggle source
# File lib/markdown_to_tex/renderer.rb, line 57 def paragraph(text) TextProcessor.process_paragraph(text)+"\n\n" end
raw_html(raw_html)
click to toggle source
# File lib/markdown_to_tex/renderer.rb, line 88 def raw_html(raw_html) raw_html end
Private Instance Methods
wrap_environment(environment, text)
click to toggle source
Pre/post-process Special callback: preprocess or postprocess the whole document before or after the rendering process begins
preprocess(full_document) postprocess(full_document)
# File lib/markdown_to_tex/renderer.rb, line 120 def wrap_environment(environment, text) "\\begin{#{environment}}\n"+ text + "\\end{#{environment}}\n" end