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
@@ -0,0 +1,45 @@
1
+ # deplate.rb -- support for ActionPack's action_view
2
+ # @Author: Thomas Link (samul AT web de)
3
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
+ # @Created: 13-Apr-2006.
5
+ # @Last Change: 14-Apr-2006.
6
+ # @Revision: 0.12
7
+
8
+ module ActionView
9
+ module Helpers #:nodoc:
10
+ module TextHelper
11
+ begin
12
+ require_library_or_gem 'deplate/deplate-string'
13
+ unless defined?(DEPLATE_AUXBASEURL)
14
+ DEPLATE_AUXBASEURL = 'http://localhost:2500/'
15
+ end
16
+ o = DeplateString.deplate_options
17
+ o.input_def = 'deplate-restricted'
18
+ o.variables['headings'] = 'plain'
19
+ o.variables['htmlAuxUrl'] = [DEPLATE_AUXBASEURL, 'files/%s'].join
20
+
21
+ # Returns the text with all the deplate/viki codes turned into HTML-tags.
22
+ # <i>This method is only available if deplate/deplate-string can be required</i>.
23
+ def deplate(text, page_name=nil)
24
+ if text.blank?
25
+ ''
26
+ else
27
+ out = DeplateString.new(text)
28
+ if page_name
29
+ pn = page_name.gsub(/[^a-zA-Z0-9_]/, '_')
30
+ out.variables['auxiliaryDir'] = 'public/files/%s' % pn
31
+ out.variables['mandatoryID'] = false
32
+ else
33
+ out.variables['auxiliaryDir'] = 'public/files'
34
+ out.variables['mandatoryID'] = true
35
+ end
36
+ out.to_html
37
+ end
38
+ end
39
+ rescue LoadError
40
+ # We can't really help what's not there
41
+ end
42
+ end
43
+ end
44
+ end
45
+
@@ -4,15 +4,18 @@
4
4
  # @Website: http://deplate.sf.net/
5
5
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
6
6
  # @Created: 24-Feb-2004.
7
- # @Last Change: 16-Okt-2005.
7
+ # @Last Change: 28-Apr-2006.
8
8
 
9
9
  require 'profile' if ARGV[0] == '--profile'
10
10
 
11
11
  require 'deplate/core'
12
+
12
13
  require 'deplate/input'
13
14
  require 'deplate/output'
14
15
  require 'deplate/cache'
15
16
  require 'deplate/common'
17
+ require 'deplate/variables'
18
+ require 'deplate/counters'
16
19
  require 'deplate/etc'
17
20
  require 'deplate/elements'
18
21
  require 'deplate/regions'
@@ -21,6 +24,8 @@ require 'deplate/macros'
21
24
  require 'deplate/particles'
22
25
  require 'deplate/define'
23
26
  require 'deplate/template'
27
+ require 'deplate/skeletons'
28
+ require 'deplate/bib'
24
29
  require 'deplate/external'
25
30
  require 'deplate/metadata'
26
31
 
File without changes
@@ -0,0 +1,576 @@
1
+ # bib.rb
2
+ # @Author: Thomas Link (samul AT web de)
3
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
+ # @Created: 11-Feb-2006.
5
+ # @Last Change: 19-Feb-2006.
6
+ # @Revision: 0.48
7
+ #
8
+ # = Description
9
+ # = Usage
10
+ # = TODO
11
+ # = CHANGES
12
+
13
+ require "deplate/common"
14
+
15
+ module Deplate::Bib; end
16
+
17
+ class Deplate::Bib::Default < Deplate::CommonObject
18
+ class << self
19
+ # def hook_post_style=(name)
20
+ # klass = self
21
+ # Deplate::Core.class_eval {declare_bibstyle(klass, name)}
22
+ # end
23
+ def register_as(*names)
24
+ klass = self
25
+ names.each do |name|
26
+ Deplate::Core.class_eval {declare_bibstyle(klass, name)}
27
+ end
28
+ end
29
+ end
30
+
31
+ # class_attribute :style
32
+ # self.style = 'default'
33
+ register_as 'default'
34
+
35
+ def initialize(deplate)
36
+ @deplate = deplate
37
+ end
38
+
39
+ def bib_format(bibdef)
40
+ type = bib_get_value(bibdef, '@type').downcase
41
+ meth = "bib_#{type}"
42
+ unless self.respond_to?(meth, true)
43
+ meth = 'bib_default'
44
+ end
45
+ blocks = send(meth, bibdef)
46
+ bib_join(blocks)
47
+ end
48
+
49
+ def bib_cite(invoker)
50
+ container = invoker.container
51
+ args = invoker.args
52
+ n = args['n']
53
+ p = args['p']
54
+ np = args['np']
55
+ y = args['y']
56
+ acc = []
57
+ pmsg = @deplate.msg('p.\\ ')
58
+ for c in invoker.elt
59
+ cc = @deplate.formatter.bib_entry(c)
60
+ if cc
61
+ yr = cc.assoc('year')
62
+ yr = if yr then yr[1] else '' end
63
+ if p
64
+ p = @deplate.parse_and_format_without_wikinames(container, "#{pmsg}#{p}")
65
+ yr += ": #{p}"
66
+ # yr += ": " + p if p
67
+ end
68
+ if y
69
+ acc << referenced_bib_entry(invoker, c, yr)
70
+ else
71
+ nm = cc.assoc('author') || cc.assoc('editor') || cc.assoc('howpublished')
72
+ if nm
73
+ nm = nm[1]
74
+ nm = nm.gsub(/\s+/, ' ').split(' and ').collect do |a|
75
+ a.scan(/\w+$/)
76
+ end
77
+ nm = nm.join(', ')
78
+ acc << referenced_bib_entry(invoker, c, [nm, yr].join(' '))
79
+ else
80
+ acc << referenced_bib_entry(invoker, c, c)
81
+ end
82
+ end
83
+ end
84
+ end
85
+ n &&= n + @deplate.formatter.plain_text(' ', true)
86
+ acc = acc.join('; ')
87
+ if np
88
+ return %{#{@deplate.formatter.plain_text(' ', true)}#{n}#{acc}}
89
+ else
90
+ return %{#{@deplate.formatter.plain_text(' ', true)}(#{n}#{acc})}
91
+ end
92
+ end
93
+
94
+ private
95
+ def referenced_bib_entry(invoker, key, text)
96
+ if @deplate.variables['noBibClickableCitation']
97
+ text
98
+ else
99
+ @deplate.formatter.referenced_bib_entry(invoker, key, text)
100
+ end
101
+ end
102
+
103
+ def bib_get_value(bibdef, key)
104
+ val = bibdef.assoc(key)
105
+ if val
106
+ val = val[1]
107
+ val.gsub(/\s{2,}/, ' ')
108
+ end
109
+ end
110
+
111
+ def bib_join(bibblocks)
112
+ bibblocks.compact.join(' ')
113
+ end
114
+
115
+ def bib_block(*blocks)
116
+ if blocks
117
+ b = blocks.compact.join(' ').chomp
118
+ if b[-1..-1] !~ /[.!?]['"]?$/
119
+ b << '.'
120
+ end
121
+ b
122
+ end
123
+ end
124
+
125
+ def bib_inblock(*blocks)
126
+ if blocks
127
+ blocks.compact.join(', ').chomp
128
+ end
129
+ end
130
+
131
+ def bib_emphasize_title(text)
132
+ Deplate::Particle::Emphasize.markup(text)
133
+ end
134
+
135
+ def bib_default(bibdef)
136
+ authorship = bib_author(bibdef) || bib_editor(bibdef) || bib_institution(bibdef)
137
+ year = bib_year(bibdef)
138
+ title = bib_title(bibdef) || bib_booktitle(bibdef)
139
+ howpub = bib_journal(bibdef) || bib_publisher(bibdef) ||
140
+ bib_institution(bibdef) || bib_howpublished(bibdef) ||
141
+ bib_address(bibdef)
142
+ url = bib_url(bibdef)
143
+ [bib_block(authorship, year),
144
+ bib_block(bib_emphasize_title(title)),
145
+ bib_block(howpub),
146
+ url]
147
+ end
148
+
149
+ # author title journal year
150
+ # volume number month pages
151
+ def bib_article(bibdef)
152
+ author = bib_author(bibdef)
153
+ year = bib_year(bibdef)
154
+ title = bib_title(bibdef)
155
+ journal = bib_journal(bibdef)
156
+ volume = bib_volume(bibdef)
157
+ number = bib_number(bibdef)
158
+ month = bib_month(bibdef)
159
+ pages = bib_pages(bibdef)
160
+ url = bib_url(bibdef)
161
+ vol = if volume
162
+ if number
163
+ "#{volume}(#{number})"
164
+ else
165
+ volume
166
+ end
167
+ elsif month
168
+ @deplate.msg(month)
169
+ end
170
+ vol = if pages
171
+ if vol
172
+ "#{vol}:#{pages}"
173
+ else
174
+ pages
175
+ end
176
+ end
177
+ [bib_block(author, year),
178
+ bib_block(title),
179
+ bib_block(bib_emphasize_title(journal), vol),
180
+ url]
181
+ end
182
+
183
+ # author editor title booktitle publisher year
184
+ # volume number month series edition address
185
+ def bib_book(bibdef)
186
+ author = bib_author(bibdef) || bib_editor(bibdef)
187
+ year = bib_year(bibdef)
188
+ title = bib_title(bibdef) || bib_booktitle(bibdef)
189
+ pub = bib_publisher(bibdef)
190
+ volume = bib_volume(bibdef)
191
+ number = bib_number(bibdef)
192
+ month = bib_month(bibdef)
193
+ series = bib_series(bibdef)
194
+ edition = bib_edition(bibdef)
195
+ address = bib_address(bibdef)
196
+ url = bib_url(bibdef)
197
+ # [author, year, title, edition, pub, series]
198
+ [bib_block(author, year),
199
+ bib_block(bib_emphasize_title(title)),
200
+ bib_block(bib_inblock(pub, series)),
201
+ url]
202
+ end
203
+
204
+ # editor booktitle publisher year
205
+ # volume number month series edition address
206
+ def bib_book_collection(bibdef)
207
+ author = bib_editor(bibdef)
208
+ year = bib_year(bibdef)
209
+ title = bib_booktitle(bibdef)
210
+ pub = bib_publisher(bibdef)
211
+ volume = bib_volume(bibdef)
212
+ number = bib_number(bibdef)
213
+ month = bib_month(bibdef)
214
+ series = bib_series(bibdef)
215
+ edition = bib_edition(bibdef)
216
+ address = bib_address(bibdef)
217
+ url = bib_url(bibdef)
218
+ # [author, year, title, edition, pub, series]
219
+ [bib_block(author, year),
220
+ bib_block(bib_emphasize_title(title)),
221
+ bib_block(bib_inblock(pub, series)),
222
+ url]
223
+ end
224
+
225
+ # title
226
+ # author howpublished address month year
227
+ def bib_booklet(bibdef)
228
+ author = bib_editor(bibdef)
229
+ year = bib_year(bibdef)
230
+ title = bib_booktitle(bibdef)
231
+ how = bib_howpublished(bibdef)
232
+ month = bib_month(bibdef)
233
+ address = bib_address(bibdef)
234
+ url = bib_url(bibdef)
235
+ [bib_block(author, year),
236
+ bib_block(bib_emphasize_title(title)),
237
+ bib_block(bib_inblock(how, address)),
238
+ url]
239
+ end
240
+
241
+ # author title crossref pages chapter
242
+ # def bib_conference(bibdef)
243
+ # # <+TBD+>
244
+ # end
245
+
246
+ # author editor title chapter pages publisher year
247
+ # volume number month series edition address
248
+ def bib_inbook(bibdef)
249
+ author = bib_author(bibdef) || bib_editor(bibdef)
250
+ year = bib_year(bibdef)
251
+ title = bib_title(bibdef) || bib_booktitle(bibdef)
252
+ where = bib_chapter(bibdef)
253
+ pages = bib_pages(bibdef)
254
+ pub = bib_publisher(bibdef)
255
+ volume = bib_volume(bibdef)
256
+ number = bib_number(bibdef)
257
+ month = bib_month(bibdef)
258
+ series = bib_series(bibdef)
259
+ edition = bib_edition(bibdef)
260
+ address = bib_address(bibdef)
261
+ url = bib_url(bibdef)
262
+ [bib_block(author, year),
263
+ bib_block(bib_inblock(chapter, pages)),
264
+ bib_block(@deplate.msg('In:'), bib_emphasize_title(title)),
265
+ bib_block(bib_inblock(pub, series)),
266
+ url]
267
+ end
268
+
269
+ # author title crossref pages chapter
270
+ def bib_incollection(bibdef)
271
+ author = bib_author(bibdef)
272
+ editor = bib_editor(bibdef)
273
+ year = bib_year(bibdef)
274
+ title = bib_title(bibdef)
275
+ book = bib_booktitle(bibdef)
276
+ chapter = bib_chapter(bibdef)
277
+ pages = bib_pages(bibdef)
278
+ pages &&= [@deplate.msg('p.\\ '), pages].join
279
+ pub = bib_publisher(bibdef)
280
+ volume = bib_volume(bibdef)
281
+ number = bib_number(bibdef)
282
+ month = bib_month(bibdef)
283
+ series = bib_series(bibdef)
284
+ edition = bib_edition(bibdef)
285
+ address = bib_address(bibdef)
286
+ url = bib_url(bibdef)
287
+ [bib_block(author, year),
288
+ bib_block(title),
289
+ bib_block([@deplate.msg('In:'), editor].join(' ')),
290
+ bib_block(bib_emphasize_title(book)),
291
+ bib_block(bib_inblock(pub, series)),
292
+ bib_block(bib_inblock(chapter, pages)),
293
+ url]
294
+ end
295
+
296
+ # author title crossref pages chapter
297
+ def bib_inproceedings(bibdef)
298
+ # <+TBD+>
299
+ bib_inbook(bibdef)
300
+ end
301
+
302
+ # title
303
+ # author organization address edition month year
304
+ def bib_manual(bibdef)
305
+ author = bib_author(bibdef) || bib_organization(bibdef)
306
+ year = bib_year(bibdef)
307
+ title = bib_title(bibdef)
308
+ how = bib_organization(bibdef)
309
+ month = bib_month(bibdef)
310
+ address = bib_address(bibdef)
311
+ url = bib_url(bibdef)
312
+ [bib_block(author, year),
313
+ bib_block(bib_emphasize_title(title)),
314
+ bib_block(bib_inblock(how, address)),
315
+ url]
316
+ end
317
+
318
+ # author title school year
319
+ # type address month
320
+ def bib_masterthesis(bibdef)
321
+ author = bib_author(bibdef)
322
+ year = bib_year(bibdef)
323
+ title = bib_title(bibdef)
324
+ how = bib_school(bibdef)
325
+ month = bib_month(bibdef)
326
+ address = bib_address(bibdef)
327
+ url = bib_url(bibdef)
328
+ [bib_block(author, year),
329
+ bib_block(bib_emphasize_title(title)),
330
+ bib_block(bib_inblock(how, address)),
331
+ url]
332
+ end
333
+
334
+ # author title howpublished month year
335
+ def bib_misc(bibdef)
336
+ author = bib_author(bibdef)
337
+ year = bib_year(bibdef)
338
+ title = bib_title(bibdef)
339
+ how = bib_howpublished(bibdef)
340
+ month = bib_month(bibdef)
341
+ address = bib_address(bibdef)
342
+ url = bib_url(bibdef)
343
+ [bib_block(author, year),
344
+ bib_block(bib_emphasize_title(title)),
345
+ bib_block(bib_inblock(how, address)),
346
+ url]
347
+ end
348
+
349
+ # author title school year
350
+ # type address month
351
+ def bib_phdthesis(bibdef)
352
+ author = bib_author(bibdef)
353
+ year = bib_year(bibdef)
354
+ title = bib_booktitle(bibdef)
355
+ how = bib_school(bibdef)
356
+ month = bib_month(bibdef)
357
+ address = bib_address(bibdef)
358
+ type = bib_type(bibdef)
359
+ url = bib_url(bibdef)
360
+ [bib_block(author, year),
361
+ bib_block(bib_inblock(bib_emphasize_title(title), type)),
362
+ bib_block(bib_inblock(how, address)),
363
+ url]
364
+ end
365
+
366
+ # title year
367
+ # editor volume number series address month organization publisher
368
+ def bib_proceedings(bibdef)
369
+ author = bib_editor(bibdef) || bib_organization(bibdef)
370
+ year = bib_year(bibdef)
371
+ title = bib_booktitle(bibdef)
372
+ volume = bib_volume(bibdef)
373
+ number = bib_number(bibdef)
374
+ month = bib_month(bibdef)
375
+ series = bib_series(bibdef)
376
+ address = bib_address(bibdef)
377
+ pub = bib_publisher(bibdef)
378
+ url = bib_url(bibdef)
379
+ [bib_block(author, year),
380
+ bib_block(bib_emphasize_title(title)),
381
+ bib_block(bib_inblock(pub, series, address)),
382
+ url]
383
+ end
384
+
385
+ # author title institution year
386
+ # type number address month
387
+ def bib_techreport(bibdef)
388
+ author = bib_author(bibdef) || bib_institution(bibdef)
389
+ year = bib_year(bibdef)
390
+ title = bib_title(bibdef)
391
+ how = bib_institution(bibdef)
392
+ pub = bib_publisher(bibdef)
393
+ type = bib_type(bibdef)
394
+ number = bib_number(bibdef)
395
+ month = bib_month(bibdef)
396
+ address = bib_address(bibdef)
397
+ url = bib_url(bibdef)
398
+ [bib_block(author, year),
399
+ bib_block(bib_inblock(bib_emphasize_title(title), type)),
400
+ bib_block(how),
401
+ bib_block(bib_inblock(pub, address)),
402
+ url]
403
+ end
404
+
405
+ # author title note
406
+ # month year
407
+ def bib_unpublished(bibdef)
408
+ author = bib_author(bibdef)
409
+ year = bib_year(bibdef)
410
+ title = bib_booktitle(bibdef)
411
+ note = bib_note(bibdef)
412
+ month = bib_month(bibdef)
413
+ url = bib_url(bibdef)
414
+ [bib_block(author, year),
415
+ bib_block(bib_emphasize_title(title)),
416
+ bib_block(note),
417
+ url]
418
+ end
419
+
420
+ def bib_address(bibdef)
421
+ bib_get_value(bibdef, 'address')
422
+ end
423
+
424
+ def bib_author(bibdef)
425
+ au = bib_get_value(bibdef, 'author')
426
+ if au
427
+ reformat_authors(au)
428
+ end
429
+ end
430
+
431
+ def bib_booktitle(bibdef)
432
+ bib_get_value(bibdef, 'booktitle')
433
+ end
434
+
435
+ def bib_chapter(bibdef)
436
+ ch = bib_get_value(bibdef, 'chapter')
437
+ [@deplate.msg('Chapter'), ch].join(' ') if ch
438
+ end
439
+
440
+ def bib_edition(bibdef)
441
+ ed = bib_get_value(bibdef, 'edition')
442
+ [ed, @deplate.msg('Edition')].join(' ') if ed
443
+ end
444
+
445
+ def bib_editor(bibdef)
446
+ ed = bib_get_value(bibdef, 'editor')
447
+ if ed
448
+ ed = reformat_editors(ed)
449
+ [ed, '\\ (', @deplate.msg('Ed.'), ')'].join
450
+ end
451
+ end
452
+
453
+ def bib_howpublished(bibdef)
454
+ bib_get_value(bibdef, 'howpublished')
455
+ end
456
+
457
+ def bib_institution(bibdef)
458
+ bib_get_value(bibdef, 'institution')
459
+ end
460
+
461
+ def bib_journal(bibdef)
462
+ bib_get_value(bibdef, 'journal')
463
+ end
464
+
465
+ def bib_key(bibdef)
466
+ bib_get_value(bibdef, 'key')
467
+ end
468
+
469
+ def bib_keywords(bibdef)
470
+ bib_get_value(bibdef, 'keywords')
471
+ end
472
+
473
+ def bib_month(bibdef)
474
+ mo = bib_get_value(bibdef, 'month')
475
+ mo ? @deplate.msg(mo) : nil
476
+ end
477
+
478
+ def bib_note(bibdef)
479
+ bib_get_value(bibdef, 'note')
480
+ end
481
+
482
+ def bib_number(bibdef)
483
+ bib_get_value(bibdef, 'number')
484
+ end
485
+
486
+ def bib_organization(bibdef)
487
+ bib_get_value(bibdef, 'organization')
488
+ end
489
+
490
+ def bib_pages(bibdef)
491
+ bib_get_value(bibdef, 'pages')
492
+ end
493
+
494
+ def bib_publisher(bibdef)
495
+ bib_get_value(bibdef, 'publisher')
496
+ end
497
+
498
+ def bib_school(bibdef)
499
+ bib_get_value(bibdef, 'school')
500
+ end
501
+
502
+ def bib_series(bibdef)
503
+ bib_get_value(bibdef, 'series')
504
+ end
505
+
506
+ def bib_title(bibdef)
507
+ bib_get_value(bibdef, 'title')
508
+ end
509
+
510
+ def bib_type(bibdef)
511
+ bib_get_value(bibdef, 'type')
512
+ end
513
+
514
+ def bib_url(bibdef)
515
+ url = bib_get_value(bibdef, 'url')
516
+ date = bib_get_value(bibdef, 'access')
517
+ msg = date ? 'Available online at (%s):' : 'Available online at:'
518
+ [@deplate.msg(msg), url].join(' ') if url
519
+ end
520
+
521
+ def bib_volume(bibdef)
522
+ bib_get_value(bibdef, 'volume')
523
+ end
524
+
525
+ def bib_year(bibdef)
526
+ y = bib_get_value(bibdef, 'year')
527
+ ['(', y, ')'].join if y
528
+ end
529
+
530
+ def reformat_authors(text)
531
+ if text
532
+ namesep = @deplate.variables['bibSepName'] || bibSepName
533
+ authorsep = @deplate.variables['bibSepAuthors'] || bibSepAuthors
534
+ twosep = @deplate.variables['bibSepTwoAuthors'] || bibSepTwoAuthors
535
+ lastsep = @deplate.variables['bibSepLastAuthor'] || bibSepLastAuthor
536
+ authors = Deplate::Core.authors_split(text)
537
+ authorsn = authors.size
538
+ authorsn1 = authors.size - 1
539
+ authorsn2 = authors.size - 2
540
+ au = []
541
+ authors.each_with_index do |a, i|
542
+ m = /^((.+?)?\s+)?(\S+)$/.match(a.strip)
543
+ if m[2]
544
+ au << reformat_author_name(m[2], m[3], namesep)
545
+ else
546
+ au << a
547
+ end
548
+ if i < authorsn2
549
+ au << authorsep
550
+ elsif i < authorsn1
551
+ au << (authorsn == 2 ? twosep : lastsep)
552
+ end
553
+ end
554
+ return au.join
555
+ end
556
+ end
557
+
558
+ alias :reformat_editors :reformat_authors
559
+
560
+ def reformat_author_name(firstname, name, sep)
561
+ [name, sep, firstname].join
562
+ end
563
+
564
+ def bibSepName
565
+ ', '
566
+ end
567
+
568
+ def bibSepAuthors
569
+ '; '
570
+ end
571
+
572
+ alias :bibSepTwoAuthors :bibSepAuthors
573
+ alias :bibSepLastAuthor :bibSepAuthors
574
+
575
+ end
576
+