Class: ReverseAsciidoctor::Converters::Img
- Defined in:
- lib/reverse_asciidoctor/converters/img.rb
Instance Method Summary collapse
Methods inherited from Base
#escape_keychars, #extract_title, #treat, #treat_children
Instance Method Details
#convert(node, state = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/reverse_asciidoctor/converters/img.rb', line 4 def convert(node, state = {}) alt = node['alt'] src = node['src'] id = node['id'] width = node['width'] height = node['height'] anchor = id ? "[[#{id}]]\n" : "" title = extract_title(node) title = ".#{title}\n" unless title.empty? attrs = alt attrs = "\"\"" if (width || height) && alt.nil? attrs += ",#{width}" if width attrs += ",#{height}" if width && height [anchor, title, "image::", src, "[", attrs, "]"].join("") end |