deplate 0.7.3 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.TXT +3 -0
- data/CHANGES.TXT +248 -175
- data/LICENSE.TXT +0 -0
- data/NEWS.TXT +28 -24
- data/README.TXT +0 -0
- data/TODO.TXT +174 -88
- data/VERSION.TXT +1 -1
- data/bin/deplate +0 -0
- data/bin/deplate.bat +0 -0
- data/etc/deplate.ini +91 -3
- data/lib/action_view/helpers/deplate.rb +45 -0
- data/lib/deplate.rb +6 -1
- data/lib/deplate/abstract-class.rb +0 -0
- data/lib/deplate/bib.rb +576 -0
- data/lib/deplate/builtin.rb +0 -0
- data/lib/deplate/cache.rb +55 -5
- data/lib/deplate/commands.rb +346 -183
- data/lib/deplate/common.rb +209 -48
- data/lib/deplate/converter.rb +12 -6
- data/lib/deplate/core.rb +777 -378
- data/lib/deplate/counters.rb +254 -0
- data/lib/deplate/css/article.css +4 -3
- data/lib/deplate/css/deplate.css +121 -5
- data/lib/deplate/css/heading-navbar.css +0 -0
- data/lib/deplate/css/layout-deplate-print.css +0 -0
- data/lib/deplate/css/layout-deplate.css +0 -0
- data/lib/deplate/css/sans-serif.css +0 -0
- data/lib/deplate/css/serif-e.css +0 -0
- data/lib/deplate/css/serif-rel.css +0 -0
- data/lib/deplate/css/serif.css +9 -3
- data/lib/deplate/css/slides.css +0 -0
- data/lib/deplate/css/tabbar-left.css +0 -0
- data/lib/deplate/css/tabbar-right-ie.css +3 -9
- data/lib/deplate/css/tabbar-right.css +51 -18
- data/lib/deplate/css/tabbar-top.css +7 -1
- data/lib/deplate/css/tabbar.css +0 -0
- data/lib/deplate/css/text-sans-serif.css +0 -0
- data/lib/deplate/css/text-serif.css +0 -0
- data/lib/deplate/define.rb +183 -177
- data/lib/deplate/deplate-string.rb +82 -0
- data/lib/deplate/docbook.rb +236 -128
- data/lib/deplate/elements.rb +584 -417
- data/lib/deplate/etc.rb +163 -101
- data/lib/deplate/external.rb +42 -11
- data/lib/deplate/fmt/dbk-article-4.1.2.rb +0 -0
- data/lib/deplate/fmt/dbk-article.rb +0 -0
- data/lib/deplate/fmt/dbk-book.rb +0 -0
- data/lib/deplate/fmt/dbk-ref.rb +3 -3
- data/lib/deplate/fmt/dbk-slides.rb +0 -0
- data/lib/deplate/fmt/dbk-snippet.rb +0 -0
- data/lib/deplate/fmt/html-snippet.rb +0 -0
- data/lib/deplate/fmt/html.rb +783 -550
- data/lib/deplate/fmt/htmlsite.rb +192 -199
- data/lib/deplate/fmt/htmlslides.rb +0 -0
- data/lib/deplate/fmt/htmlwebsite.rb +3 -3
- data/lib/deplate/fmt/latex-snippet.rb +0 -0
- data/lib/deplate/fmt/latex.rb +242 -83
- data/lib/deplate/fmt/null.rb +32 -0
- data/lib/deplate/fmt/php.rb +4 -4
- data/lib/deplate/fmt/phpsite.rb +6 -5
- data/lib/deplate/fmt/plain.rb +160 -106
- data/lib/deplate/fmt/template.rb +0 -0
- data/lib/deplate/fmt/xhtml10t.rb +0 -0
- data/lib/deplate/formatter-snippet.rb +0 -0
- data/lib/deplate/formatter.rb +613 -301
- data/lib/deplate/input.rb +202 -142
- data/lib/deplate/input/deplate-headings.rb +4 -6
- data/lib/deplate/input/deplate-restricted.rb +15 -9
- data/lib/deplate/input/deplate.rb +2 -4
- data/lib/deplate/input/rdoc.rb +39 -38
- data/lib/deplate/input/template.rb +0 -0
- data/lib/deplate/lib/Makefile.config +29 -0
- data/lib/deplate/lib/latex/deplate.sty +54 -0
- data/lib/deplate/lib/latex/highlight-extra.sty +0 -0
- data/lib/deplate/lib/latex/highlight-typical.sty +0 -0
- data/lib/deplate/lib/php/page-comment.inc.php +216 -0
- data/lib/deplate/lib/tabmenu.js +0 -0
- data/lib/deplate/locale/de.latin1 +155 -17
- data/lib/deplate/locale/ru.koi8-r +0 -0
- data/lib/deplate/locale/zh_cn.gb2312 +0 -0
- data/lib/deplate/macros.rb +133 -82
- data/lib/deplate/messages.rb +6 -4
- data/lib/deplate/metadata.rb +0 -0
- data/lib/deplate/metadata/marshal.rb +0 -0
- data/lib/deplate/metadata/xml.rb +0 -0
- data/lib/deplate/metadata/yaml.rb +0 -0
- data/lib/deplate/mod/anyword.rb +3 -3
- data/lib/deplate/mod/babelfish.rb +4 -4
- data/lib/deplate/mod/code-gvim.rb +8 -4
- data/lib/deplate/mod/code-highlight.rb +3 -3
- data/lib/deplate/mod/colored-log.rb +0 -0
- data/lib/deplate/mod/de.rb +2 -2
- data/lib/deplate/mod/en.rb +0 -0
- data/lib/deplate/mod/endnotes.rb +0 -0
- data/lib/deplate/mod/fr.rb +0 -0
- data/lib/deplate/mod/html-asciimath.rb +0 -0
- data/lib/deplate/mod/html-deplate-button.rb +0 -0
- data/lib/deplate/mod/html-headings-navbar.rb +5 -13
- data/lib/deplate/mod/html-jsmath.rb +39 -0
- data/lib/deplate/mod/html-obfuscate-email.rb +3 -3
- data/lib/deplate/mod/html-sidebar.rb +0 -0
- data/lib/deplate/mod/htmlslides-navbar-fh.rb +3 -3
- data/lib/deplate/mod/iconv.rb +0 -0
- data/lib/deplate/mod/imgurl.rb +4 -4
- data/lib/deplate/mod/inlatex-compound.rb +7 -10
- data/lib/deplate/mod/koma.rb +0 -0
- data/lib/deplate/mod/latex-emph-table-head.rb +0 -0
- data/lib/deplate/mod/latex-styles.rb +7 -4
- data/lib/deplate/mod/latex-verbatim-small.rb +0 -0
- data/lib/deplate/mod/makefile.rb +23 -7
- data/lib/deplate/mod/mark-external-urls.rb +3 -3
- data/lib/deplate/mod/markup-1-warn.rb +10 -10
- data/lib/deplate/mod/markup-1.rb +0 -0
- data/lib/deplate/mod/navbar-png.rb +24 -8
- data/lib/deplate/mod/noindent.rb +0 -0
- data/lib/deplate/mod/numpara.rb +0 -0
- data/lib/deplate/mod/particle-math.rb +4 -4
- data/lib/deplate/mod/php-extra.rb +46 -6
- data/lib/deplate/mod/pstoedit.rb +0 -0
- data/lib/deplate/mod/recode.rb +0 -0
- data/lib/deplate/mod/ru_koi8-r.rb +0 -0
- data/lib/deplate/mod/smart-dash.rb +26 -0
- data/lib/deplate/mod/smiley.rb +69 -7
- data/lib/deplate/mod/soffice.rb +0 -0
- data/lib/deplate/mod/symbols-latin1.rb +14 -23
- data/lib/deplate/mod/symbols-od-utf-8.rb +5 -3
- data/lib/deplate/mod/symbols-plain.rb +5 -35
- data/lib/deplate/mod/symbols-sgml.rb +8 -9
- data/lib/deplate/mod/symbols-utf-8.rb +8 -9
- data/lib/deplate/mod/symbols-xml.rb +5 -9
- data/lib/deplate/mod/syntax-region-alt.rb +5 -5
- data/lib/deplate/mod/utf8.rb +0 -0
- data/lib/deplate/mod/validate-html.rb +0 -0
- data/lib/deplate/mod/xmlrpc.rb +0 -0
- data/lib/deplate/mod/zh-cn-autospace.rb +18 -20
- data/lib/deplate/mod/zh-cn.rb +4 -6
- data/lib/deplate/nukumi2.rb +71 -0
- data/lib/deplate/once-method.rb +0 -0
- data/lib/deplate/output.rb +19 -21
- data/lib/deplate/particles.rb +178 -116
- data/lib/deplate/regions.rb +99 -58
- data/lib/deplate/skeletons.rb +122 -0
- data/lib/deplate/structured.rb +164 -106
- data/lib/deplate/template.rb +67 -43
- data/lib/deplate/templates/html-doc.html +0 -0
- data/lib/deplate/templates/html-left-tabbar-js.html +0 -0
- data/lib/deplate/templates/html-left-tabbar.html +0 -0
- data/lib/deplate/templates/html-tabbar-right-pcomments.php +22 -0
- data/lib/deplate/templates/html-tabbar-right-step.html +24 -0
- data/lib/deplate/templates/html-tabbar-right-table.html +0 -0
- data/lib/deplate/templates/html-tabbar-right.html +2 -4
- data/lib/deplate/templates/html-tabbar-top.html +0 -9
- data/lib/deplate/templates/html-tabbar.html +0 -0
- data/lib/deplate/variables.rb +127 -0
- data/lib/deplate/wiki-markup.rb +99 -33
- data/lib/deplate/xml.rb +18 -18
- data/lib/deplate/zh-cn.rb +0 -0
- data/lib/ps2ppm.rb +0 -0
- data/man/man1/deplate.1 +564 -474
- metadata +201 -186
data/lib/deplate/fmt/htmlsite.rb
CHANGED
@@ -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:
|
7
|
-
# @Revision: 0.
|
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 =
|
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(
|
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 = @
|
35
|
+
navbar = @variables['docNavbar']
|
36
36
|
if navbar
|
37
37
|
case navbar
|
38
|
-
when
|
38
|
+
when 'top'
|
39
39
|
format_navigation_bar(invoker, :body, :navbar_top, :top)
|
40
|
-
when
|
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
|
-
|
49
|
-
set_relation(:
|
50
|
-
set_relation(:
|
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 =
|
55
|
+
url = invoke_service("page#{service_infix}Dest")
|
55
56
|
if url
|
56
|
-
title =
|
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
|
-
|
81
|
-
|
82
|
-
class
|
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
|
-
|
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
|
-
|
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
|
-
|
121
|
-
|
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
|
-
|
125
|
-
|
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
|
-
|
129
|
-
|
135
|
+
def_service('progress_first') do |args, text|
|
136
|
+
idx = @deplate.output_index
|
137
|
+
idx == 0 ? '1' : '0'
|
130
138
|
end
|
131
139
|
|
132
|
-
|
133
|
-
|
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
|
-
|
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 =
|
139
|
-
|
140
|
-
|
178
|
+
tagsl0 = 'table'
|
179
|
+
tagsa0 = 'cellspacing="0"'
|
180
|
+
tagsl1 = ['tr']
|
181
|
+
tagsl2 = ['td']
|
141
182
|
# tagsl1 = []
|
142
|
-
# tagsl2 = [
|
143
|
-
width = args[
|
144
|
-
heigth = args[
|
183
|
+
# tagsl2 = ['span']
|
184
|
+
width = args['width'] || '100%'
|
185
|
+
heigth = args['heigth'] || '20px'
|
145
186
|
else
|
146
|
-
tagsl0 =
|
187
|
+
tagsl0 = 'table'
|
188
|
+
tagsa0 = 'cellspacing="0"'
|
147
189
|
tagsl1 = []
|
148
|
-
tagsl2 = [
|
149
|
-
width = args[
|
150
|
-
heigth = args[
|
190
|
+
tagsl2 = ['tr', 'td']
|
191
|
+
width = args['width'] || '20px'
|
192
|
+
heigth = args['heigth'] || '140px'
|
151
193
|
end
|
152
194
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
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 <<
|
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 <<
|
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[
|
207
|
+
if !@variables['noTabBarButtons']
|
167
208
|
s = "#{style}Buttons"
|
168
|
-
o =
|
169
|
-
c =
|
170
|
-
if @variables[
|
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[
|
213
|
+
for b in @variables['tabBarButtons'].split(/[ ,;]/)
|
173
214
|
case b
|
174
|
-
when
|
215
|
+
when 'home', 'h'
|
175
216
|
buttons << home
|
176
|
-
when
|
217
|
+
when 'next', 'n'
|
177
218
|
buttons << nxt
|
178
|
-
when
|
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(%{ }), c].join
|
188
229
|
end
|
189
230
|
|
190
|
-
depth = args[
|
191
|
-
depth = depth ? depth.to_i :
|
192
|
-
inactivedepth = args[
|
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[
|
236
|
+
tabbarsep = @variables['tabBarSep'] || '|'
|
196
237
|
tabbarsep = /\s*#{Regexp.escape(tabbarsep)}\s*/
|
197
|
-
tabbarextra = @variables[
|
238
|
+
tabbarextra = @variables['tabBar'] || ['[auto]']
|
198
239
|
tabbarextra = tabbarextra.split(/\n/) if tabbarextra.kind_of?(String)
|
199
|
-
if @variables[
|
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 ==
|
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[
|
257
|
+
if args['spacer']
|
217
258
|
if horizontal
|
218
|
-
spacer = %{<img width="1px" height="#{height}" src="%s" alt="" />} % args[
|
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[
|
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[
|
267
|
+
if args['progressBar']
|
227
268
|
if horizontal
|
228
|
-
pb = invoke_service(
|
269
|
+
pb = invoke_service('progressBarVertical')
|
229
270
|
else
|
230
|
-
pb = invoke_service(
|
271
|
+
pb = invoke_service('progressBarHorizontal')
|
231
272
|
end
|
232
273
|
s = "#{style}Buttons"
|
233
|
-
o =
|
234
|
-
c =
|
235
|
-
i = invoke_service(
|
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 <<
|
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 = @
|
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[
|
266
|
-
width = args[
|
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 = @
|
313
|
+
idx = @deplate.output_index
|
339
314
|
if idx
|
340
|
-
idx = idx.to_i + delta
|
315
|
+
idx = idx.to_i + delta
|
341
316
|
if idx >= 0
|
342
|
-
|
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
|
-
|
353
|
-
|
354
|
-
return
|
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[
|
360
|
-
|
361
|
-
|
362
|
-
|
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
|
-
|
368
|
-
|
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
|
-
|
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,
|
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(
|
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 =
|
392
|
-
c =
|
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
|
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
|