erbook 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -3
- data/Rakefile +6 -3
- data/bin/erbook +285 -251
- data/doc/README +2 -2
- data/doc/api/classes/ERBook.html +2 -2
- data/doc/api/classes/RDoc/AnyMethod.html +20 -20
- data/doc/api/classes/RDoc/AnyMethod.src/M000003.html +18 -0
- data/doc/api/classes/RDoc/AnyMethod.src/M000004.html +23 -0
- data/doc/api/classes/RDoc/AnyMethod.src/M000005.html +4 -4
- data/doc/api/classes/RDoc/AnyMethod.src/M000006.html +7 -8
- data/doc/api/classes/RDoc/TopLevel.html +30 -30
- data/doc/api/classes/RDoc/{AnyMethod.src → TopLevel.src}/M000007.html +4 -4
- data/doc/api/classes/RDoc/TopLevel.src/{M000014.html → M000008.html} +4 -4
- data/doc/api/classes/RDoc/TopLevel.src/M000009.html +4 -4
- data/doc/api/classes/RDoc/TopLevel.src/M000010.html +15 -4
- data/doc/api/classes/RDoc/TopLevel.src/M000011.html +11 -4
- data/doc/api/classes/RDoc/TopLevel.src/M000012.html +4 -15
- data/doc/api/classes/String.html +17 -82
- data/doc/api/classes/String.src/M000001.html +4 -4
- data/doc/api/classes/String.src/M000002.html +3 -6
- data/doc/api/created.rid +1 -1
- data/doc/api/files/lib/erbook/rdoc_rb.html +1 -1
- data/doc/api/files/lib/erbook/{html_rb.html → to_xhtml_rb.html} +7 -7
- data/doc/api/files/lib/erbook_rb.html +1 -1
- data/doc/api/fr_file_index.html +1 -1
- data/doc/api/fr_method_index.html +12 -14
- data/doc/api/index.html +1 -1
- data/doc/index.xhtml +2277 -0
- data/doc/manual.erb +198 -155
- data/fmt/xhtml.icons/index.yaml +20 -0
- data/fmt/xhtml.icons/mediawiki-1.13.2/COPYING +340 -0
- data/fmt/xhtml.icons/mediawiki-1.13.2/README +103 -0
- data/fmt/xhtml.icons/mediawiki-1.13.2/skins/simple/external.png +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.1/48x48/README +2 -0
- data/fmt/{html.icons/note.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/apps/accessories-text-editor.png} +0 -0
- data/fmt/{html.icons/quote.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/apps/internet-group-chat.png} +0 -0
- data/fmt/{html.icons/important.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/emblems/emblem-important.png} +0 -0
- data/fmt/{html.icons/warning.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-error.png} +0 -0
- data/fmt/{html.icons/tip.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-information.png} +0 -0
- data/fmt/{html.icons/caution.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-warning.png} +0 -0
- data/fmt/{html.icons/LICENSE → xhtml.icons/tango-icon-theme-0.8.1/COPYING} +0 -0
- data/fmt/xhtml.icons/tango-icon-theme-0.8.1/README +12 -0
- data/fmt/{html.yaml → xhtml.yaml} +305 -247
- data/lib/erbook.rb +2 -2
- data/lib/erbook/{html.rb → to_xhtml.rb} +18 -24
- metadata +42 -21
- data/doc/api/classes/RDoc/AnyMethod.src/M000008.html +0 -22
- data/doc/api/classes/RDoc/TopLevel.src/M000013.html +0 -25
- data/doc/api/classes/String.src/M000003.html +0 -20
- data/doc/api/classes/String.src/M000004.html +0 -26
- data/doc/index.html +0 -2663
- data/fmt/html.icons/README +0 -31
Binary file
|
File without changes
|
File without changes
|
File without changes
|
data/fmt/{html.icons/warning.png → xhtml.icons/tango-icon-theme-0.8.1/48x48/status/dialog-error.png}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Tango Icon Theme
|
2
|
+
----------------
|
3
|
+
|
4
|
+
This is an icon theme that follows the Tango visual guidelines [1]. Currently
|
5
|
+
it depends on Imagemagick for creation of 24x24 bitmaps by adding a 1px padding
|
6
|
+
around the 22x22px version. For GNOME and KDE you will also need
|
7
|
+
icon-naming-utils that allow the theme to work in these environments before
|
8
|
+
they follow the new naming scheme [2].
|
9
|
+
|
10
|
+
|
11
|
+
[1] http://tango-project.org/Tango_Icon_Theme_Guidelines
|
12
|
+
[2] http://tango-project.org/Standard_Icon_Naming_Specification
|
@@ -1,19 +1,19 @@
|
|
1
1
|
desc: web page for the Internet
|
2
2
|
|
3
3
|
code: |
|
4
|
-
# load the String#
|
5
|
-
require 'erbook/
|
4
|
+
# load the String#to_xhtml and String#to_inline_xhtml methods
|
5
|
+
require 'erbook/to_xhtml'
|
6
6
|
|
7
7
|
class String
|
8
|
-
# Transforms this UTF-8 string into
|
9
|
-
def
|
8
|
+
# Transforms this UTF-8 string into XML entities.
|
9
|
+
def to_xml_entities
|
10
10
|
unpack('U*').map! {|c| "&##{c};"}.join
|
11
11
|
end
|
12
12
|
|
13
13
|
# Transforms this string into a valid URI fragment.
|
14
14
|
# See http://www.nmt.edu/tcc/help/pubs/xhtml/id-type.html
|
15
15
|
def to_uri_fragment
|
16
|
-
# remove
|
16
|
+
# remove XML tags from the input
|
17
17
|
buf = gsub(/<.*?>/, '')
|
18
18
|
|
19
19
|
# The first or only character must be a letter.
|
@@ -32,168 +32,230 @@ code: |
|
|
32
32
|
end
|
33
33
|
|
34
34
|
class Hash
|
35
|
-
# Transforms this hash into a string of
|
36
|
-
def
|
35
|
+
# Transforms this hash into a string of XML attribute key="value" pairs.
|
36
|
+
def to_xml_atts
|
37
37
|
inject([]) {|s,(k,v)| s << %( #{k}="#{v}") }.join
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
module ERBook
|
42
|
+
class Template
|
43
|
+
# Protects the given content from the text-to-XHTML conversion process.
|
44
|
+
def verbatim aContent
|
45
|
+
ERB::Util.html_escape aContent
|
46
|
+
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
# Returns XHTML for a hyperlink to the given
|
49
|
+
# URL of the given label and mouse-hover title.
|
50
|
+
def hyperlink aUrl, aLabel = aUrl, aTitle = nil
|
51
|
+
%{<a href="#{aUrl}"#{%{ title="#{aTitle}"} if aTitle}>#{aLabel}</a>}
|
52
|
+
end
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
# Returns an <img/> tag that embeds the given image file.
|
55
|
+
#
|
56
|
+
# aPath:: path to the image file
|
57
|
+
# aFormat:: format of the image file (e.g. PNG, JPEG, GIF, etc.)
|
58
|
+
# aAtts:: additional attributes for the <img> tag
|
59
|
+
#
|
60
|
+
def embed_image_file aPath, aFormat = aPath[/\w+/], aAtts = {}
|
61
|
+
data = ERBook.base_64_encode File.read(aPath)
|
62
|
+
embed_image_data data, aFormat, aAtts
|
63
|
+
end
|
55
64
|
|
56
|
-
|
57
|
-
|
65
|
+
# Returns an <img/> tag that embeds the given raw image data.
|
66
|
+
#
|
67
|
+
# aData:: raw image data
|
68
|
+
# aFormat:: format of the image file (e.g. PNG, JPEG, GIF, etc.)
|
69
|
+
# aAtts:: additional attributes for the <img> tag
|
70
|
+
#
|
71
|
+
def embed_image_data aData, aFormat, aAtts = {}
|
72
|
+
aAtts[:src] = ERBook.base_64_embed_image_data(aData, aFormat)
|
73
|
+
"<img#{aAtts.to_xml_atts}/>"
|
74
|
+
end
|
58
75
|
end
|
59
76
|
|
60
|
-
|
61
|
-
|
62
|
-
|
77
|
+
class Node
|
78
|
+
# Returns the user-defined title for this node's content.
|
79
|
+
def title
|
80
|
+
@title ||= args[0]
|
81
|
+
end
|
63
82
|
|
64
|
-
|
65
|
-
|
66
|
-
|
83
|
+
# Returns the user-defined indentifer for this node.
|
84
|
+
def id
|
85
|
+
@id ||= args[1]
|
86
|
+
end
|
67
87
|
|
68
|
-
def content_html
|
69
|
-
content.to_s.to_html
|
70
|
-
end
|
71
88
|
|
72
|
-
|
73
|
-
|
74
|
-
#
|
75
|
-
end
|
89
|
+
##
|
90
|
+
# utility methods
|
91
|
+
#
|
76
92
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
93
|
+
def type_label #:nodoc:
|
94
|
+
type.to_s.capitalize
|
95
|
+
end
|
81
96
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
97
|
+
def type_label_here_link #:nodoc:
|
98
|
+
s = type_label
|
99
|
+
here_link s, s
|
100
|
+
end
|
86
101
|
|
87
|
-
|
88
|
-
|
89
|
-
|
102
|
+
# Returns the title of this node as XHTML.
|
103
|
+
def title_xhtml
|
104
|
+
title.to_s.to_inline_xhtml
|
105
|
+
end
|
90
106
|
|
91
|
-
|
92
|
-
|
93
|
-
|
107
|
+
# Returns the content of this node as XHTML.
|
108
|
+
def content_xhtml
|
109
|
+
content.to_s.to_xhtml
|
110
|
+
end
|
94
111
|
|
95
|
-
|
96
|
-
|
97
|
-
|
112
|
+
# Returns the content of this node as XHTML inside a <div/>.
|
113
|
+
def content_xhtml_div #:nodoc:
|
114
|
+
%{<div class="content">#{content_xhtml}</div>}
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns a hyperlink to this node containing its title.
|
118
|
+
def title_link aTitle = nil
|
119
|
+
here_link here_frag, aTitle || title_xhtml
|
120
|
+
end
|
98
121
|
|
99
|
-
|
122
|
+
# Returns a hyperlink to this node
|
123
|
+
# containing its LaTeX-style index number.
|
124
|
+
def index_link
|
125
|
+
list_link here_frag, list_frag, index
|
126
|
+
end
|
100
127
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
frag = (id || title || salt).to_s.to_uri_fragment
|
128
|
+
# Returns a hyperlink to this node containing its occurrence number.
|
129
|
+
def number_link
|
130
|
+
list_link here_frag, list_frag, [type_label, number].compact.join(' ')
|
131
|
+
end
|
106
132
|
|
107
|
-
|
108
|
-
|
109
|
-
|
133
|
+
# Returns a hyperlink to this node containing
|
134
|
+
# its ocurrence number and its title.
|
135
|
+
def number_and_title_link #:nodoc:
|
136
|
+
"#{number_link}. #{title_link}"
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns a hyperlink to this node containing
|
140
|
+
# its LaTeX-style index number and its title.
|
141
|
+
def index_and_title_link #:nodoc:
|
142
|
+
"#{index_link} #{title_link}"
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
##
|
147
|
+
# URI fragments
|
148
|
+
#
|
149
|
+
|
150
|
+
@@frags = []
|
151
|
+
|
152
|
+
# Returns a unique URI fragment for this node.
|
153
|
+
def here_frag #:nodoc:
|
154
|
+
unless defined? @here_frag
|
155
|
+
salt = object_id.abs
|
156
|
+
frag = (id || title || salt).to_s.to_uri_fragment
|
157
|
+
|
158
|
+
# make it unique
|
159
|
+
while @@frags.include? frag
|
160
|
+
frag << '-' << (index || number || salt).to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
@@frags << frag
|
164
|
+
@here_frag = frag
|
110
165
|
end
|
111
166
|
|
112
|
-
|
113
|
-
|
167
|
+
@here_frag
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the URI fragment for the location in the table
|
171
|
+
# of contents / list of figures that points this node.
|
172
|
+
def list_frag #:nodoc:
|
173
|
+
@list_frag ||= "rev:#{here_frag}"
|
114
174
|
end
|
115
175
|
|
116
|
-
@here_frag
|
117
|
-
end
|
118
176
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
177
|
+
private
|
178
|
+
|
179
|
+
def here_link aHereFrag, aLabel #:nodoc:
|
180
|
+
%{<a class="here" title="Permanent link to this section" href="##{aHereFrag}">#{aLabel}</a>}
|
181
|
+
end
|
182
|
+
|
183
|
+
def list_link aHereFrag, aListFrag, aLabel #:nodoc:
|
184
|
+
%{<a class="list" title="Return to table of contents" id="#{aHereFrag}" href="##{aListFrag}">#{aLabel}</a>}
|
185
|
+
end
|
123
186
|
end
|
124
|
-
end
|
125
187
|
|
126
|
-
|
127
|
-
|
128
|
-
|
188
|
+
# Encodes the given input in base64 format.
|
189
|
+
def ERBook.base_64_encode aInput #:nodoc:
|
190
|
+
[aInput].pack('m')
|
191
|
+
end
|
129
192
|
|
130
|
-
|
131
|
-
|
132
|
-
|
193
|
+
# Returns a string denoting embedded, base64 encoded data.
|
194
|
+
def ERBook.base_64_embed aData, aFormat #:nodoc:
|
195
|
+
"data:#{aFormat.to_s.downcase};base64,#{aData.tr("\n", '')}"
|
196
|
+
end
|
133
197
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
198
|
+
# Returns a string denoting embedded, base64 encoded image data.
|
199
|
+
# aFormat:: format of the image data (e.g. PNG, JPEG, GIF, etc.)
|
200
|
+
def ERBook.base_64_embed_image_data aData, aFormat #:nodoc:
|
201
|
+
base_64_embed aData, "image/#{aFormat}"
|
202
|
+
end
|
139
203
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
end
|
204
|
+
##
|
205
|
+
# load admonition icons
|
206
|
+
#
|
144
207
|
|
145
|
-
|
146
|
-
|
147
|
-
"data:#{aFormat.to_s.downcase};base64,#{aData.tr("\n", '')}"
|
148
|
-
end
|
208
|
+
ICONS_DIR = File.join(ERBook::FORMATS_DIR, 'xhtml.icons')
|
209
|
+
ICON_DEFS = YAML.load_file File.join(ICONS_DIR, 'index.yaml')
|
149
210
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
211
|
+
Icon = Struct.new(:origin, :path, :name, :format, :data)
|
212
|
+
class Icon #:nodoc:
|
213
|
+
# Returns a data URI containing embedded image data.
|
214
|
+
def data_uri
|
215
|
+
ERBook.base_64_embed_image_data self.data, self.format
|
216
|
+
end
|
155
217
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
# aAtts:: additional attributes for the <img> tag
|
161
|
-
#
|
162
|
-
def embed_image_file aPath, aFormat = aPath[/\w+/], aAtts = {}
|
163
|
-
data = base_64_encode File.read(aPath)
|
164
|
-
aAtts['src'] = base_64_embed_image_data(data, aFormat)
|
165
|
-
"<img#{aAtts.to_html_atts}/>"
|
166
|
-
end
|
218
|
+
# Returns a CSS url() containing embedded image data.
|
219
|
+
def data_css
|
220
|
+
%{url("#{data_uri}")}
|
221
|
+
end
|
167
222
|
|
168
|
-
|
169
|
-
|
170
|
-
|
223
|
+
# Returns a XML entity reference (to this icon's
|
224
|
+
# embedded image data) ready for insertion into XML.
|
225
|
+
def entity_xml
|
226
|
+
"&#{entity_name};"
|
227
|
+
end
|
171
228
|
|
172
|
-
|
229
|
+
# Returns the name of the XML entity whose
|
230
|
+
# value contains embedded image data.
|
231
|
+
def entity_name
|
232
|
+
"icon_#{name}"
|
233
|
+
end
|
173
234
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
235
|
+
# Returns an <img/> tag that renders the image
|
236
|
+
# data embedded as an ENTITY in the html DOCTYPE.
|
237
|
+
def to_xhtml aAtts = {}
|
238
|
+
aAtts[:alt] ||= name
|
239
|
+
aAtts[:src] = entity_xml
|
240
|
+
aAtts[:class] = :icon
|
241
|
+
"<img#{aAtts.to_xml_atts}/>"
|
242
|
+
end
|
178
243
|
end
|
179
244
|
|
180
|
-
|
181
|
-
def css_image
|
182
|
-
"url(#{base_64_embed_image_data self.data, self.format})"
|
183
|
-
end
|
184
|
-
end
|
245
|
+
ICON_BY_NAME = {}
|
185
246
|
|
186
|
-
|
247
|
+
ICON_DEFS.each_pair do |name, path|
|
248
|
+
format = File.extname(path).sub('.', '')
|
249
|
+
origin = path[/^\w+/]
|
187
250
|
|
188
|
-
|
189
|
-
|
190
|
-
name = File.basename(path, ext)
|
191
|
-
data = base_64_encode File.open(path, 'rb') {|f| f.read }
|
251
|
+
path = File.join(ICONS_DIR, path) # make the path absolute
|
252
|
+
data = base_64_encode File.open(path, 'rb') {|f| f.read }
|
192
253
|
|
193
|
-
|
194
|
-
|
254
|
+
ICON_BY_NAME[name] = Icon.new(origin, path, name, format, data)
|
255
|
+
end
|
195
256
|
|
196
|
-
|
257
|
+
ICONS = ICON_BY_NAME.values
|
258
|
+
end
|
197
259
|
|
198
260
|
|
199
261
|
nodes:
|
@@ -207,7 +269,7 @@ nodes:
|
|
207
269
|
index: false
|
208
270
|
number: false
|
209
271
|
silent: true
|
210
|
-
output: <%= @node.
|
272
|
+
output: <%= @node.content_xhtml %>
|
211
273
|
|
212
274
|
header_outside_above: &header_insert
|
213
275
|
toc: false
|
@@ -215,7 +277,7 @@ nodes:
|
|
215
277
|
index: false
|
216
278
|
number: false
|
217
279
|
silent: true
|
218
|
-
output: <div class="<%= @node.type %>"><%= @node.
|
280
|
+
output: <div class="<%= @node.type %>"><%= @node.content_xhtml %></div>
|
219
281
|
|
220
282
|
header_inside_above: *header_insert
|
221
283
|
header_inside_below: *header_insert
|
@@ -234,10 +296,9 @@ nodes:
|
|
234
296
|
number: false
|
235
297
|
silent: true
|
236
298
|
output: |
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
<%= @node.content_div %>
|
299
|
+
<div id="<%= @node.type_label %>">
|
300
|
+
<h1 class="title"><%= @node.type_label_here_link %></h1>
|
301
|
+
<%= @node.content_xhtml_div %>
|
241
302
|
</div>
|
242
303
|
|
243
304
|
|
@@ -252,12 +313,12 @@ nodes:
|
|
252
313
|
number: true
|
253
314
|
output: |
|
254
315
|
<div class="<%= @node.type %>">
|
255
|
-
<h1
|
316
|
+
<h1 class="title">
|
256
317
|
<%= @node.type_label %> <%= @node.index_link %>
|
257
318
|
<br/>
|
258
319
|
<big><%= @node.title_link %></big>
|
259
320
|
</h1>
|
260
|
-
<%= @node.
|
321
|
+
<%= @node.content_xhtml_div %>
|
261
322
|
</div>
|
262
323
|
|
263
324
|
chapter: *latex
|
@@ -270,10 +331,10 @@ nodes:
|
|
270
331
|
output: |
|
271
332
|
<% depth = [6, @node.depth + 1].min %>
|
272
333
|
<div class="<%= @node.type %>">
|
273
|
-
<h<%= depth
|
334
|
+
<h<%= depth %> class="title">
|
274
335
|
<%= @node.index_and_title_link %>
|
275
336
|
</h<%= depth %>>
|
276
|
-
<%= @node.
|
337
|
+
<%= @node.content_xhtml_div %>
|
277
338
|
</div>
|
278
339
|
|
279
340
|
paragraph:
|
@@ -282,9 +343,9 @@ nodes:
|
|
282
343
|
index: false
|
283
344
|
number: false
|
284
345
|
output: |
|
285
|
-
<div<%= @node.
|
286
|
-
<p
|
287
|
-
<%= @node.
|
346
|
+
<div class="<%= @node.type %>">
|
347
|
+
<p class="title"><%= @node.title_link %></p>
|
348
|
+
<%= @node.content_xhtml_div %>
|
288
349
|
</div>
|
289
350
|
|
290
351
|
|
@@ -298,16 +359,9 @@ nodes:
|
|
298
359
|
index: false
|
299
360
|
number: true
|
300
361
|
output: |
|
301
|
-
<div<%= @node.
|
302
|
-
<p
|
303
|
-
<div class="content
|
304
|
-
$use_icons = true unless defined? $use_icons
|
305
|
-
|
306
|
-
if $use_icons and icon = ICONS[@node.type]
|
307
|
-
($icons_used ||= []) << icon
|
308
|
-
icon.css_class
|
309
|
-
end
|
310
|
-
%>"><%= @node.content_html %></div>
|
362
|
+
<div class="<%= @node.type %>">
|
363
|
+
<p class="title"><%= @node.number_and_title_link %></p>
|
364
|
+
<div class="content"><%= ICON_BY_NAME[@node.type].to_xhtml %><%= @node.content_xhtml %></div>
|
311
365
|
</div>
|
312
366
|
|
313
367
|
note: *admonition
|
@@ -329,7 +383,7 @@ nodes:
|
|
329
383
|
output: |
|
330
384
|
<div class="<%= @node.type %>">
|
331
385
|
<p class="title"><%= @node.number_and_title_link %></p>
|
332
|
-
<%= @node.
|
386
|
+
<%= @node.content_xhtml_div %>
|
333
387
|
</div>
|
334
388
|
|
335
389
|
table: *formal
|
@@ -366,16 +420,16 @@ nodes:
|
|
366
420
|
|
367
421
|
title_auto = @node.args.length < 2
|
368
422
|
|
369
|
-
|
423
|
+
title_xhtml =
|
370
424
|
if title_auto
|
371
425
|
title_text
|
372
426
|
else
|
373
427
|
@node.args[1].to_s
|
374
|
-
end.
|
428
|
+
end.to_inline_xhtml
|
375
429
|
|
376
430
|
%{<a class="#{@node.type}" href="##{target.here_frag}"#{
|
377
431
|
%( title="#{title_text}") unless title_auto
|
378
|
-
}>#{
|
432
|
+
}>#{title_xhtml}</a>}
|
379
433
|
else
|
380
434
|
raise ArgumentError, "invalid cross-reference to #{@node.title.inspect}", @node.trace
|
381
435
|
end
|
@@ -440,7 +494,7 @@ output: |
|
|
440
494
|
(n.index.to_s + ' ' if n.index),
|
441
495
|
n.list_frag,
|
442
496
|
n.here_frag,
|
443
|
-
n.title.to_s.
|
497
|
+
n.title.to_s.to_inline_xhtml
|
444
498
|
]
|
445
499
|
nested = n.children.inject('') {|s,c| s << toc_builder[c] }
|
446
500
|
|
@@ -466,7 +520,7 @@ output: |
|
|
466
520
|
|
467
521
|
lof = lof_enums.sort.map do |(type, nodes)|
|
468
522
|
nested = nodes.map do |n|
|
469
|
-
%{<li><a id="#{n.list_frag}" href="##{n.here_frag}">#{n.title.to_s.
|
523
|
+
%{<li><a id="#{n.list_frag}" href="##{n.here_frag}">#{n.title.to_s.to_inline_xhtml}</a></li>}
|
470
524
|
end
|
471
525
|
|
472
526
|
label = type.capitalize << 's' # TODO: pluralize this properly
|
@@ -475,76 +529,56 @@ output: |
|
|
475
529
|
%{<h2 id="#{label}" class="title"><a class="here" href="##{label}">#{label}</a></h2> <ol>#{nested}</ol>}
|
476
530
|
end
|
477
531
|
%>
|
532
|
+
<?xml version="1.0" encoding="utf-8"?>
|
478
533
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
479
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
|
534
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
|
535
|
+
<% ICONS.each do |icon| %>
|
536
|
+
<!ENTITY <%= icon.entity_name %> "<%= icon.data_uri %>">
|
537
|
+
<% end %>
|
538
|
+
]>
|
480
539
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
481
540
|
<head>
|
482
541
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
483
542
|
<meta name="date" content="<%= $date %>"/>
|
484
543
|
<meta name="author" content="<%= $authors.keys.join(', ') %>"/>
|
485
544
|
<meta name="generator" content="<%= ERBook::DISPLAY %>"/>
|
486
|
-
|
487
|
-
<link rel="alternate" type="application/<%= fmt %>+xml" href="<%= here_frag %>"/>
|
488
|
-
<% end if $feeds %>
|
489
|
-
<title><%= $title.to_s.to_inline_html %></title>
|
490
|
-
|
491
|
-
<% if $use_icons %>
|
492
|
-
<style type="text/css" media="screen">
|
493
|
-
blockquote {
|
494
|
-
background-image : <%= ICONS['quote'].css_image %>;
|
495
|
-
background-repeat : no-repeat;
|
496
|
-
padding-left : 65px;
|
497
|
-
min-height : 40px;
|
498
|
-
margin-left : 0;
|
499
|
-
}
|
500
|
-
</style>
|
501
|
-
<% end %>
|
545
|
+
<title><%= $title.to_s.to_inline_xhtml %></title>
|
502
546
|
|
503
|
-
<% if
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
background-repeat: no-repeat;
|
509
|
-
padding-left: 4em;
|
510
|
-
}
|
511
|
-
<% end %>
|
512
|
-
</style>
|
547
|
+
<% if $feeds %>
|
548
|
+
<% $feeds.each_pair do |url, fmt| %>
|
549
|
+
<link rel="alternate" type="application/<%= fmt %>+xml" href="<%= url %>"/>
|
550
|
+
<% end %>
|
551
|
+
<% end %>
|
513
552
|
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
<%
|
518
|
-
# we use list-style-image instead of
|
519
|
-
# background-image because the latter is
|
520
|
-
# neither printable nor shown in print
|
521
|
-
# preview by default in most browsers
|
522
|
-
#
|
523
|
-
# see http://www.web-graphics.com/mtarchive/001703.php
|
524
|
-
%>
|
525
|
-
display: list-item;
|
526
|
-
list-style-image: <%= icon.css_image %>;
|
527
|
-
list-style-position: inside;
|
528
|
-
}
|
529
|
-
|
530
|
-
.<%= icon.css_class %> li {
|
531
|
-
list-style-image: none;
|
532
|
-
}
|
533
|
-
<% end %>
|
553
|
+
<% @spec['styles'].each_pair do |media, style| %>
|
554
|
+
<style type="text/css" media="<%= media %>">
|
555
|
+
<![CDATA[<%= style %>]]>
|
534
556
|
</style>
|
535
557
|
<% end %>
|
536
558
|
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
559
|
+
<style type="text/css" media="screen">
|
560
|
+
<![CDATA[
|
561
|
+
/* decorate external hyperlinks with a visual indicator */
|
562
|
+
a:not([href^="#"])
|
563
|
+
{
|
564
|
+
color : #3366BB;
|
565
|
+
background : <%= ICON_BY_NAME['link'].data_css %>;
|
566
|
+
background-position : center right;
|
567
|
+
background-repeat : no-repeat;
|
568
|
+
padding-right : 13px;
|
569
|
+
}
|
570
|
+
|
571
|
+
/* display icon for blockquote elements */
|
572
|
+
blockquote
|
573
|
+
{
|
574
|
+
background-image : <%= ICON_BY_NAME['quote'].data_css %>;
|
575
|
+
background-repeat : no-repeat;
|
576
|
+
margin-left : 0;
|
577
|
+
padding-left : 65px;
|
578
|
+
min-height : 50px;
|
579
|
+
}
|
580
|
+
]]>
|
546
581
|
</style>
|
547
|
-
<% end %>
|
548
582
|
</head>
|
549
583
|
<body>
|
550
584
|
<%
|
@@ -578,11 +612,11 @@ output: |
|
|
578
612
|
<%= header.output %>
|
579
613
|
<% else %>
|
580
614
|
<%= $logo if defined? $logo %>
|
581
|
-
<h1 class="title"><%= $title.to_s.
|
615
|
+
<h1 class="title"><%= $title.to_s.to_inline_xhtml %></h1>
|
582
616
|
<h2 class="authors"><%=
|
583
|
-
$authors.map do |(name,
|
584
|
-
if
|
585
|
-
%{<a href="#{
|
617
|
+
$authors.map do |(name, url)|
|
618
|
+
if url
|
619
|
+
%{<a href="#{url}">#{name}</a>}
|
586
620
|
else
|
587
621
|
name
|
588
622
|
end
|
@@ -628,7 +662,7 @@ output: |
|
|
628
662
|
<h1 class="title" id="References"><a class="here" href="#References">References</a></h1>
|
629
663
|
<ol>
|
630
664
|
<% references.each do |n| %>
|
631
|
-
<li id="<%= n.here_frag %>"><%= n.
|
665
|
+
<li id="<%= n.here_frag %>"><%= n.content_xhtml %></li>
|
632
666
|
<% end %>
|
633
667
|
</ol>
|
634
668
|
</div>
|
@@ -642,16 +676,32 @@ output: |
|
|
642
676
|
<div id="footer">
|
643
677
|
<%= node = @types['footer_inside_above'].first and node.output %>
|
644
678
|
<% if footer = @types['footer'].first %>
|
645
|
-
<%= footer.content.to_s.
|
679
|
+
<%= footer.content.to_s.to_xhtml %>
|
646
680
|
<% else %>
|
647
681
|
Generated by <a href="<%= ERBook::WEBSITE %>"><%= ERBook::DISPLAY %></a> on <%= Time.now %>.
|
648
682
|
<% end %>
|
649
683
|
|
650
|
-
|
651
|
-
<
|
652
|
-
|
653
|
-
|
654
|
-
|
684
|
+
<div id="footer-credits">
|
685
|
+
<p>
|
686
|
+
<% ICONS.select {|i| i.origin == 'tango' }.each do |icon| %>
|
687
|
+
<%= icon.to_xhtml %>
|
688
|
+
<% end %>
|
689
|
+
|
690
|
+
<br/>
|
691
|
+
|
692
|
+
The icons shown above are © 2005 <a href="http://tango.freedesktop.org">Tango Desktop Project</a>. They are part of the <a href="http://tango.freedesktop.org/Tango_Icon_Library">Tango Icon Theme</a> set, which is distributed under the <a href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License Agreement</a>.
|
693
|
+
</p>
|
694
|
+
|
695
|
+
<p>
|
696
|
+
<% ICONS.select {|i| i.origin == 'mediawiki' }.each do |icon| %>
|
697
|
+
<%= icon.to_xhtml %>
|
698
|
+
<% end %>
|
699
|
+
|
700
|
+
<br/>
|
701
|
+
|
702
|
+
The icons shown above are © 2007 <a href="https://www.ohloh.net/projects/mediawiki/contributors">MediaWiki contributors</a>. They are part of the <a href="http://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a> software, which is distributed under the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, version 2</a>.
|
703
|
+
</p>
|
704
|
+
</div>
|
655
705
|
<%= node = @types['footer_inside_below'].first and node.output %>
|
656
706
|
</div>
|
657
707
|
<%= node = @types['footer_outside_below'].first and node.output %>
|
@@ -659,7 +709,7 @@ output: |
|
|
659
709
|
</html>
|
660
710
|
|
661
711
|
styles:
|
662
|
-
|
712
|
+
all: |
|
663
713
|
body
|
664
714
|
{
|
665
715
|
color : #000000;
|
@@ -672,8 +722,8 @@ styles:
|
|
672
722
|
|
673
723
|
blockquote
|
674
724
|
{
|
675
|
-
|
676
|
-
|
725
|
+
color : #333;
|
726
|
+
font-style : italic;
|
677
727
|
}
|
678
728
|
|
679
729
|
em
|
@@ -890,7 +940,7 @@ styles:
|
|
890
940
|
|
891
941
|
#footer-credits
|
892
942
|
{
|
893
|
-
margin-top :
|
943
|
+
margin-top : 2em;
|
894
944
|
margin-bottom : 2em;
|
895
945
|
}
|
896
946
|
|
@@ -964,21 +1014,35 @@ styles:
|
|
964
1014
|
margin : 3em;
|
965
1015
|
}
|
966
1016
|
|
967
|
-
.tip > .
|
968
|
-
.note > .
|
969
|
-
.caution > .
|
970
|
-
.warning > .
|
971
|
-
.important > .
|
1017
|
+
.tip > .content,
|
1018
|
+
.note > .content,
|
1019
|
+
.caution > .content,
|
1020
|
+
.warning > .content,
|
1021
|
+
.important > .content,
|
1022
|
+
.figure > .content,
|
1023
|
+
.table > .content,
|
1024
|
+
.example > .content,
|
1025
|
+
.equation > .content,
|
1026
|
+
.procedure > .content
|
1027
|
+
{
|
1028
|
+
min-height : 48px; /* 48px is height of icon */
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
.tip > .content > .icon,
|
1032
|
+
.note > .content > .icon,
|
1033
|
+
.caution > .content > .icon,
|
1034
|
+
.warning > .content > .icon,
|
1035
|
+
.important > .content > .icon
|
972
1036
|
{
|
973
1037
|
float : left;
|
974
1038
|
margin : 0 1em 1em 0; /* top right bottom left */
|
975
1039
|
}
|
976
1040
|
|
977
|
-
.tip .icon,
|
978
|
-
.note .icon,
|
979
|
-
.caution .icon,
|
980
|
-
.warning .icon,
|
981
|
-
.important .icon
|
1041
|
+
.tip .content .icon,
|
1042
|
+
.note .content .icon,
|
1043
|
+
.caution .content .icon,
|
1044
|
+
.warning .content .icon,
|
1045
|
+
.important .content .icon
|
982
1046
|
{
|
983
1047
|
_display : none; /* IE6 cannot display embedded images */
|
984
1048
|
}
|
@@ -1008,9 +1072,9 @@ styles:
|
|
1008
1072
|
screen: |
|
1009
1073
|
body
|
1010
1074
|
{
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1075
|
+
margin : auto;
|
1076
|
+
max-width : 36em;
|
1077
|
+
padding : 0.5em;
|
1014
1078
|
}
|
1015
1079
|
|
1016
1080
|
/* source code */
|
@@ -1051,18 +1115,12 @@ styles:
|
|
1051
1115
|
|
1052
1116
|
a:link
|
1053
1117
|
{
|
1054
|
-
color : #
|
1118
|
+
color : #002BB8;
|
1055
1119
|
}
|
1056
1120
|
|
1057
1121
|
a:visited
|
1058
1122
|
{
|
1059
|
-
color : #
|
1060
|
-
}
|
1061
|
-
|
1062
|
-
/* external hyperlinks */
|
1063
|
-
a:not([href^="#"]):before
|
1064
|
-
{
|
1065
|
-
content : "\2660"; /* ♠ */
|
1123
|
+
color : #5A3696;
|
1066
1124
|
}
|
1067
1125
|
|
1068
1126
|
a.here,
|