Skip to content

Instantly share code, notes, and snippets.

@akimichi
Last active August 29, 2015 13:56
Show Gist options
  • Save akimichi/8997422 to your computer and use it in GitHub Desktop.
Save akimichi/8997422 to your computer and use it in GitHub Desktop.
ReVIEW::Compiler.defblock :reduce,0..1
class ReVIEW::HTMLBuilder
def reduce(lines)
origin = lines.shift
puts %Q[<div class="table">]
puts %Q[<table class='table table-borderless'>]
lines.each_with_index do |line, index|
puts %Q[<tr>]
if(index == 0)
puts %Q[<td>]
puts origin
puts %Q[</td>]
puts %Q[<td>]
puts %Q[<span class="glyphicon glyphicon-arrow-right"></span>]
puts line
puts %Q[</td>]
else
puts %Q[<td></td>]
puts %Q[<td><span class="glyphicon glyphicon-arrow-right"></span>]
puts line
puts %Q[</td>]
end
end
puts %Q[</table>]
puts '</div>'
end
end
ReVIEW::Compiler.defblock :pageheader,0..1
class ReVIEW::HTMLBuilder
def pageheader(lines)
puts %Q[<div class="page-header">]
lines.each {|line| puts detab(line) }
puts '</div>'
end
end
ReVIEW::Compiler.definline :rotatebox
class ReVIEW::LATEXBuilder
def inline_rotatebox(str)
d, s = str.split(',')
macro("rotatebox", d, s)
end
end
ReVIEW::Compiler.defblock :foo, 0..1
class ReVIEW::HTMLBuilder
def foo(lines, caption = nil)
puts lines.join(",")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment