deplate 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/AUTHORS.TXT +26 -0
  2. data/CHANGES.TXT +177 -0
  3. data/LICENSE.TXT +340 -0
  4. data/NEWS.TXT +29 -0
  5. data/README.TXT +86 -0
  6. data/TODO.TXT +202 -0
  7. data/VERSION.TXT +1 -0
  8. data/bin/deplate +3 -0
  9. data/bin/deplate.bat +2 -0
  10. data/etc/deplate.ini +361 -0
  11. data/lib/deplate.rb +31 -0
  12. data/lib/deplate/abstract-class.rb +30 -0
  13. data/lib/deplate/builtin.rb +11 -0
  14. data/lib/deplate/cache.rb +59 -0
  15. data/lib/deplate/commands.rb +693 -0
  16. data/lib/deplate/common.rb +335 -0
  17. data/lib/deplate/converter.rb +99 -0
  18. data/lib/deplate/core.rb +2705 -0
  19. data/lib/deplate/css/article.css +545 -0
  20. data/lib/deplate/css/deplate.css +699 -0
  21. data/lib/deplate/css/heading-navbar.css +29 -0
  22. data/lib/deplate/css/layout-deplate-print.css +540 -0
  23. data/lib/deplate/css/layout-deplate.css +764 -0
  24. data/lib/deplate/css/sans-serif.css +160 -0
  25. data/lib/deplate/css/serif-e.css +170 -0
  26. data/lib/deplate/css/serif-rel.css +121 -0
  27. data/lib/deplate/css/serif.css +190 -0
  28. data/lib/deplate/css/slides.css +11 -0
  29. data/lib/deplate/css/tabbar-left.css +91 -0
  30. data/lib/deplate/css/tabbar-right-ie.css +14 -0
  31. data/lib/deplate/css/tabbar-right.css +118 -0
  32. data/lib/deplate/css/tabbar-top.css +64 -0
  33. data/lib/deplate/css/tabbar.css +81 -0
  34. data/lib/deplate/css/text-sans-serif.css +154 -0
  35. data/lib/deplate/css/text-serif.css +175 -0
  36. data/lib/deplate/define.rb +439 -0
  37. data/lib/deplate/docbook.rb +738 -0
  38. data/lib/deplate/elements.rb +1355 -0
  39. data/lib/deplate/etc.rb +199 -0
  40. data/lib/deplate/external.rb +135 -0
  41. data/lib/deplate/fmt/dbk-article-4.1.2.rb +21 -0
  42. data/lib/deplate/fmt/dbk-article.rb +46 -0
  43. data/lib/deplate/fmt/dbk-book.rb +46 -0
  44. data/lib/deplate/fmt/dbk-ref.rb +105 -0
  45. data/lib/deplate/fmt/dbk-slides.rb +47 -0
  46. data/lib/deplate/fmt/dbk-snippet.rb +21 -0
  47. data/lib/deplate/fmt/html-snippet.rb +21 -0
  48. data/lib/deplate/fmt/html.rb +1696 -0
  49. data/lib/deplate/fmt/htmlsite.rb +419 -0
  50. data/lib/deplate/fmt/htmlslides.rb +21 -0
  51. data/lib/deplate/fmt/htmlwebsite.rb +70 -0
  52. data/lib/deplate/fmt/latex-snippet.rb +22 -0
  53. data/lib/deplate/fmt/latex.rb +1242 -0
  54. data/lib/deplate/fmt/php.rb +19 -0
  55. data/lib/deplate/fmt/phpsite.rb +19 -0
  56. data/lib/deplate/fmt/plain.rb +598 -0
  57. data/lib/deplate/fmt/template.rb +34 -0
  58. data/lib/deplate/fmt/xhtml10t.rb +41 -0
  59. data/lib/deplate/formatter-snippet.rb +17 -0
  60. data/lib/deplate/formatter.rb +1210 -0
  61. data/lib/deplate/input.rb +492 -0
  62. data/lib/deplate/input/deplate-headings.rb +48 -0
  63. data/lib/deplate/input/deplate-restricted.rb +70 -0
  64. data/lib/deplate/input/deplate.rb +28 -0
  65. data/lib/deplate/input/rdoc.rb +277 -0
  66. data/lib/deplate/input/template.rb +29 -0
  67. data/lib/deplate/lib/latex/highlight-extra.sty +15 -0
  68. data/lib/deplate/lib/latex/highlight-typical.sty +15 -0
  69. data/lib/deplate/lib/tabmenu.js +146 -0
  70. data/lib/deplate/locale/de.latin1 +708 -0
  71. data/lib/deplate/locale/ru.koi8-r +48 -0
  72. data/lib/deplate/locale/zh_cn.gb2312 +35 -0
  73. data/lib/deplate/macros.rb +639 -0
  74. data/lib/deplate/messages.rb +120 -0
  75. data/lib/deplate/metadata.rb +77 -0
  76. data/lib/deplate/metadata/marshal.rb +24 -0
  77. data/lib/deplate/metadata/xml.rb +42 -0
  78. data/lib/deplate/metadata/yaml.rb +26 -0
  79. data/lib/deplate/mod/anyword.rb +56 -0
  80. data/lib/deplate/mod/babelfish.rb +27 -0
  81. data/lib/deplate/mod/code-gvim.rb +52 -0
  82. data/lib/deplate/mod/code-highlight.rb +91 -0
  83. data/lib/deplate/mod/colored-log.rb +17 -0
  84. data/lib/deplate/mod/de.rb +19 -0
  85. data/lib/deplate/mod/en.rb +17 -0
  86. data/lib/deplate/mod/endnotes.rb +60 -0
  87. data/lib/deplate/mod/fr.rb +46 -0
  88. data/lib/deplate/mod/html-asciimath.rb +40 -0
  89. data/lib/deplate/mod/html-deplate-button.rb +15 -0
  90. data/lib/deplate/mod/html-headings-navbar.rb +39 -0
  91. data/lib/deplate/mod/html-obfuscate-email.rb +47 -0
  92. data/lib/deplate/mod/html-sidebar.rb +232 -0
  93. data/lib/deplate/mod/htmlslides-navbar-fh.rb +32 -0
  94. data/lib/deplate/mod/iconv.rb +35 -0
  95. data/lib/deplate/mod/imgurl.rb +30 -0
  96. data/lib/deplate/mod/inlatex-compound.rb +69 -0
  97. data/lib/deplate/mod/koma.rb +109 -0
  98. data/lib/deplate/mod/latex-emph-table-head.rb +38 -0
  99. data/lib/deplate/mod/latex-styles.rb +461 -0
  100. data/lib/deplate/mod/latex-verbatim-small.rb +29 -0
  101. data/lib/deplate/mod/makefile.rb +194 -0
  102. data/lib/deplate/mod/mark-external-urls.rb +38 -0
  103. data/lib/deplate/mod/markup-1-warn.rb +37 -0
  104. data/lib/deplate/mod/markup-1.rb +41 -0
  105. data/lib/deplate/mod/navbar-png.rb +33 -0
  106. data/lib/deplate/mod/noindent.rb +32 -0
  107. data/lib/deplate/mod/numpara.rb +40 -0
  108. data/lib/deplate/mod/particle-math.rb +34 -0
  109. data/lib/deplate/mod/php-extra.rb +44 -0
  110. data/lib/deplate/mod/pstoedit.rb +71 -0
  111. data/lib/deplate/mod/recode.rb +57 -0
  112. data/lib/deplate/mod/ru_koi8-r.rb +20 -0
  113. data/lib/deplate/mod/smiley.rb +50 -0
  114. data/lib/deplate/mod/soffice.rb +23 -0
  115. data/lib/deplate/mod/symbols-latin1.rb +58 -0
  116. data/lib/deplate/mod/symbols-od-utf-8.rb +16 -0
  117. data/lib/deplate/mod/symbols-plain.rb +58 -0
  118. data/lib/deplate/mod/symbols-sgml.rb +97 -0
  119. data/lib/deplate/mod/symbols-utf-8.rb +81 -0
  120. data/lib/deplate/mod/symbols-xml.rb +34 -0
  121. data/lib/deplate/mod/syntax-region-alt.rb +37 -0
  122. data/lib/deplate/mod/utf8.rb +49 -0
  123. data/lib/deplate/mod/validate-html.rb +35 -0
  124. data/lib/deplate/mod/xmlrpc.rb +233 -0
  125. data/lib/deplate/mod/zh-cn-autospace.rb +108 -0
  126. data/lib/deplate/mod/zh-cn.rb +59 -0
  127. data/lib/deplate/once-method.rb +44 -0
  128. data/lib/deplate/output.rb +249 -0
  129. data/lib/deplate/particles.rb +815 -0
  130. data/lib/deplate/regions.rb +1076 -0
  131. data/lib/deplate/structured.rb +763 -0
  132. data/lib/deplate/template.rb +430 -0
  133. data/lib/deplate/templates/html-doc.html +28 -0
  134. data/lib/deplate/templates/html-left-tabbar-js.html +37 -0
  135. data/lib/deplate/templates/html-left-tabbar.html +31 -0
  136. data/lib/deplate/templates/html-tabbar-right-table.html +43 -0
  137. data/lib/deplate/templates/html-tabbar-right.html +23 -0
  138. data/lib/deplate/templates/html-tabbar-top.html +43 -0
  139. data/lib/deplate/templates/html-tabbar.html +31 -0
  140. data/lib/deplate/wiki-markup.rb +117 -0
  141. data/lib/deplate/xml.rb +109 -0
  142. data/lib/deplate/zh-cn.rb +59 -0
  143. data/lib/ps2ppm.rb +239 -0
  144. data/man/man1/deplate.1 +692 -0
  145. metadata +210 -0
@@ -0,0 +1,419 @@
1
+ # htmlsite.rb
2
+ # @Author: Thomas Link (samul AT web.de)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 17-M�r-2004.
6
+ # @Last Change: 01-Nov-2005.
7
+ # @Revision: 0.910
8
+
9
+ require "deplate/fmt/html"
10
+
11
+ # A variant of the html-formatter that suppresses paragraphs and creates new
12
+ # files on page breaks and level-1 headings.
13
+ #
14
+ # Press a-n or double-click on a heading to jump to the next slide. Press a-b
15
+ # to jump to the previous one.
16
+ #
17
+
18
+ class Deplate::Formatter::HTML_Site < Deplate::Formatter::HTML
19
+ self.myname = "htmlsite"
20
+ self.rx = /html?|htmlwebsite/i
21
+
22
+ def hook_pre_body_flush_html_pager
23
+ title = @deplate.get_clip("title")
24
+ title = title.elt if title
25
+ top = @deplate.output.top_heading
26
+ if top
27
+ top_title = top.description
28
+ if top_title
29
+ title = clean_tags([title, top_title].compact.join(" -- "))
30
+ set_at(:pre, :head_title, %{<title>%s</title>} % title) unless title.empty?
31
+ end
32
+ end
33
+
34
+ invoker = nil
35
+ navbar = @deplate.variables["docNavbar"]
36
+ if navbar
37
+ case navbar
38
+ when "top"
39
+ format_navigation_bar(invoker, :body, :navbar_top, :top)
40
+ when "bottom"
41
+ format_navigation_bar(invoker, :body, :navbar_bottom, :bottom)
42
+ else
43
+ format_navigation_bar(invoker, :body, :navbar_top, :top)
44
+ format_navigation_bar(invoker, :body, :navbar_bottom, :bottom)
45
+ end
46
+ end
47
+
48
+ set_relation(:htmlsite_prev, "Prev", "previous")
49
+ set_relation(:htmlsite_next, "Next", "next")
50
+ set_relation(:htmlsite_up, "Home", "up") if @variables["@idx"].to_i > 0
51
+ end
52
+
53
+ def set_relation(slot, service_infix, tag)
54
+ url = @deplate.invoke_service("page#{service_infix}Dest")
55
+ if url
56
+ title = @deplate.invoke_service("page#{service_infix}Title") || tag
57
+ title = clean_tags(title)
58
+ set_at(:pre, slot, head_link_tag(%{rel="#{tag}" href="#{url}" title="#{title}"}))
59
+ end
60
+ end
61
+
62
+ def setup
63
+ @deplate.options.multi_file_output = true if @deplate.options.multi_file_output.nil?
64
+ super
65
+ end
66
+
67
+ # for web sites, a pagebreak means navigation bars + a new file
68
+ def format_pagebreak(invoker, html_class=nil, major=false)
69
+ if major
70
+ invoker.postponed_format << lambda {|e| @deplate.break_output}
71
+ unless @deplate.body_empty?
72
+ return format_label(invoker, :closeOpen)
73
+ end
74
+ return nil
75
+ else
76
+ return super
77
+ end
78
+ end
79
+
80
+ end
81
+
82
+ class Deplate::Core
83
+ def formatter_initialize_htmlsite
84
+ @max_headings = nil
85
+ @doc_services["tabBarNote"] = :htmlsite_tabBarNote
86
+ @doc_services["tabBarLeft"] = :htmlsite_tabBarLeft
87
+ @doc_services["tabBarRight"] = :htmlsite_tabBarRight
88
+ @doc_services["tabBarTop"] = :htmlsite_tabBarTop
89
+ @doc_services["tabBarBottom"] = :htmlsite_tabBarBottom
90
+ @doc_services["progressPercent"] = :htmlsite_progressPercent
91
+ @doc_services["progressPages"] = :htmlsite_progressPages
92
+ @doc_services["progressFirst"] = :htmlsite_progressFirst
93
+ @doc_services["progressLast"] = :htmlsite_progressLast
94
+ @doc_services["progressBar"] = :htmlsite_progressBar
95
+ @doc_services["progressBarHorizontal"] = :htmlsite_progressBarHorizontal
96
+ @doc_services["progressBarVertical"] = :htmlsite_progressBarVertical
97
+ @doc_services["pageNextDest"] = :htmlsite_pageNextDest
98
+ @doc_services["pageNextTitle"] = :htmlsite_pageNextTitle
99
+ @doc_services["pagePrevDest"] = :htmlsite_pagePrevDest
100
+ @doc_services["pagePrevTitle"] = :htmlsite_pagePrevTitle
101
+ @doc_services["pageHomeDest"] = :htmlsite_pageHomeDest
102
+ @doc_services["pageHomeTitle"] = :htmlsite_pageHomeTitle
103
+ # @doc_services["<+TBD+>"] = :htmlsite_<+TBD+>
104
+ end
105
+
106
+ # def htmlsite_<+TBD+>
107
+ # end
108
+
109
+ def htmlsite_tabBarNote(args, text)
110
+ unless defined?(@htmlsite_sliding_tabbar_note)
111
+ @htmlsite_sliding_tabbar_note = msg(:htmlsite_tabbar_note)
112
+ # @htmlsite_sliding_tabbar_note ||= <<-EON
113
+ # <p class="htmlnavigationnote" />In order to pin down the sliding menu, click on the
114
+ # small square on the top left.</p>
115
+ # EON
116
+ end
117
+ return @htmlsite_sliding_tabbar_note
118
+ end
119
+
120
+ def htmlsite_tabBarLeft(args, text)
121
+ htmlsite_tabBar(args, text, "tabBarLeft", false)
122
+ end
123
+
124
+ def htmlsite_tabBarRight(args, text)
125
+ htmlsite_tabBar(args, text, "tabBarRight", false)
126
+ end
127
+
128
+ def htmlsite_tabBarTop(args, text)
129
+ htmlsite_tabBar(args, text, "tabBarTop", true)
130
+ end
131
+
132
+ def htmlsite_tabBarBottom(args, text)
133
+ htmlsite_tabBar(args, text, "tabBarBottom", true)
134
+ end
135
+
136
+ def htmlsite_tabBar(args, text, style, horizontal)
137
+ if horizontal
138
+ tagsl0 = "table"
139
+ tagsl1 = ["tr"]
140
+ tagsl2 = ["td"]
141
+ # tagsl1 = []
142
+ # tagsl2 = ["span"]
143
+ width = args["width"] || "100%"
144
+ heigth = args["heigth"] || "20px"
145
+ else
146
+ tagsl0 = "table"
147
+ tagsl1 = []
148
+ tagsl2 = ["tr", "td"]
149
+ width = args["width"] || "140px"
150
+ heigth = args["heigth"]
151
+ end
152
+
153
+ curr = @variables["@idx"]
154
+ idx = curr.to_i
155
+ type = @variables["navBarType"] || :top
156
+ urlp, prv = @formatter.navbar_button_prev(nil, nil, idx, type, idx > 0)
157
+ url, home = @formatter.navbar_button_home(nil, nil, idx, type, idx > 0)
158
+ urln, nxt = @formatter.navbar_button_next(nil, nil, idx, type, idx < top_heading_idx)
159
+
160
+ tabbar = []
161
+ tabbar << html_navigation_keys({"next" => urln}, "") if args["nextKey"]
162
+ # tabbar << %{<#{tagsl0} width="#{width}" class="#{style}" summary="Navigation bar">} if tagsl0
163
+ tabbar << %{<#{tagsl0} class="#{style}" summary="Navigation bar">} if tagsl0
164
+ tabbar << htmlsite_tabBar_accum_tags(tagsl1, style, true)
165
+
166
+ if !@variables["noTabBarButtons"]
167
+ s = "#{style}Buttons"
168
+ o = htmlsite_tabBar_accum_tags(tagsl2, s, true)
169
+ c = htmlsite_tabBar_accum_tags(tagsl2, s, false)
170
+ if @variables["tabBarButtons"]
171
+ buttons = []
172
+ for b in @variables["tabBarButtons"].split(/[ ,;]/)
173
+ case b
174
+ when "home", "h"
175
+ buttons << home
176
+ when "next", "n"
177
+ buttons << nxt
178
+ when "prev", "previous", "p"
179
+ buttons << prv
180
+ end
181
+ end
182
+ else
183
+ buttons = [prv, home, nxt]
184
+ end
185
+ buttons.compact!
186
+ buttons.delete(%{&nbsp;})
187
+ tabbar << [o, buttons.join(%{&nbsp;}), c].join
188
+ end
189
+
190
+ depth = args["depth"]
191
+ depth = depth ? depth.to_i : 1
192
+ inactivedepth = args["depthInactive"]
193
+ inactivedepth = inactivedepth ? inactivedepth.to_i : depth
194
+
195
+ tabbarsep = @variables["tabBarSep"] || "|"
196
+ tabbarsep = /\s*#{Regexp.escape(tabbarsep)}\s*/
197
+ tabbarextra = @variables["tabBar"] || ["[auto]"]
198
+ tabbarextra = tabbarextra.split(/\n/) if tabbarextra.kind_of?(String)
199
+ if @variables["tabEqualWidths"] || @variables["equalTabs"]
200
+ tabsize = top_heading_idx + tabbarextra.size
201
+ tabsize = 100 / tabsize
202
+ tabsize = %{ #{horizontal ? "width" : "heigth"}="#{tabsize}%"}
203
+ else
204
+ tabsize = nil
205
+ end
206
+ for e in tabbarextra
207
+ if e == "[auto]"
208
+ tabbar_auto_entries(tabbar, idx, style, depth, inactivedepth, tagsl2, tabsize)
209
+ else
210
+ title, url = e.split(tabbarsep)
211
+ html = %{<a class="tabBarEntry" href="#{url}">#{title}</a>}
212
+ tabbar << tabbar_entry(html, tagsl2, "#{style}Inactive", tabsize)
213
+ end
214
+ end
215
+
216
+ if args["spacer"]
217
+ if horizontal
218
+ spacer = %{<img width="1px" height="#{height}" src="%s" alt="" />} % args["spacer"]
219
+ else
220
+ spacer = %{<img width="#{width}" height="1px" src="%s" alt="" />} % args["spacer"]
221
+ end
222
+ else
223
+ spacer = nil
224
+ end
225
+
226
+ if args["progressBar"]
227
+ if horizontal
228
+ pb = invoke_service("progressBarVertical")
229
+ else
230
+ pb = invoke_service("progressBarHorizontal")
231
+ end
232
+ s = "#{style}Buttons"
233
+ o = htmlsite_tabBar_accum_tags(tagsl2, s, true)
234
+ c = htmlsite_tabBar_accum_tags(tagsl2, s, false)
235
+ i = invoke_service("progressPercent")
236
+ tabbar << [o, spacer, pb, i, c].compact.join
237
+ end
238
+
239
+ tabbar << htmlsite_tabBar_accum_tags(tagsl1, style, false)
240
+ tabbar << %{</#{tagsl0}>} if tagsl0
241
+ return tabbar.compact.join("\n")
242
+ end
243
+
244
+ def htmlsite_progressBar(args, text)
245
+ horizontal = !args["vertical"]
246
+ htmlsite_progress_bar(args, horizontal)
247
+ end
248
+
249
+ def htmlsite_progressBarHorizontal(args, text)
250
+ htmlsite_progress_bar(args, true)
251
+ end
252
+
253
+ def htmlsite_progressBarVertical(args, text)
254
+ htmlsite_progress_bar(args, false)
255
+ end
256
+
257
+ def htmlsite_progress_bar(args, horizontal)
258
+ idx = @variables["@idx"].to_i
259
+ percent = 100 * idx / top_heading_idx
260
+ anti = 100 - percent
261
+ all = percent + anti
262
+ if all != 100
263
+ anti += 100 - all
264
+ end
265
+ height = args["h"] || args["height"] || (horizontal ? "10pt" : "100pt")
266
+ width = args["w"] || args["width"] || (horizontal ? "100pt" : "10pt")
267
+ pb = []
268
+ # pb << %{<div class="progressBar">}
269
+ pb << %{<table align="center" class="progressBar" width="#{width}" style="height:#{height}">}
270
+ if horizontal
271
+ pb << %{<tr>}
272
+ pb << %{<td class="progressBarDone" width="#{percent}%" style="height:100%"></td>} unless percent == 0
273
+ pb << %{<td class="progressBarToBeDone" width="#{100 - percent}%" style="height:100%"></td>} unless percent == 100
274
+ pb << %{</tr>}
275
+ else
276
+ pb << %{<tr class="progressBarDone" width="100%" style="height:#{percent}%"></tr>} unless percent == 0
277
+ pb << %{<tr class="progressBarToBeDone" width="100%" style="height:#{100 - percent}%"></tr>} unless percent == 100
278
+ end
279
+ pb << %{</table>}
280
+ # pb << %{</div>}
281
+ return pb.join
282
+ end
283
+
284
+ def htmlsite_progressPercent(args, text)
285
+ idx = @variables["@idx"].to_i
286
+ percent = 100 * idx / top_heading_idx
287
+ return %{<span class="progress">#{percent}%</span>}
288
+ end
289
+
290
+ def htmlsite_progressPages(args, text)
291
+ idx = @variables["@idx"].to_i
292
+ max = top_heading_idx
293
+ return %{<span class="progress">#{idx}/#{max}</span>}
294
+ end
295
+
296
+ def htmlsite_progressFirst(args, text)
297
+ idx = @variables["@idx"].to_i
298
+ idx == 0 ? "1" : "0"
299
+ end
300
+
301
+ def htmlsite_progressLast(args, text)
302
+ idx = @variables["@idx"].to_i
303
+ max = top_heading_idx
304
+ idx == max ? "1" : "0"
305
+ end
306
+
307
+ def htmlsite_pageNextDest(args, text)
308
+ hd = delta_heading(1)
309
+ pagedest_relpath(hd)
310
+ end
311
+
312
+ def htmlsite_pageNextTitle(args, text)
313
+ hd = delta_heading(1)
314
+ pagedest_relpath(hd)
315
+ end
316
+
317
+ def htmlsite_pagePrevDest(args, text)
318
+ hd = delta_heading(-1)
319
+ pagedest_relpath(hd)
320
+ end
321
+
322
+ def htmlsite_pagePrevTitle(args, text)
323
+ hd = delta_heading(-1)
324
+ hd && hd.description
325
+ end
326
+
327
+ def htmlsite_pageHomeDest(args, text)
328
+ hd = top_heading_by_idx(0)
329
+ pagedest_relpath(hd)
330
+ end
331
+
332
+ def htmlsite_pageHomeTitle(args, text)
333
+ hd = top_heading_by_idx(0)
334
+ (hd && hd.description) || msg("Frontpage")
335
+ end
336
+
337
+ def delta_heading(delta)
338
+ idx = @variables["@idx"]
339
+ if idx
340
+ idx = idx.to_i + delta + 1
341
+ if idx >= 0
342
+ rv = top_heading_by_idx(idx)
343
+ return rv
344
+ end
345
+ end
346
+ return nil
347
+ end
348
+
349
+ private
350
+ def pagedest_relpath(hd)
351
+ if hd
352
+ idx = @variables["@idx"].to_i
353
+ curr = top_heading_by_idx(idx)
354
+ return relative_path(hd.output_location, File.dirname(curr.output_location))
355
+ end
356
+ end
357
+
358
+ def tabbar_auto_entries(tabbar, idx, style, depth, inactivedepth, tags, tabsize)
359
+ if @variables["tabBarHomeName"]
360
+ s = idx == 0 ? "#{style}Active" : "#{style}Inactive"
361
+ title = @variables["tabBarHomeName"]
362
+ file = @formatter.navbar_guess_file_name(0, idx, :navbar)
363
+ tabbar << tabbar_entry(%{<a class="tabBarEntry" href="#{file}">#{title}</a>}, tags, s, tabsize)
364
+ end
365
+
366
+ each_heading(depth) do |hd, title|
367
+ lstr = hd.level_as_string
368
+ lnr = hd.top_heading_idx
369
+ file = hd.output_file_name(:basename => true)
370
+ if hd.level > 1
371
+ anchor = hd.args[:id] || hd.label.first
372
+ if anchor
373
+ file = [file, "#", anchor].join
374
+ end
375
+ end
376
+
377
+ if top_heading_by_idx(idx) == hd.top_heading
378
+ s = "#{style}Active"
379
+ else
380
+ s = "#{style}Inactive"
381
+ if hd.level > inactivedepth
382
+ next
383
+ end
384
+ end
385
+
386
+ tabbar << tabbar_entry(%{<a class="tabBarEntry" href="#{file}">#{title}</a>}, tags, s, tabsize)
387
+ end
388
+ end
389
+
390
+ def tabbar_entry(html, tags, html_class, tabsize)
391
+ o = htmlsite_tabBar_accum_tags(tags, html_class, true, tabsize)
392
+ c = htmlsite_tabBar_accum_tags(tags, html_class, false, tabsize)
393
+ [o, html, c].join
394
+ end
395
+
396
+ def htmlsite_tabBar_accum_tags(tags, htmlClass, open_tags, extra=nil)
397
+ acc = []
398
+ unless open_tags
399
+ tags = tags.reverse
400
+ end
401
+ for t in tags
402
+ if t
403
+ if open_tags
404
+ t = %{<#{t}#{extra} class="#{htmlClass}">}
405
+ else
406
+ t = %{</#{t}>}
407
+ end
408
+ acc << t
409
+ end
410
+ end
411
+ if acc.empty?
412
+ return nil
413
+ else
414
+ return acc.join
415
+ end
416
+ end
417
+ end
418
+
419
+ # vim: ff=unix
@@ -0,0 +1,21 @@
1
+ # fmt-html.rb
2
+ # @Author: Thomas Link (samul AT web.de)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 17-M�r-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.809
8
+
9
+ require "deplate/fmt/htmlsite"
10
+
11
+ # This is html-site with the paragraph swallowing.
12
+ class Deplate::Formatter::HTML_Slides < Deplate::Formatter::HTML_Site
13
+ self.myname = "htmlslides"
14
+ self.rx = /html?|htmlslides/i
15
+
16
+ alias :format_paragraph_html :format_paragraph
17
+ def format_paragraph(invoker)
18
+ super if invoker.args["noSwallow"] or @deplate.variables["noSwallow"]
19
+ end
20
+ end
21
+
@@ -0,0 +1,70 @@
1
+ # fmt-html.rb
2
+ # @Author: Thomas Link (samul AT web.de)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 17-M�r-2004.
6
+ # @Last Change: 23-Okt-2005.
7
+ # @Revision: 0.441
8
+
9
+ require "deplate/fmt/htmlslides"
10
+
11
+ # A variant of the html-formatter that generates website to please
12
+ # Fritz Heinrichmeyer
13
+
14
+ class Deplate::Formatter::HTML_Website < Deplate::Formatter::HTML_Slides
15
+ self.myname = "htmlwebsite"
16
+ self.rx = /html?|htmlslides|htmlwebsite/i
17
+
18
+ def hook_pre_body_flush_html_pager
19
+ # invoker = @deplate.accum_elements.last
20
+ invoker = nil
21
+ format_navigation_bar(invoker, :body, :navbar_top, :top)
22
+ end
23
+
24
+ def setup
25
+ super
26
+ @deplate.variables["headings"] = "plain"
27
+ end
28
+
29
+ def prepare
30
+ super
31
+ metaextra = @deplate.get_clip("metaextra")
32
+ output_at(:pre, :head_beg, %{#{metaextra.elt if metaextra}})
33
+ explorerhack=<<EOF
34
+ <style type="text/css">
35
+ @import url(./no_ns.css);
36
+ </style>
37
+ <!--[if gte IE 5]>
38
+ <link href="./ie5.css" rel="stylesheet" type="text/css">
39
+ <![endif]-->
40
+ <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
41
+ <link rel="icon" href="./favicon.ico" type="image/x-icon" />
42
+ EOF
43
+ output_at(:pre, :head_end, explorerhack)
44
+ end
45
+
46
+ def format_navigation_bar(invoker, type, slot, bartype, first=false, last=false)
47
+ idx, _, _ = navbar_output_index(invoker, first, last)
48
+ navextra = @deplate.get_clip("navextra")
49
+ navmenu = [%{<span class="navmenuhead">#{navextra.elt if navextra}</span>} ]
50
+ @deplate.each_heading(1) do |section, title|
51
+ unless section.args["noList"]
52
+ f = section.output_file_name(:basename => true)
53
+ v = section.description.gsub(/<\/?[^>]*>/, "")
54
+ end
55
+ if @deplate.top_heading_idx(section.top_heading) != idx
56
+ navmenu << %{<a class="navbar" href="#{f}">#{v}</a>}
57
+ else
58
+ set_at(:pre, :head_title, %{<title>#{v}</title>})
59
+ navmenu << %{<span class="navbartds">#{v}</span>}
60
+ end
61
+ end
62
+ @deplate.options.navmenu = navmenu.join("\n")
63
+
64
+ output_at(:body, slot, %{<div id="navigation">#{@deplate.options.navmenu}</div> <div id="contentframe"> <div id="innercontentframe"> <div id="content">})
65
+ output_at(:body, :navbar_bottom, %{<br> </div> </div> </div>})
66
+ end
67
+
68
+ alias :format_paragraph :format_paragraph_html
69
+ end
70
+