deplate 0.7.3 → 0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. data/AUTHORS.TXT +3 -0
  2. data/CHANGES.TXT +248 -175
  3. data/LICENSE.TXT +0 -0
  4. data/NEWS.TXT +28 -24
  5. data/README.TXT +0 -0
  6. data/TODO.TXT +174 -88
  7. data/VERSION.TXT +1 -1
  8. data/bin/deplate +0 -0
  9. data/bin/deplate.bat +0 -0
  10. data/etc/deplate.ini +91 -3
  11. data/lib/action_view/helpers/deplate.rb +45 -0
  12. data/lib/deplate.rb +6 -1
  13. data/lib/deplate/abstract-class.rb +0 -0
  14. data/lib/deplate/bib.rb +576 -0
  15. data/lib/deplate/builtin.rb +0 -0
  16. data/lib/deplate/cache.rb +55 -5
  17. data/lib/deplate/commands.rb +346 -183
  18. data/lib/deplate/common.rb +209 -48
  19. data/lib/deplate/converter.rb +12 -6
  20. data/lib/deplate/core.rb +777 -378
  21. data/lib/deplate/counters.rb +254 -0
  22. data/lib/deplate/css/article.css +4 -3
  23. data/lib/deplate/css/deplate.css +121 -5
  24. data/lib/deplate/css/heading-navbar.css +0 -0
  25. data/lib/deplate/css/layout-deplate-print.css +0 -0
  26. data/lib/deplate/css/layout-deplate.css +0 -0
  27. data/lib/deplate/css/sans-serif.css +0 -0
  28. data/lib/deplate/css/serif-e.css +0 -0
  29. data/lib/deplate/css/serif-rel.css +0 -0
  30. data/lib/deplate/css/serif.css +9 -3
  31. data/lib/deplate/css/slides.css +0 -0
  32. data/lib/deplate/css/tabbar-left.css +0 -0
  33. data/lib/deplate/css/tabbar-right-ie.css +3 -9
  34. data/lib/deplate/css/tabbar-right.css +51 -18
  35. data/lib/deplate/css/tabbar-top.css +7 -1
  36. data/lib/deplate/css/tabbar.css +0 -0
  37. data/lib/deplate/css/text-sans-serif.css +0 -0
  38. data/lib/deplate/css/text-serif.css +0 -0
  39. data/lib/deplate/define.rb +183 -177
  40. data/lib/deplate/deplate-string.rb +82 -0
  41. data/lib/deplate/docbook.rb +236 -128
  42. data/lib/deplate/elements.rb +584 -417
  43. data/lib/deplate/etc.rb +163 -101
  44. data/lib/deplate/external.rb +42 -11
  45. data/lib/deplate/fmt/dbk-article-4.1.2.rb +0 -0
  46. data/lib/deplate/fmt/dbk-article.rb +0 -0
  47. data/lib/deplate/fmt/dbk-book.rb +0 -0
  48. data/lib/deplate/fmt/dbk-ref.rb +3 -3
  49. data/lib/deplate/fmt/dbk-slides.rb +0 -0
  50. data/lib/deplate/fmt/dbk-snippet.rb +0 -0
  51. data/lib/deplate/fmt/html-snippet.rb +0 -0
  52. data/lib/deplate/fmt/html.rb +783 -550
  53. data/lib/deplate/fmt/htmlsite.rb +192 -199
  54. data/lib/deplate/fmt/htmlslides.rb +0 -0
  55. data/lib/deplate/fmt/htmlwebsite.rb +3 -3
  56. data/lib/deplate/fmt/latex-snippet.rb +0 -0
  57. data/lib/deplate/fmt/latex.rb +242 -83
  58. data/lib/deplate/fmt/null.rb +32 -0
  59. data/lib/deplate/fmt/php.rb +4 -4
  60. data/lib/deplate/fmt/phpsite.rb +6 -5
  61. data/lib/deplate/fmt/plain.rb +160 -106
  62. data/lib/deplate/fmt/template.rb +0 -0
  63. data/lib/deplate/fmt/xhtml10t.rb +0 -0
  64. data/lib/deplate/formatter-snippet.rb +0 -0
  65. data/lib/deplate/formatter.rb +613 -301
  66. data/lib/deplate/input.rb +202 -142
  67. data/lib/deplate/input/deplate-headings.rb +4 -6
  68. data/lib/deplate/input/deplate-restricted.rb +15 -9
  69. data/lib/deplate/input/deplate.rb +2 -4
  70. data/lib/deplate/input/rdoc.rb +39 -38
  71. data/lib/deplate/input/template.rb +0 -0
  72. data/lib/deplate/lib/Makefile.config +29 -0
  73. data/lib/deplate/lib/latex/deplate.sty +54 -0
  74. data/lib/deplate/lib/latex/highlight-extra.sty +0 -0
  75. data/lib/deplate/lib/latex/highlight-typical.sty +0 -0
  76. data/lib/deplate/lib/php/page-comment.inc.php +216 -0
  77. data/lib/deplate/lib/tabmenu.js +0 -0
  78. data/lib/deplate/locale/de.latin1 +155 -17
  79. data/lib/deplate/locale/ru.koi8-r +0 -0
  80. data/lib/deplate/locale/zh_cn.gb2312 +0 -0
  81. data/lib/deplate/macros.rb +133 -82
  82. data/lib/deplate/messages.rb +6 -4
  83. data/lib/deplate/metadata.rb +0 -0
  84. data/lib/deplate/metadata/marshal.rb +0 -0
  85. data/lib/deplate/metadata/xml.rb +0 -0
  86. data/lib/deplate/metadata/yaml.rb +0 -0
  87. data/lib/deplate/mod/anyword.rb +3 -3
  88. data/lib/deplate/mod/babelfish.rb +4 -4
  89. data/lib/deplate/mod/code-gvim.rb +8 -4
  90. data/lib/deplate/mod/code-highlight.rb +3 -3
  91. data/lib/deplate/mod/colored-log.rb +0 -0
  92. data/lib/deplate/mod/de.rb +2 -2
  93. data/lib/deplate/mod/en.rb +0 -0
  94. data/lib/deplate/mod/endnotes.rb +0 -0
  95. data/lib/deplate/mod/fr.rb +0 -0
  96. data/lib/deplate/mod/html-asciimath.rb +0 -0
  97. data/lib/deplate/mod/html-deplate-button.rb +0 -0
  98. data/lib/deplate/mod/html-headings-navbar.rb +5 -13
  99. data/lib/deplate/mod/html-jsmath.rb +39 -0
  100. data/lib/deplate/mod/html-obfuscate-email.rb +3 -3
  101. data/lib/deplate/mod/html-sidebar.rb +0 -0
  102. data/lib/deplate/mod/htmlslides-navbar-fh.rb +3 -3
  103. data/lib/deplate/mod/iconv.rb +0 -0
  104. data/lib/deplate/mod/imgurl.rb +4 -4
  105. data/lib/deplate/mod/inlatex-compound.rb +7 -10
  106. data/lib/deplate/mod/koma.rb +0 -0
  107. data/lib/deplate/mod/latex-emph-table-head.rb +0 -0
  108. data/lib/deplate/mod/latex-styles.rb +7 -4
  109. data/lib/deplate/mod/latex-verbatim-small.rb +0 -0
  110. data/lib/deplate/mod/makefile.rb +23 -7
  111. data/lib/deplate/mod/mark-external-urls.rb +3 -3
  112. data/lib/deplate/mod/markup-1-warn.rb +10 -10
  113. data/lib/deplate/mod/markup-1.rb +0 -0
  114. data/lib/deplate/mod/navbar-png.rb +24 -8
  115. data/lib/deplate/mod/noindent.rb +0 -0
  116. data/lib/deplate/mod/numpara.rb +0 -0
  117. data/lib/deplate/mod/particle-math.rb +4 -4
  118. data/lib/deplate/mod/php-extra.rb +46 -6
  119. data/lib/deplate/mod/pstoedit.rb +0 -0
  120. data/lib/deplate/mod/recode.rb +0 -0
  121. data/lib/deplate/mod/ru_koi8-r.rb +0 -0
  122. data/lib/deplate/mod/smart-dash.rb +26 -0
  123. data/lib/deplate/mod/smiley.rb +69 -7
  124. data/lib/deplate/mod/soffice.rb +0 -0
  125. data/lib/deplate/mod/symbols-latin1.rb +14 -23
  126. data/lib/deplate/mod/symbols-od-utf-8.rb +5 -3
  127. data/lib/deplate/mod/symbols-plain.rb +5 -35
  128. data/lib/deplate/mod/symbols-sgml.rb +8 -9
  129. data/lib/deplate/mod/symbols-utf-8.rb +8 -9
  130. data/lib/deplate/mod/symbols-xml.rb +5 -9
  131. data/lib/deplate/mod/syntax-region-alt.rb +5 -5
  132. data/lib/deplate/mod/utf8.rb +0 -0
  133. data/lib/deplate/mod/validate-html.rb +0 -0
  134. data/lib/deplate/mod/xmlrpc.rb +0 -0
  135. data/lib/deplate/mod/zh-cn-autospace.rb +18 -20
  136. data/lib/deplate/mod/zh-cn.rb +4 -6
  137. data/lib/deplate/nukumi2.rb +71 -0
  138. data/lib/deplate/once-method.rb +0 -0
  139. data/lib/deplate/output.rb +19 -21
  140. data/lib/deplate/particles.rb +178 -116
  141. data/lib/deplate/regions.rb +99 -58
  142. data/lib/deplate/skeletons.rb +122 -0
  143. data/lib/deplate/structured.rb +164 -106
  144. data/lib/deplate/template.rb +67 -43
  145. data/lib/deplate/templates/html-doc.html +0 -0
  146. data/lib/deplate/templates/html-left-tabbar-js.html +0 -0
  147. data/lib/deplate/templates/html-left-tabbar.html +0 -0
  148. data/lib/deplate/templates/html-tabbar-right-pcomments.php +22 -0
  149. data/lib/deplate/templates/html-tabbar-right-step.html +24 -0
  150. data/lib/deplate/templates/html-tabbar-right-table.html +0 -0
  151. data/lib/deplate/templates/html-tabbar-right.html +2 -4
  152. data/lib/deplate/templates/html-tabbar-top.html +0 -9
  153. data/lib/deplate/templates/html-tabbar.html +0 -0
  154. data/lib/deplate/variables.rb +127 -0
  155. data/lib/deplate/wiki-markup.rb +99 -33
  156. data/lib/deplate/xml.rb +18 -18
  157. data/lib/deplate/zh-cn.rb +0 -0
  158. data/lib/ps2ppm.rb +0 -0
  159. data/man/man1/deplate.1 +564 -474
  160. metadata +201 -186
@@ -3,8 +3,8 @@
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 17-M�r-2004.
6
- # @Last Change: 01-Nov-2005.
7
- # @Revision: 0.910
6
+ # @Last Change: 25-Apr-2006.
7
+ # @Revision: 0.1008
8
8
 
9
9
  require "deplate/fmt/html"
10
10
 
@@ -16,28 +16,28 @@ require "deplate/fmt/html"
16
16
  #
17
17
 
18
18
  class Deplate::Formatter::HTML_Site < Deplate::Formatter::HTML
19
- self.myname = "htmlsite"
19
+ self.myname = 'htmlsite'
20
20
  self.rx = /html?|htmlwebsite/i
21
21
 
22
22
  def hook_pre_body_flush_html_pager
23
- title = @deplate.get_clip("title")
23
+ title = @deplate.get_clip('title')
24
24
  title = title.elt if title
25
25
  top = @deplate.output.top_heading
26
26
  if top
27
27
  top_title = top.description
28
28
  if top_title
29
- title = clean_tags([title, top_title].compact.join(" -- "))
29
+ title = clean_tags([title, top_title].compact.join(' -- '))
30
30
  set_at(:pre, :head_title, %{<title>%s</title>} % title) unless title.empty?
31
31
  end
32
32
  end
33
33
 
34
34
  invoker = nil
35
- navbar = @deplate.variables["docNavbar"]
35
+ navbar = @variables['docNavbar']
36
36
  if navbar
37
37
  case navbar
38
- when "top"
38
+ when 'top'
39
39
  format_navigation_bar(invoker, :body, :navbar_top, :top)
40
- when "bottom"
40
+ when 'bottom'
41
41
  format_navigation_bar(invoker, :body, :navbar_bottom, :bottom)
42
42
  else
43
43
  format_navigation_bar(invoker, :body, :navbar_top, :top)
@@ -45,15 +45,16 @@ class Deplate::Formatter::HTML_Site < Deplate::Formatter::HTML
45
45
  end
46
46
  end
47
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
48
+ idx = @deplate.output_index - 1
49
+ set_relation(:htmlsite_prev, 'Prev', 'previous')
50
+ set_relation(:htmlsite_next, 'Next', 'next')
51
+ set_relation(:htmlsite_up, 'Home', 'up') if idx > 0
51
52
  end
52
53
 
53
54
  def set_relation(slot, service_infix, tag)
54
- url = @deplate.invoke_service("page#{service_infix}Dest")
55
+ url = invoke_service("page#{service_infix}Dest")
55
56
  if url
56
- title = @deplate.invoke_service("page#{service_infix}Title") || tag
57
+ title = invoke_service("page#{service_infix}Title") || tag
57
58
  title = clean_tags(title)
58
59
  set_at(:pre, slot, head_link_tag(%{rel="#{tag}" href="#{url}" title="#{title}"}))
59
60
  end
@@ -77,105 +78,145 @@ class Deplate::Formatter::HTML_Site < Deplate::Formatter::HTML
77
78
  end
78
79
  end
79
80
 
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+>
81
+ def format_heading(invoker)
82
+ output_at(:body, :inner_body_end, %{</div>\n})
83
+ [super, %{<div class="pagebody">\n}].join
104
84
  end
105
85
 
106
- # def htmlsite_<+TBD+>
107
- # end
108
86
 
109
- def htmlsite_tabBarNote(args, text)
87
+ def_service('tab_bar_note') do |args, text|
110
88
  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
89
+ @htmlsite_sliding_tabbar_note = @deplate.msg(:htmlsite_tabbar_note)
116
90
  end
117
- return @htmlsite_sliding_tabbar_note
91
+ @htmlsite_sliding_tabbar_note
92
+ end
93
+
94
+ def_service('tab_bar_left') do |args, text|
95
+ htmlsite_tabbar(args, text, 'tabBarLeft', false)
96
+ end
97
+
98
+ def_service('tab_bar_right') do |args, text|
99
+ htmlsite_tabbar(args, text, 'tabBarRight', false)
118
100
  end
119
101
 
120
- def htmlsite_tabBarLeft(args, text)
121
- htmlsite_tabBar(args, text, "tabBarLeft", false)
102
+ def_service('tab_bar_top') do |args, text|
103
+ htmlsite_tabbar(args, text, 'tabBarTop', true)
104
+ end
105
+
106
+ def_service('tab_bar_bottom') do |args, text|
107
+ htmlsite_tabbar(args, text, 'tabBarBottom', true)
108
+ end
109
+
110
+ def_service('progress_bar') do |args, text|
111
+ horizontal = !args['vertical']
112
+ htmlsite_progress_bar(args, horizontal)
122
113
  end
123
114
 
124
- def htmlsite_tabBarRight(args, text)
125
- htmlsite_tabBar(args, text, "tabBarRight", false)
115
+ def_service('progress_bar_horizontal') do |args, text|
116
+ htmlsite_progress_bar(args, true)
117
+ end
118
+
119
+ def_service('progress_bar_vertical') do |args, text|
120
+ htmlsite_progress_bar(args, false)
121
+ end
122
+
123
+ def_service('progress_percent') do |args, text|
124
+ idx = @deplate.output_index
125
+ percent = 100 * idx / @deplate.top_heading_idx
126
+ %{<span class="progress">#{percent}%</span>}
127
+ end
128
+
129
+ def_service('progress_pages') do |args, text|
130
+ idx = @deplate.output_index
131
+ max = @deplate.top_heading_idx
132
+ %{<span class="progress">#{idx}/#{max}</span>}
126
133
  end
127
134
 
128
- def htmlsite_tabBarTop(args, text)
129
- htmlsite_tabBar(args, text, "tabBarTop", true)
135
+ def_service('progress_first') do |args, text|
136
+ idx = @deplate.output_index
137
+ idx == 0 ? '1' : '0'
130
138
  end
131
139
 
132
- def htmlsite_tabBarBottom(args, text)
133
- htmlsite_tabBar(args, text, "tabBarBottom", true)
140
+ def_service('progress_last') do |args, text|
141
+ idx = @deplate.output_index
142
+ max = @deplate.top_heading_idx
143
+ idx == max ? '1' : '0'
134
144
  end
135
145
 
136
- def htmlsite_tabBar(args, text, style, horizontal)
146
+ def_service('page_next_dest') do |args, text|
147
+ hd = delta_heading(1)
148
+ pagedest_relpath(hd)
149
+ end
150
+
151
+ def_service('page_next_title') do |args, text|
152
+ hd = delta_heading(1)
153
+ pagedest_relpath(hd)
154
+ end
155
+
156
+ def_service('page_prev_dest') do |args, text|
157
+ hd = delta_heading(-1)
158
+ pagedest_relpath(hd)
159
+ end
160
+
161
+ def_service('page_prev_title') do |args, text|
162
+ hd = delta_heading(-1)
163
+ hd && hd.description
164
+ end
165
+
166
+ def_service('page_home_dest') do |args, text|
167
+ hd = @deplate.top_heading_by_idx(@deplate.home_index)
168
+ pagedest_relpath(hd)
169
+ end
170
+
171
+ def_service('page_home_title') do |args, text|
172
+ hd = @deplate.top_heading_by_idx(@deplate.home_index)
173
+ (hd && hd.description) || @deplate.msg('Frontpage')
174
+ end
175
+
176
+ def htmlsite_tabbar(args, text, style, horizontal)
137
177
  if horizontal
138
- tagsl0 = "table"
139
- tagsl1 = ["tr"]
140
- tagsl2 = ["td"]
178
+ tagsl0 = 'table'
179
+ tagsa0 = 'cellspacing="0"'
180
+ tagsl1 = ['tr']
181
+ tagsl2 = ['td']
141
182
  # tagsl1 = []
142
- # tagsl2 = ["span"]
143
- width = args["width"] || "100%"
144
- heigth = args["heigth"] || "20px"
183
+ # tagsl2 = ['span']
184
+ width = args['width'] || '100%'
185
+ heigth = args['heigth'] || '20px'
145
186
  else
146
- tagsl0 = "table"
187
+ tagsl0 = 'table'
188
+ tagsa0 = 'cellspacing="0"'
147
189
  tagsl1 = []
148
- tagsl2 = ["tr", "td"]
149
- width = args["width"] || "140px"
150
- heigth = args["heigth"]
190
+ tagsl2 = ['tr', 'td']
191
+ width = args['width'] || '20px'
192
+ heigth = args['heigth'] || '140px'
151
193
  end
152
194
 
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)
195
+ idx = @deplate.output_index
196
+ type = @variables['navBarType'] || :top
197
+ urlp, prv = navbar_button_prev(nil, nil, idx, type, idx > @deplate.home_index)
198
+ url, home = navbar_button_home(nil, nil, idx, type, idx > @deplate.home_index)
199
+ urln, nxt = navbar_button_next(nil, nil, idx, type, idx < @deplate.top_heading_idx)
159
200
 
160
201
  tabbar = []
161
- tabbar << html_navigation_keys({"next" => urln}, "") if args["nextKey"]
202
+ tabbar << invoke_service('navigation_keys', {'next' => urln}) if args['nextKey']
162
203
  # 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)
204
+ tabbar << %{<#{tagsl0} #{tagsa0} class="#{style}" summary="Navigation bar">} if tagsl0
205
+ tabbar << htmlsite_tabbar_accum_tags(tagsl1, style, true)
165
206
 
166
- if !@variables["noTabBarButtons"]
207
+ if !@variables['noTabBarButtons']
167
208
  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"]
209
+ o = htmlsite_tabbar_accum_tags(tagsl2, s, true)
210
+ c = htmlsite_tabbar_accum_tags(tagsl2, s, false)
211
+ if @variables['tabBarButtons']
171
212
  buttons = []
172
- for b in @variables["tabBarButtons"].split(/[ ,;]/)
213
+ for b in @variables['tabBarButtons'].split(/[ ,;]/)
173
214
  case b
174
- when "home", "h"
215
+ when 'home', 'h'
175
216
  buttons << home
176
- when "next", "n"
217
+ when 'next', 'n'
177
218
  buttons << nxt
178
- when "prev", "previous", "p"
219
+ when 'prev', 'previous', 'p'
179
220
  buttons << prv
180
221
  end
181
222
  end
@@ -187,24 +228,24 @@ class Deplate::Core
187
228
  tabbar << [o, buttons.join(%{&nbsp;}), c].join
188
229
  end
189
230
 
190
- depth = args["depth"]
191
- depth = depth ? depth.to_i : 1
192
- inactivedepth = args["depthInactive"]
231
+ depth = args['depth']
232
+ depth = depth ? depth.to_i : @deplate.options.split_level
233
+ inactivedepth = args['depthInactive']
193
234
  inactivedepth = inactivedepth ? inactivedepth.to_i : depth
194
235
 
195
- tabbarsep = @variables["tabBarSep"] || "|"
236
+ tabbarsep = @variables['tabBarSep'] || '|'
196
237
  tabbarsep = /\s*#{Regexp.escape(tabbarsep)}\s*/
197
- tabbarextra = @variables["tabBar"] || ["[auto]"]
238
+ tabbarextra = @variables['tabBar'] || ['[auto]']
198
239
  tabbarextra = tabbarextra.split(/\n/) if tabbarextra.kind_of?(String)
199
- if @variables["tabEqualWidths"] || @variables["equalTabs"]
200
- tabsize = top_heading_idx + tabbarextra.size
240
+ if @variables['tabEqualWidths'] || @variables['equalTabs']
241
+ tabsize = @deplate.top_heading_idx + tabbarextra.size
201
242
  tabsize = 100 / tabsize
202
243
  tabsize = %{ #{horizontal ? "width" : "heigth"}="#{tabsize}%"}
203
244
  else
204
245
  tabsize = nil
205
246
  end
206
247
  for e in tabbarextra
207
- if e == "[auto]"
248
+ if e == '[auto]'
208
249
  tabbar_auto_entries(tabbar, idx, style, depth, inactivedepth, tagsl2, tabsize)
209
250
  else
210
251
  title, url = e.split(tabbarsep)
@@ -213,57 +254,44 @@ class Deplate::Core
213
254
  end
214
255
  end
215
256
 
216
- if args["spacer"]
257
+ if args['spacer']
217
258
  if horizontal
218
- spacer = %{<img width="1px" height="#{height}" src="%s" alt="" />} % args["spacer"]
259
+ spacer = %{<img width="1px" height="#{height}" src="%s" alt="" />} % args['spacer']
219
260
  else
220
- spacer = %{<img width="#{width}" height="1px" src="%s" alt="" />} % args["spacer"]
261
+ spacer = %{<img width="#{width}" height="1px" src="%s" alt="" />} % args['spacer']
221
262
  end
222
263
  else
223
264
  spacer = nil
224
265
  end
225
266
 
226
- if args["progressBar"]
267
+ if args['progressBar']
227
268
  if horizontal
228
- pb = invoke_service("progressBarVertical")
269
+ pb = invoke_service('progressBarVertical')
229
270
  else
230
- pb = invoke_service("progressBarHorizontal")
271
+ pb = invoke_service('progressBarHorizontal')
231
272
  end
232
273
  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")
274
+ o = htmlsite_tabbar_accum_tags(tagsl2, s, true)
275
+ c = htmlsite_tabbar_accum_tags(tagsl2, s, false)
276
+ i = invoke_service('progressPercent')
236
277
  tabbar << [o, spacer, pb, i, c].compact.join
237
278
  end
238
279
 
239
- tabbar << htmlsite_tabBar_accum_tags(tagsl1, style, false)
280
+ tabbar << htmlsite_tabbar_accum_tags(tagsl1, style, false)
240
281
  tabbar << %{</#{tagsl0}>} if tagsl0
241
282
  return tabbar.compact.join("\n")
242
283
  end
243
284
 
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
285
  def htmlsite_progress_bar(args, horizontal)
258
- idx = @variables["@idx"].to_i
259
- percent = 100 * idx / top_heading_idx
286
+ idx = @deplate.output_index
287
+ percent = 100 * idx / @deplate.top_heading_idx
260
288
  anti = 100 - percent
261
289
  all = percent + anti
262
290
  if all != 100
263
291
  anti += 100 - all
264
292
  end
265
- height = args["h"] || args["height"] || (horizontal ? "10pt" : "100pt")
266
- width = args["w"] || args["width"] || (horizontal ? "100pt" : "10pt")
293
+ height = args['h'] || args['height'] || (horizontal ? '10pt' : '100pt')
294
+ width = args['w'] || args['width'] || (horizontal ? '100pt' : '10pt')
267
295
  pb = []
268
296
  # pb << %{<div class="progressBar">}
269
297
  pb << %{<table align="center" class="progressBar" width="#{width}" style="height:#{height}">}
@@ -281,66 +309,12 @@ class Deplate::Core
281
309
  return pb.join
282
310
  end
283
311
 
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
312
  def delta_heading(delta)
338
- idx = @variables["@idx"]
313
+ idx = @deplate.output_index
339
314
  if idx
340
- idx = idx.to_i + delta + 1
315
+ idx = idx.to_i + delta
341
316
  if idx >= 0
342
- rv = top_heading_by_idx(idx)
343
- return rv
317
+ return @deplate.top_heading_by_idx(idx)
344
318
  end
345
319
  end
346
320
  return nil
@@ -349,51 +323,64 @@ class Deplate::Core
349
323
  private
350
324
  def pagedest_relpath(hd)
351
325
  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))
326
+ curr = @deplate.top_heading_by_idx(@deplate.top_heading_idx)
327
+ rv = @deplate.relative_path(hd.output_location, File.dirname(curr.output_location))
328
+ return rv
355
329
  end
356
330
  end
357
331
 
358
332
  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)
333
+ if @variables['tabBarHomeName']
334
+ hidx = @deplate.home_index
335
+ s = idx == hidx ? "#{style}Active" : "#{style}Inactive"
336
+ title = @variables['tabBarHomeName']
337
+ file = navbar_guess_file_name(hidx, idx, :navbar)
363
338
  tabbar << tabbar_entry(%{<a class="tabBarEntry" href="#{file}">#{title}</a>}, tags, s, tabsize)
364
339
  end
365
340
 
366
- each_heading(depth) do |hd, title|
367
- lstr = hd.level_as_string
368
- lnr = hd.top_heading_idx
341
+ @deplate.each_heading(depth) do |hd, title|
342
+ t1 = @deplate.top_heading_by_idx(idx)
343
+ t2 = hd.top_heading
344
+ # if t1 == t2 or
345
+ # (t1.kind_of?(Deplate::Element::Heading) and
346
+ # t2.kind_of?(Deplate::Element::Heading) and
347
+ # t1.level_heading[0] == t2.level_heading[0])
348
+ if t1.level_heading[0] == t2.level_heading[0]
349
+ s = ["#{style}Active #{style}Active-Level#{hd.level}"]
350
+ elsif hd.level > inactivedepth
351
+ next
352
+ else
353
+ s = ["#{style}Inactive #{style}Inactive-Level#{hd.level}"]
354
+ end
355
+ # s << "#{style}-Level#{hd.level}"
356
+
357
+ # lstr = hd.level_as_string
358
+ # lnr = hd.top_heading_idx
369
359
  file = hd.output_file_name(:basename => true)
370
- if hd.level > 1
360
+ file = escape_filename(file)
361
+ if hd.level > @deplate.options.split_level
371
362
  anchor = hd.args[:id] || hd.label.first
372
363
  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
364
+ file = [file, '#', anchor].join
383
365
  end
384
366
  end
385
367
 
386
- tabbar << tabbar_entry(%{<a class="tabBarEntry" href="#{file}">#{title}</a>}, tags, s, tabsize)
368
+ tabbar << tabbar_entry(
369
+ %{<a class="tabBarEntry" href="#{file}">#{title}</a>},
370
+ tags,
371
+ s.join(' '),
372
+ tabsize
373
+ )
387
374
  end
388
375
  end
389
376
 
390
377
  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)
378
+ o = htmlsite_tabbar_accum_tags(tags, html_class, true, tabsize)
379
+ c = htmlsite_tabbar_accum_tags(tags, html_class, false, tabsize)
393
380
  [o, html, c].join
394
381
  end
395
382
 
396
- def htmlsite_tabBar_accum_tags(tags, htmlClass, open_tags, extra=nil)
383
+ def htmlsite_tabbar_accum_tags(tags, htmlClass, open_tags, extra=nil)
397
384
  acc = []
398
385
  unless open_tags
399
386
  tags = tags.reverse
@@ -416,4 +403,10 @@ class Deplate::Core
416
403
  end
417
404
  end
418
405
 
406
+ # class Deplate::Core
407
+ # def formatter_initialize_htmlsite
408
+ # @max_headings = nil
409
+ # end
410
+ # end
411
+
419
412
  # vim: ff=unix