File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,13 +62,27 @@ def render opts
6262
6363 defaults = metadata [ 'defaults' ] || { }
6464
65+ metadata . fetch ( 'images' , [ ] ) . each do |img |
66+ if File . exist? ( "images/#{ img } " )
67+ `cp images/#{ img } #{ DIRNAME } /#{ img } `
68+ end
69+ end
70+
6571 attrs = [ defaults . dup ]
6672
6773 new_lines = [ ]
6874 lines . each_with_index do |line , i |
6975 if line =~ /^=(.*)$/ && ( i == 0 || lines [ i -1 ] =~ /^(-\s *){3,}$/ )
7076 line =~ /^=(.*)$/
71- attrs [ attrs . size -1 ] = defaults . dup . merge ( Hash [ $1. split ( ' ' ) . map { |a | k , v = a . split ( '=' ) ; [ k , eval ( v . to_s ) ] } ] )
77+ attr_pairs = [ ]
78+ $1. split ( ' ' ) . each do |str |
79+ if str =~ /=/
80+ attr_pairs << str
81+ else
82+ attr_pairs . last << ' ' << str
83+ end
84+ end
85+ attrs [ attrs . size -1 ] = defaults . dup . merge ( Hash [ attr_pairs . map { |a | k , v = a . split ( '=' ) ; [ k , eval ( v . to_s ) ] } ] )
7286 next
7387 elsif line =~ /^(-\s *){3,}$/
7488 attrs << defaults . dup
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def block_code code, lang
5959 file << code
6060 file . close
6161 "<div class='dot-wrap'>" +
62- ( Nokogiri ( `dot #{ file . path } -Tsvg` ) /'svg' ) . tap { |svg | svg . search ( 'polygon' ) . first . remove } . to_html +
62+ ( Nokogiri ( `dot #{ file . path } -Tsvg` ) /'svg' ) . first . tap { |svg | svg . search ( 'polygon' ) . first . remove ; svg [ 'width' ] = '600px' ; svg . attributes [ 'height' ] . remove } . to_html +
6363 "</div>"
6464 elsif lang == 'notes'
6565 "<div class='notes' style='display:none;'>#{ code } </div>"
You can’t perform that action at this time.
0 commit comments