def wrap_in_image_map(src, dot)
      res = ""
      dot_map = `dot -Tismap #{src}`

      if(!dot_map.empty?)
        res << %{<map id="map" name="map">\n}
        dot_map.split($/).each do |area|
          unless area =~ /^rectangle \((\d+),(\d+)\) \((\d+),(\d+)\) ([\/\w.]+)\s*(.*)/
            $stderr.puts "Unexpected output from dot:\n#{area}"
            return nil
          end

          xs, ys = [$1.to_i, $3.to_i], [$2.to_i, $4.to_i]
          url, area_name = $5, $6

          res <<  %{  <area shape="rect" coords="#{xs.min},#{ys.min},#{xs.max},#{ys.max}" }
          res <<  %{     href="#{url}" alt="#{area_name}" />\n}
        end
        res << "</map>\n"
      end

      res << %{<img src="#{dot}" usemap="#map" alt="#{dot}" />}
      return res
    end
def wrap_in_image_map(src, dot)
      res = ""
      dot_map = `dot -Tismap #{src}`

      if(!dot_map.empty?)
        res << %{<map id="map" name="map">\n}
        dot_map.split($/).each do |area|
          unless area =~ /^rectangle \((\d+),(\d+)\) \((\d+),(\d+)\) ([\/\w.]+)\s*(.*)/
            $stderr.puts "Unexpected output from dot:\n#{area}"
            return nil
          end

          xs, ys = [$1.to_i, $3.to_i], [$2.to_i, $4.to_i]
          url, area_name = $5, $6

          res <<  %{  <area shape="rect" coords="#{xs.min},#{ys.min},#{xs.max},#{ys.max}" }
          res <<  %{     href="#{url}" alt="#{area_name}" />\n}
        end
        res << "</map>\n"
      end

      res << %{<img src="#{dot}" usemap="#map" alt="#{dot}" />}
      return res
    end
Extract the client-side image map from dot, and use it to generate the
 imagemap proper. Return the whole <map>..<img> combination, suitable for
 inclusion on the page