Module | XOXO |
In: |
lib/more/facets/xoxo.rb
|
Return a XOXO string corresponding to the Ruby object struct, translated to the following rules:
Additionally, you can pass these options on the options hash:
:html_wrap => true: | Wrap the XOXO with a basic XHTML 1.0 Transitional header. |
:css => css: | Reference css as stylesheet for the wrapped XOXO document. |
# File lib/more/facets/xoxo.rb, line 71 def self.dump(struct, options={}) struct = [struct] unless struct.kind_of? Array if options[:html_wrap] result = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\nhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head profile=\"\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n".strip if options[:css] result << %Q[<style type="text/css" >@import "#{options[:css]}";</style>] end result << "</head><body>" << make_xoxo(struct, 'xoxo') << "</body></html>" else result = make_xoxo(struct, 'xoxo') end result end