deplate 0.8 → 0.8.1
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.
- data/AUTHORS.TXT +19 -16
- data/CHANGES.TXT +214 -248
- data/NEWS.TXT +47 -30
- data/README.TXT +0 -1
- data/TODO.TXT +93 -20
- data/VERSION.TXT +1 -1
- data/bin/deplate.exy +192 -0
- data/etc/deplate.ini +70 -9
- data/lib/action_view/helpers/deplate.rb +33 -33
- data/lib/deplate.rb +2 -2
- data/lib/deplate/bib.rb +72 -41
- data/lib/deplate/builtin.rb +1 -1
- data/lib/deplate/cache.rb +1 -1
- data/lib/deplate/commands.rb +161 -102
- data/lib/deplate/common.rb +93 -7
- data/lib/deplate/converter.rb +10 -4
- data/lib/deplate/core.rb +215 -108
- data/lib/deplate/counters.rb +23 -8
- data/lib/deplate/css/article.css +9 -5
- data/lib/deplate/css/deplate.css +37 -3
- data/lib/deplate/css/heading-navbar.css +1 -1
- data/lib/deplate/css/highstep.css +18 -0
- data/lib/deplate/css/htmldoc.css +43 -0
- data/lib/deplate/css/layout-deplate-print.css +1 -1
- data/lib/deplate/css/layout-deplate.css +1 -1
- data/lib/deplate/css/play.css +101 -0
- data/lib/deplate/css/sans-serif.css +1 -1
- data/lib/deplate/css/serif-e.css +1 -1
- data/lib/deplate/css/serif-rel.css +1 -1
- data/lib/deplate/css/serif.css +1 -1
- data/lib/deplate/css/slides.css +1 -1
- data/lib/deplate/css/styles.css +4 -0
- data/lib/deplate/css/tabbar-right.css +54 -8
- data/lib/deplate/css/tabbar-top.css +28 -9
- data/lib/deplate/css/text-sans-serif.css +1 -1
- data/lib/deplate/css/text-serif.css +1 -1
- data/lib/deplate/define.rb +71 -38
- data/lib/deplate/deplate-string.rb +3 -3
- data/lib/deplate/docbook.rb +9 -9
- data/lib/deplate/elements.rb +173 -84
- data/lib/deplate/etc.rb +6 -8
- data/lib/deplate/external.rb +9 -5
- data/lib/deplate/fmt/dbk-article-4.1.2.rb +4 -3
- data/lib/deplate/fmt/dbk-article.rb +9 -8
- data/lib/deplate/fmt/dbk-book.rb +4 -3
- data/lib/deplate/fmt/dbk-ref.rb +5 -4
- data/lib/deplate/fmt/dbk-slides.rb +4 -3
- data/lib/deplate/fmt/dbk-snippet.rb +4 -3
- data/lib/deplate/fmt/html-snippet.rb +1 -1
- data/lib/deplate/fmt/html.rb +186 -46
- data/lib/deplate/fmt/htmlsite.rb +19 -9
- data/lib/deplate/fmt/htmlslides.rb +1 -1
- data/lib/deplate/fmt/htmlwebsite.rb +1 -1
- data/lib/deplate/fmt/latex-dramatist.rb +175 -0
- data/lib/deplate/fmt/latex-snippet.rb +1 -1
- data/lib/deplate/fmt/latex.rb +132 -80
- data/lib/deplate/fmt/null.rb +1 -1
- data/lib/deplate/fmt/php.rb +1 -1
- data/lib/deplate/fmt/phpsite.rb +1 -1
- data/lib/deplate/fmt/plain.rb +16 -9
- data/lib/deplate/fmt/template.rb +1 -1
- data/lib/deplate/fmt/xhtml10t.rb +1 -1
- data/lib/deplate/formatter-snippet.rb +1 -1
- data/lib/deplate/formatter.rb +272 -81
- data/lib/deplate/guesslanguage.rb +57 -0
- data/lib/deplate/input.rb +205 -50
- data/lib/deplate/input/deplate-headings.rb +9 -11
- data/lib/deplate/input/deplate-restricted.rb +3 -23
- data/lib/deplate/input/deplate.rb +1 -1
- data/lib/deplate/input/play.rb +208 -0
- data/lib/deplate/input/rdoc.rb +37 -15
- data/lib/deplate/input/template.rb +6 -11
- data/lib/deplate/lib/Makefile.config +53 -4
- data/lib/deplate/lib/html/parbreak +3 -0
- data/lib/deplate/lib/javascript/StepwiseNextPage.js +8 -0
- data/lib/deplate/lib/javascript/StepwiseNextPage_confirm.js +8 -0
- data/lib/deplate/lib/latex/deplate.sty +36 -0
- data/lib/deplate/lib/latex/parbreak +6 -0
- data/lib/deplate/lib/php/page-comment.inc.php +5 -5
- data/lib/deplate/lib/plain/parbreak +6 -0
- data/lib/deplate/locale/de.latin1 +87 -15
- data/lib/deplate/locale/de.latin1_data +60 -0
- data/lib/deplate/locale/en.latin1_data +46 -0
- data/lib/deplate/locale/fr.latin1_data +74 -0
- data/lib/deplate/locale/ru.koi8-r_data +63 -0
- data/lib/deplate/locale/{zh_cn.gb2312 → zh_CN.GB2312} +0 -0
- data/lib/deplate/macros.rb +106 -32
- data/lib/deplate/messages.rb +22 -8
- data/lib/deplate/metadata.rb +1 -1
- data/lib/deplate/metadata/marshal.rb +1 -1
- data/lib/deplate/metadata/xml.rb +1 -1
- data/lib/deplate/metadata/yaml.rb +1 -1
- data/lib/deplate/mod/anyword.rb +4 -4
- data/lib/deplate/mod/babelfish.rb +1 -1
- data/lib/deplate/mod/code-gvim.rb +14 -8
- data/lib/deplate/mod/code-gvim71.rb +52 -0
- data/lib/deplate/mod/code-highlight.rb +35 -19
- data/lib/deplate/mod/colored-log.rb +1 -1
- data/lib/deplate/mod/endnotes.rb +1 -1
- data/lib/deplate/mod/guesslanguage.rb +75 -0
- data/lib/deplate/mod/html-asciimath.rb +1 -1
- data/lib/deplate/mod/html-deplate-button.rb +1 -1
- data/lib/deplate/mod/html-headings-navbar.rb +1 -1
- data/lib/deplate/mod/html-highstep.rb +43 -0
- data/lib/deplate/mod/html-jsmath.rb +1 -1
- data/lib/deplate/mod/html-obfuscate-email.rb +1 -1
- data/lib/deplate/mod/html-sidebar.rb +1 -1
- data/lib/deplate/mod/iconv.rb +1 -1
- data/lib/deplate/mod/imgurl.rb +1 -1
- data/lib/deplate/mod/inlatex-compound.rb +1 -1
- data/lib/deplate/mod/koma.rb +4 -4
- data/lib/deplate/mod/{de.rb → lang-de.rb} +1 -1
- data/lib/deplate/mod/{en.rb → lang-en.rb} +1 -1
- data/lib/deplate/mod/{ru_koi8-r.rb → lang-ru-koi8-r.rb} +1 -1
- data/lib/deplate/mod/lang-ru.rb +9 -0
- data/lib/deplate/mod/{zh-cn-autospace.rb → lang-zh_CN-autospace.rb} +3 -3
- data/lib/deplate/mod/{zh-cn.rb → lang-zh_CN.rb} +8 -8
- data/lib/deplate/mod/latex-emph-table-head.rb +1 -1
- data/lib/deplate/mod/latex-styles.rb +6 -6
- data/lib/deplate/mod/latex-verbatim-small.rb +1 -1
- data/lib/deplate/mod/linkmap.rb +128 -0
- data/lib/deplate/mod/makefile.rb +23 -22
- data/lib/deplate/mod/mark-external-urls.rb +13 -7
- data/lib/deplate/mod/markup-1-warn.rb +1 -1
- data/lib/deplate/mod/markup-1.rb +1 -1
- data/lib/deplate/mod/navbar-png.rb +5 -4
- data/lib/deplate/mod/noindent.rb +1 -1
- data/lib/deplate/mod/numpara.rb +1 -1
- data/lib/deplate/mod/particle-math.rb +1 -1
- data/lib/deplate/mod/php-extra.rb +1 -1
- data/lib/deplate/mod/pstoedit.rb +1 -1
- data/lib/deplate/mod/recode.rb +1 -1
- data/lib/deplate/mod/smart-dash.rb +1 -1
- data/lib/deplate/mod/smiley.rb +1 -1
- data/lib/deplate/mod/soffice.rb +1 -1
- data/lib/deplate/mod/symbols-latin1.rb +1 -1
- data/lib/deplate/mod/symbols-od-utf-8.rb +1 -1
- data/lib/deplate/mod/symbols-plain.rb +1 -1
- data/lib/deplate/mod/symbols-sgml.rb +1 -1
- data/lib/deplate/mod/symbols-utf-8.rb +1 -1
- data/lib/deplate/mod/symbols-xml.rb +1 -1
- data/lib/deplate/mod/syntax-region-alt.rb +1 -1
- data/lib/deplate/mod/utf8.rb +1 -1
- data/lib/deplate/mod/validate-html.rb +1 -1
- data/lib/deplate/mod/xmlrpc.rb +37 -36
- data/lib/deplate/nukumi2.rb +4 -4
- data/lib/deplate/once-method.rb +1 -1
- data/lib/deplate/output.rb +12 -4
- data/lib/deplate/particles.rb +52 -22
- data/lib/deplate/regions.rb +160 -90
- data/lib/deplate/skeletons.rb +4 -3
- data/lib/deplate/structured.rb +19 -13
- data/lib/deplate/template.rb +17 -9
- data/lib/deplate/templates/html-doc.html +8 -11
- data/lib/deplate/templates/html-tabbar-right.html +1 -1
- data/lib/deplate/templates/html-tabbar-top.html +3 -3
- data/lib/deplate/variables.rb +25 -9
- data/lib/deplate/wiki-markup.rb +14 -3
- data/lib/deplate/xml.rb +3 -4
- data/lib/deplate/{zh-cn.rb → zh_CN.rb} +16 -16
- data/man/man1/deplate.1 +80 -65
- metadata +72 -48
- data/lib/deplate/mod/fr.rb +0 -46
data/etc/deplate.ini
CHANGED
|
@@ -73,10 +73,17 @@
|
|
|
73
73
|
|
|
74
74
|
; codeSyntax :: The default syntax for #Code regions (STRING)
|
|
75
75
|
|
|
76
|
+
; commentsShow :: Display comments in the output (BOOLEAN = any comment
|
|
77
|
+
; or STRING = comments with this prefix/marker)
|
|
78
|
+
|
|
76
79
|
; description :: A short description of the document (STRING)
|
|
77
80
|
|
|
78
81
|
; docBasename :: The base name of the output document (STRING)
|
|
79
82
|
|
|
83
|
+
; efilter :: Include only elements in the output that are tagged with
|
|
84
|
+
; one of these tags. ''any'' matched untagged elements.
|
|
85
|
+
; (COMMA-SEPARATED LIST)
|
|
86
|
+
|
|
80
87
|
; elementStyle :: If set to 'block', the markup of styles changes. For
|
|
81
88
|
; LaTeX output, this make ''deplate'' use regions. You can set this
|
|
82
89
|
; for single elements too. (STRING)
|
|
@@ -91,6 +98,10 @@
|
|
|
91
98
|
; HTML :: ISO-8859-1
|
|
92
99
|
; LaTeX :: latin1
|
|
93
100
|
; XML :: UTF-8
|
|
101
|
+
; - In order to set the encoding do:
|
|
102
|
+
; ''#VAR: encoding=utf-8''
|
|
103
|
+
; - To set the encoding for HTML output only:
|
|
104
|
+
; ''#VAR fmt=html: encoding=utf-8''
|
|
94
105
|
|
|
95
106
|
; figureNumbering :: How figures should be numbered (STRING)
|
|
96
107
|
; flat, document :: One counter for all figures
|
|
@@ -117,6 +128,8 @@
|
|
|
117
128
|
|
|
118
129
|
; imgSfx :: The default suffix for images (STRING, default: png)
|
|
119
130
|
|
|
131
|
+
; includeVars :: The variables to be used for #INC commands (HASH)
|
|
132
|
+
|
|
120
133
|
; indexwiki :: If "no", don't autoindex extended wiki links (STRING)
|
|
121
134
|
; - <+TBD+>This will be subject of change
|
|
122
135
|
|
|
@@ -126,6 +139,9 @@
|
|
|
126
139
|
; inlatexHeight, inlineLatexHeight :: Define the ''h'' parameter of
|
|
127
140
|
; images generated by an inline LaTeX snippet (NUMBER)
|
|
128
141
|
|
|
142
|
+
; itemizeMarkers :: The markers for itemize lists (currently only
|
|
143
|
+
; used for plain text output) (COMMA-SEPARATED LIST)
|
|
144
|
+
|
|
129
145
|
; ltxPointsize :: The pointsize used for LaTeX snippets; this can be
|
|
130
146
|
; overridden by a per-element 'pointsize' argument; see also
|
|
131
147
|
; [[#ps2imgRes][ps2imgRes]] (NUMBER, default: 10)
|
|
@@ -134,7 +150,7 @@
|
|
|
134
150
|
; (STRING, default: dependent on the output format)
|
|
135
151
|
|
|
136
152
|
; keywords :: The keyword to categorize the document; either an array
|
|
137
|
-
; of strings or a list separated by
|
|
153
|
+
; of strings or a list separated by semi-colons
|
|
138
154
|
|
|
139
155
|
; levelshift :: Shift heading levels (NUMBER)
|
|
140
156
|
|
|
@@ -144,6 +160,9 @@
|
|
|
144
160
|
; mandatoryID :: If set, elements that create auxiliary files must
|
|
145
161
|
; have an ID (BOOLEAN)
|
|
146
162
|
|
|
163
|
+
; mark1stStyle :: If set, use the style to markup the ''mark1st''
|
|
164
|
+
; macro (STRING)
|
|
165
|
+
|
|
147
166
|
; mathPrelude :: Like ''inlatexPrelude'' but used for the ''math''
|
|
148
167
|
; macro only
|
|
149
168
|
|
|
@@ -156,6 +175,10 @@
|
|
|
156
175
|
; pdfOutput :: Automatically set when using pdf output (the ''--pdf''
|
|
157
176
|
; command line switch) (BOOLEAN)
|
|
158
177
|
|
|
178
|
+
; pfilter :: Include only particles in the output that are tagged
|
|
179
|
+
; with one of these tags. ''any'' matched untagged particles.
|
|
180
|
+
; (COMMA-SEPARATED LIST)
|
|
181
|
+
|
|
159
182
|
; prefixID :: Prefix autogenerated names for auxiliary files with
|
|
160
183
|
; this string; if not defined, use the current document's base
|
|
161
184
|
; name (STRING)
|
|
@@ -175,6 +198,9 @@
|
|
|
175
198
|
; using multi-file output and when redirecting the output to
|
|
176
199
|
; STDOUT (STRING)
|
|
177
200
|
|
|
201
|
+
; styledTags :: If set, tags will automatically style an element with
|
|
202
|
+
; style "TAG#\{tagname\}" (BOOLEAN)
|
|
203
|
+
|
|
178
204
|
; suffix :: The suffix to be used when guessing target names
|
|
179
205
|
; referenced by wiki names (STRING)
|
|
180
206
|
; - <+TBD+>This will be subject of change
|
|
@@ -189,11 +215,16 @@
|
|
|
189
215
|
; tabwidth :: The tab width used when expanding whitespace (NUMBER,
|
|
190
216
|
; default: 4)
|
|
191
217
|
|
|
218
|
+
; tag :: Tag all elements with these tags (COMMA-SEPARATED LIST)
|
|
219
|
+
|
|
192
220
|
; template :: The default template for the output (STRING)
|
|
193
221
|
|
|
194
222
|
; template_version :: Which template engine to use (NUMBER,
|
|
195
223
|
; default: 2)
|
|
196
224
|
|
|
225
|
+
; useParentSuffix :: When referring to other files, use the source
|
|
226
|
+
; file's suffix as fallback strategy (BOOL, default; false)
|
|
227
|
+
|
|
197
228
|
; verbatimMargin :: Wrap verbatim regions at this width (NUMBER)
|
|
198
229
|
|
|
199
230
|
|
|
@@ -207,12 +238,15 @@
|
|
|
207
238
|
|
|
208
239
|
; bodyOptions :: The arguments passed to the ''body'' tag (STRING)
|
|
209
240
|
|
|
210
|
-
; css :: The document's CSS file(s) (LIST
|
|
241
|
+
; css :: The document's CSS file(s) (COMMA-SEPARATED LIST)
|
|
211
242
|
; - The output media can be defined in the form: CSS|MEDIA
|
|
212
243
|
|
|
213
244
|
; cssExtra :: Some extra text to be inserted at css position
|
|
214
245
|
; (STRING or ARRAY OF STRINGS)
|
|
215
246
|
|
|
247
|
+
; cssInclude :: Include the contents of the CSS file in the HTML output
|
|
248
|
+
; (BOOLEAN)
|
|
249
|
+
|
|
216
250
|
; docNavbar :: If true, display a navigation bar (BOOLEAN)
|
|
217
251
|
|
|
218
252
|
; explorerHack :: Code to deal with browser-specific stuff; inserted
|
|
@@ -230,6 +264,15 @@
|
|
|
230
264
|
; metaDataExtra :: Other HTML code to be inserted
|
|
231
265
|
; at head position (STRING or ARRAY OF STRINGS)
|
|
232
266
|
|
|
267
|
+
; newsFeed :: An array of strings defining news feeds for the current
|
|
268
|
+
; site. (STRING or ARRAY OF STRINGS)
|
|
269
|
+
; - Entry format (please enclose the arguments in quotations marks):
|
|
270
|
+
; - ''rss="URL" title="Title"''
|
|
271
|
+
; - ''atom="URL" title="Title"''
|
|
272
|
+
; - ''href="URL" title="Title"'' (defaults to ''rss'')
|
|
273
|
+
; - ''type=rss href="URL" title="Title"''
|
|
274
|
+
; - ''type=atom href="URL" title="Title"''
|
|
275
|
+
|
|
233
276
|
; nextButton :: The "next" button in the navigation bar
|
|
234
277
|
; (STRING, default: >>)
|
|
235
278
|
|
|
@@ -268,10 +311,11 @@
|
|
|
268
311
|
; 1){lab: stepwiseBegin}
|
|
269
312
|
|
|
270
313
|
; stepwiseContinous :: Automatically move to the next page if all elements
|
|
271
|
-
; are displayed
|
|
314
|
+
; are displayed. If the value is ''confirm'' the user will be
|
|
315
|
+
; queried before moving to the next page. (MIXED, default: false)
|
|
272
316
|
|
|
273
317
|
; stepwiseKey :: Key code for revealing the next element (COMMA-SEPARATED
|
|
274
|
-
; LIST; default:
|
|
318
|
+
; LIST; default: 34 = '\PageDn'){lab: stepwiseKey}
|
|
275
319
|
|
|
276
320
|
; styleExtra :: Some extra CSS information that will be wrapped in a
|
|
277
321
|
; style tag (STRING or ARRAY OF STRINGS)
|
|
@@ -302,13 +346,19 @@
|
|
|
302
346
|
|
|
303
347
|
|
|
304
348
|
; **** LaTeX
|
|
305
|
-
;
|
|
306
|
-
;
|
|
349
|
+
; bookClass :: Classes that use a ''\\chapter{}'' command
|
|
350
|
+
; (COMMA-SEPARATED LIST or BOOLEAN)
|
|
307
351
|
|
|
308
|
-
;
|
|
352
|
+
; classOptions :: Options passed on to the document class
|
|
353
|
+
; (COMMA-SEPARATED LIST)
|
|
354
|
+
|
|
355
|
+
; typeareaDIV, DIV (koma) :: If set, use KOMA script's typearea package; use this
|
|
309
356
|
; variable to define the proportion of the printed area on a page;
|
|
310
357
|
; see the KOMA script manual for details (NUMBER)
|
|
311
358
|
|
|
359
|
+
; typeareaDIV_, DIV_ (koma) :: Same as the above but the parameter is
|
|
360
|
+
; set as a document class option.
|
|
361
|
+
|
|
312
362
|
; floatHere :: If true, add a ''h'' flag to floats (BOOLEAN,
|
|
313
363
|
; default: false)
|
|
314
364
|
|
|
@@ -355,7 +405,7 @@
|
|
|
355
405
|
; anyword_catalog :: A catalog file containing automatically linked
|
|
356
406
|
; words (STRING)
|
|
357
407
|
|
|
358
|
-
; anyword_list :: A comma
|
|
408
|
+
; anyword_list :: A comma-separated list of automatically linked
|
|
359
409
|
; words (STRING)
|
|
360
410
|
|
|
361
411
|
; anyword_pattern :: A glob pattern for file names in the current
|
|
@@ -398,6 +448,9 @@
|
|
|
398
448
|
; urlIcon :: The file name of the external URL icon (STRING,
|
|
399
449
|
; default: url.png)
|
|
400
450
|
|
|
451
|
+
; markerInFrontOfURL :: Put the icon in front of the URL (BOOLEAN,
|
|
452
|
+
; default: false)
|
|
453
|
+
|
|
401
454
|
|
|
402
455
|
; **** navbar-png
|
|
403
456
|
; buttonsColour :: The subtype of the button images
|
|
@@ -435,7 +488,7 @@
|
|
|
435
488
|
|
|
436
489
|
|
|
437
490
|
; **** XMLRPC
|
|
438
|
-
; xmlrpcAllow :: A
|
|
491
|
+
; xmlrpcAllow :: A comma-separated list of valid IP addresses of
|
|
439
492
|
; regular expressions matching valid addresses
|
|
440
493
|
|
|
441
494
|
; xmlrpcPath :: The path for accessing this xmlrpc server (STRING,
|
|
@@ -447,3 +500,11 @@
|
|
|
447
500
|
; requests were part of one big document (BOOLEAN, default: nil)
|
|
448
501
|
|
|
449
502
|
|
|
503
|
+
; *** Legacy
|
|
504
|
+
; legacyDefine1 :: Make #Define type of regions behave as in
|
|
505
|
+
; version up to 0.8 (alternatively, you can pass a noTemplate!
|
|
506
|
+
; argument to the region)
|
|
507
|
+
|
|
508
|
+
; legacyFor1 :: Make #For behave as in version up to 0.8 (alternatively,
|
|
509
|
+
; you can pass a noTemplate! argument to the region)
|
|
510
|
+
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
# deplate.rb -- support for ActionPack's action_view
|
|
2
|
-
# @Author: Thomas Link (
|
|
2
|
+
# @Author: Thomas Link (micathom AT gmail com)
|
|
3
3
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
4
4
|
# @Created: 13-Apr-2006.
|
|
5
|
-
# @Last Change:
|
|
6
|
-
# @Revision: 0.
|
|
5
|
+
# @Last Change: 2007-07-07.
|
|
6
|
+
# @Revision: 0.16
|
|
7
7
|
|
|
8
8
|
module ActionView
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
25
|
''
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
else
|
|
27
|
+
out = DeplateString.new(text)
|
|
28
|
+
if page_name
|
|
29
|
+
pn = page_name.gsub(/[^a-zA-Z0-9_]/, '_')
|
|
30
|
+
out.deplate_options.variables['auxiliaryDir'] = 'public/files/%s' % pn
|
|
31
|
+
out.deplate_options.variables['mandatoryID'] = false
|
|
32
|
+
else
|
|
33
|
+
out.deplate_options.variables['auxiliaryDir'] = 'public/files'
|
|
34
|
+
out.deplate_options.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
|
|
35
41
|
end
|
|
36
|
-
out.to_html
|
|
37
|
-
end
|
|
38
42
|
end
|
|
39
|
-
rescue LoadError
|
|
40
|
-
# We can't really help what's not there
|
|
41
|
-
end
|
|
42
43
|
end
|
|
43
|
-
end
|
|
44
44
|
end
|
|
45
45
|
|
data/lib/deplate.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# deplate.rb -- Convert wiki-like plain text pseudo markup to something else
|
|
3
|
-
# @Author: Thomas Link (
|
|
3
|
+
# @Author: Thomas Link (micathom AT gmail com)
|
|
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:
|
|
7
|
+
# @Last Change: 2007-04-14.
|
|
8
8
|
|
|
9
9
|
require 'profile' if ARGV[0] == '--profile'
|
|
10
10
|
|
data/lib/deplate/bib.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# bib.rb
|
|
2
|
-
# @Author: Thomas Link (
|
|
2
|
+
# @Author: Thomas Link (micathom AT gmail com)
|
|
3
3
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
4
4
|
# @Created: 11-Feb-2006.
|
|
5
|
-
# @Last Change:
|
|
6
|
-
# @Revision: 0.
|
|
5
|
+
# @Last Change: 2007-07-01.
|
|
6
|
+
# @Revision: 0.85
|
|
7
7
|
#
|
|
8
8
|
# = Description
|
|
9
9
|
# = Usage
|
|
@@ -37,7 +37,7 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def bib_format(bibdef)
|
|
40
|
-
type = bib_get_value(bibdef, '
|
|
40
|
+
type = bib_get_value(bibdef, '_type').downcase
|
|
41
41
|
meth = "bib_#{type}"
|
|
42
42
|
unless self.respond_to?(meth, true)
|
|
43
43
|
meth = 'bib_default'
|
|
@@ -51,15 +51,17 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
51
51
|
args = invoker.args
|
|
52
52
|
n = args['n']
|
|
53
53
|
p = args['p']
|
|
54
|
-
|
|
54
|
+
ip = args['ip']
|
|
55
|
+
np = ip || args['np']
|
|
56
|
+
mode = args['mode']
|
|
55
57
|
y = args['y']
|
|
58
|
+
sep = args['sep'] || (np ? '' : ' ')
|
|
56
59
|
acc = []
|
|
57
60
|
pmsg = @deplate.msg('p.\\ ')
|
|
58
61
|
for c in invoker.elt
|
|
59
62
|
cc = @deplate.formatter.bib_entry(c)
|
|
60
63
|
if cc
|
|
61
|
-
yr = cc
|
|
62
|
-
yr = if yr then yr[1] else '' end
|
|
64
|
+
yr = cc['year'] || ''
|
|
63
65
|
if p
|
|
64
66
|
p = @deplate.parse_and_format_without_wikinames(container, "#{pmsg}#{p}")
|
|
65
67
|
yr += ": #{p}"
|
|
@@ -68,14 +70,21 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
68
70
|
if y
|
|
69
71
|
acc << referenced_bib_entry(invoker, c, yr)
|
|
70
72
|
else
|
|
71
|
-
nm = cc
|
|
73
|
+
nm = cc['author'] || cc['editor'] || cc['howpublished']
|
|
72
74
|
if nm
|
|
73
|
-
nm
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
if nm =~ /^\{(.*?)\}$/
|
|
76
|
+
nm = $1
|
|
77
|
+
else
|
|
78
|
+
nm = nm.gsub(/\s+/, ' ').split(/ +and +/).collect do |a|
|
|
79
|
+
a.scan(/\w+$/)
|
|
80
|
+
end
|
|
81
|
+
nm = nm.join(', ')
|
|
82
|
+
end
|
|
83
|
+
if ip
|
|
84
|
+
acc << referenced_bib_entry(invoker, c, "#{nm} (#{yr})")
|
|
85
|
+
else
|
|
86
|
+
acc << referenced_bib_entry(invoker, c, [nm, yr].join(' '))
|
|
76
87
|
end
|
|
77
|
-
nm = nm.join(', ')
|
|
78
|
-
acc << referenced_bib_entry(invoker, c, [nm, yr].join(' '))
|
|
79
88
|
else
|
|
80
89
|
acc << referenced_bib_entry(invoker, c, c)
|
|
81
90
|
end
|
|
@@ -84,10 +93,16 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
84
93
|
end
|
|
85
94
|
n &&= n + @deplate.formatter.plain_text(' ', true)
|
|
86
95
|
acc = acc.join('; ')
|
|
96
|
+
sep = @deplate.formatter.plain_text(sep, true)
|
|
87
97
|
if np
|
|
88
|
-
return %{#{
|
|
98
|
+
return %{#{sep}#{n}#{acc}}
|
|
89
99
|
else
|
|
90
|
-
|
|
100
|
+
case mode
|
|
101
|
+
when 'np'
|
|
102
|
+
return %{#{sep}#{n}#{acc}}
|
|
103
|
+
else
|
|
104
|
+
return %{#{sep}(#{n}#{acc})}
|
|
105
|
+
end
|
|
91
106
|
end
|
|
92
107
|
end
|
|
93
108
|
|
|
@@ -101,9 +116,8 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
101
116
|
end
|
|
102
117
|
|
|
103
118
|
def bib_get_value(bibdef, key)
|
|
104
|
-
val = bibdef.
|
|
119
|
+
val = bibdef[key.downcase]
|
|
105
120
|
if val
|
|
106
|
-
val = val[1]
|
|
107
121
|
val.gsub(/\s{2,}/, ' ')
|
|
108
122
|
end
|
|
109
123
|
end
|
|
@@ -334,9 +348,17 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
334
348
|
# author title howpublished month year
|
|
335
349
|
def bib_misc(bibdef)
|
|
336
350
|
author = bib_author(bibdef)
|
|
351
|
+
how = bib_howpublished(bibdef)
|
|
352
|
+
pub = bib_publisher(bibdef)
|
|
353
|
+
if !author and how
|
|
354
|
+
author = how
|
|
355
|
+
how = nil
|
|
356
|
+
end
|
|
357
|
+
if !how and pub
|
|
358
|
+
how = pub
|
|
359
|
+
end
|
|
337
360
|
year = bib_year(bibdef)
|
|
338
361
|
title = bib_title(bibdef)
|
|
339
|
-
how = bib_howpublished(bibdef)
|
|
340
362
|
month = bib_month(bibdef)
|
|
341
363
|
address = bib_address(bibdef)
|
|
342
364
|
url = bib_url(bibdef)
|
|
@@ -529,29 +551,38 @@ class Deplate::Bib::Default < Deplate::CommonObject
|
|
|
529
551
|
|
|
530
552
|
def reformat_authors(text)
|
|
531
553
|
if text
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
554
|
+
if text =~ /^\{(.*?)\}$/
|
|
555
|
+
return $1
|
|
556
|
+
else
|
|
557
|
+
namesep = @deplate.variables['bibSepName'] || bibSepName
|
|
558
|
+
authorsep = @deplate.variables['bibSepAuthors'] || bibSepAuthors
|
|
559
|
+
twosep = @deplate.variables['bibSepTwoAuthors'] || bibSepTwoAuthors
|
|
560
|
+
lastsep = @deplate.variables['bibSepLastAuthor'] || bibSepLastAuthor
|
|
561
|
+
authors = Deplate::Core.authors_split(text)
|
|
562
|
+
authorsn = authors.size
|
|
563
|
+
authorsn1 = authors.size - 1
|
|
564
|
+
authorsn2 = authors.size - 2
|
|
565
|
+
au = []
|
|
566
|
+
authors.each_with_index do |a, i|
|
|
567
|
+
m = /^(.+?)\s*,\s*(.+)$/.match(a.strip)
|
|
568
|
+
if m
|
|
569
|
+
au << reformat_author_name(m[2], m[1], namesep)
|
|
570
|
+
else
|
|
571
|
+
m = /^((.+?)?\s+)?(\S+)$/.match(a.strip)
|
|
572
|
+
if m[2]
|
|
573
|
+
au << reformat_author_name(m[2], m[3], namesep)
|
|
574
|
+
else
|
|
575
|
+
au << a
|
|
576
|
+
end
|
|
577
|
+
if i < authorsn2
|
|
578
|
+
au << authorsep
|
|
579
|
+
elsif i < authorsn1
|
|
580
|
+
au << (authorsn == 2 ? twosep : lastsep)
|
|
581
|
+
end
|
|
582
|
+
end
|
|
583
|
+
end
|
|
584
|
+
return au.join
|
|
585
|
+
end
|
|
555
586
|
end
|
|
556
587
|
end
|
|
557
588
|
|