Class: Doze::Entity::HTML

Inherits:
Doze::Entity show all
Defined in:
lib/doze/serialization/html.rb

Constant Summary

Constants inherited from Doze::Entity

DEFAULT_TEXT_ENCODING

Instance Attribute Summary

Attributes inherited from Doze::Entity

#binary_data_length, #encoding, #extra_content_headers, #language, #media_type, #media_type_params

Instance Method Summary collapse

Methods inherited from Doze::Entity

#binary_data, #binary_data_stream, #etag, #initialize

Constructor Details

This class inherits a constructor from Doze::Entity

Instance Method Details

#serialize(data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/doze/serialization/html.rb', line 8

def serialize(data)
  # TODO move to a template
  html = "<html>\n  <head>\n<style>\n  body {\n    font-family: Arial;\n  }\n  body, td {\n    font-size: 13px;\n  }\n  body > table {\n    border: 1px solid black;\n  }\n  table {\n    border-color: black;\n    border-collapse: collapse;\n  }\n  td {\n    padding: 0;\n    vertical-align: top;\n  }\n  td > span, td > a, td > form {\n    display: block;\n    padding: 0.3em;\n    margin: 0;\n  }\n  td:first-child {\n    text-align: right;\n    font-weight: bold;\n    width: 1%; /* force as small as possible */\n  }\n  td > table {\n    width: 100%;\n  }\n  li > table {\n    width: 100%;\n  }\n  td > ol {\n    padding: 0.3em 0.3em 0.3em 2.3em;\n  }\n  td > ol > li > table {\n  }\n</style>\n  </head>\n  <body>\n\#{make_html(data)}\n  </body>\n</html>\n"
end