Sha256: ba3c4274f14e96a1545a6d00fc4771cba0a0a5c26aa7d3e1cb4dbe0705338b0b

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 KB

Contents

# This file use notugly.xsl: An XSL transform to pretty up the SVG output from Graphviz
# 
# See: http://www.hokstad.com/making-graphviz-output-pretty-with-xsl.html
# And: http://www.hokstad.com/making-graphviz-output-pretty-with-xsl-updated.html
# 
# By Vidar Hokstad and Ryan Shea; Contributions by Jonas Tingborn,
# Earl Cummings, Michael Kennedy (Graphviz 2.20.2 compatibility, bug fixes,
# testing, lots of gradients)

require 'rubygems'
require 'xml/xslt'

class GraphViz
  # Transform to pretty up the SVG output
  #
  # For more information, see http://www.hokstad.com/making-graphviz-output-pretty-with-xsl.html
  # and http://www.hokstad.com/making-graphviz-output-pretty-with-xsl-updated.html
  #
  # You can use the :nothugly option to GraphViz#output :
  #
  #   graph.output( :svg => "myGraph.svg", :nothugly => true )
  #
  # Or directly on an SVG output graph :
  #
  #   GraphViz.nothugly( "myGraph.svg" )
  def self.nothugly( file, save = true )
    xslt = XML::XSLT.new()
    xslt.xml = file
    xslt.xsl = File.join( File.dirname(File.expand_path(__FILE__)), "nothugly", "nothugly.xsl" )

    out = xslt.serve()
  
    if save
      fname = File.join( File.dirname(File.expand_path(file)), File.basename(file))
      File.open( fname, "w" ) { |io|
        io.print out
      }
    else
      return out
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby-graphviz-1.0.5 lib/graphviz/nothugly.rb
ruby-graphviz-1.0.4 lib/graphviz/nothugly.rb
ruby-graphviz-1.0.3 lib/graphviz/nothugly.rb
ruby-graphviz-1.0.2 lib/graphviz/nothugly.rb
ruby-graphviz-1.0.1 lib/graphviz/nothugly.rb
ruby-graphviz-1.0.0 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.21 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.20 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.19 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.18 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.17 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.16 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.15 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.14 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.13 lib/graphviz/nothugly.rb
ruby-graphviz-0.9.12 lib/graphviz/nothugly.rb