Sha256: 751a64cd3cc047ebea1e5e064600f60ca5dcf3962f3bddc2a51e4b6a4f923f1d
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
#!/usr/bin/ruby require 'rubygems' require 'diffrenderer' old_text = ['This was some text'] new_text = ['This is some text'] diffed = DiffRenderer.new(old_text, new_text).to_html out = <<HTML <html> <head> <title>DiffRenderer Example</title> <style type="text/css"> <!-- #content { float: left; width: 560px; background: #FFF; margin-bottom: 10px; margin-left: 10px; padding: 1em 20px 0px; } #content p.added { background: #66ff66; margin-top: 0; margin-left: -0.5em; margin-right: -0.5em; padding: 0.5em; } #content p.removed { background: #ff6666; text-decoration: line-through; padding: 0.5em; margin-top: 0; margin-left: -0.5em; margin-right: -0.5em; } #content p.replaced { margin-top: 0; margin-bottom: 0; margin-left: -0.5em; margin-right: -0.5em; } #content span.added { background: #66ff66; padding: 2px 2px; } #content span.removed { background: #ff6666; padding: 2px 2px; text-decoration: line-through; } --> </style> </head> <body> <div id="content"> #{diffed} </div> </body> </html> HTML puts out
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
monkeyhelper-diffrenderer-0.0.0 | examples/diff-text.rb |
diffrenderer-0.0.3 | examples/diff-text.rb |