$ ruby pastie.rb rubyfile.rb > target.html
1 #!/usr/bin/env ruby -wKU
2 # encoding: utf-8
3 require "rubygems"
4 require "uv"
5
6 themes = %w(active4d all_hallows_eve amy blackboard brilliance_black
7 brilliance_dull cobalt dawn eiffel espresso_libre idle
8 iplastic lazy mac_classic magicwb_amiga pastels_on_dark
9 slush_poppies spacecadet sunburst twilight zenburnesque)
10
11
12 input = ARGF
13 theme = "cobalt"
14 syntax = "ruby"
15 numbering = true
16 css_file = "/opt/local/lib/ruby/gems/1.8/gems/ultraviolet-0.10.2/render/xhtml/files/css/#{theme}.css"
17
18 html = Uv.parse( input, "xhtml", syntax, numbering, theme )
19
20 #link = %Q(<link rel="stylesheet" href=#{css_file} type="text/css" media="screen" title="no title" charset="utf-8">)
21
22 css = open(css_file).read
23 style = %Q(<style type="text/css" media="screen">
24 #{css}
25 </style>)
26
27 puts style + html
No comments:
Post a Comment