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
@@ -3,10 +3,12 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 27-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 07-Jun-2006.
|
7
|
+
# @Revision: 0.31
|
8
|
+
|
9
|
+
class Deplate::Symbols::Plain < Deplate::Symbols
|
10
|
+
self.myname = 'plain'
|
8
11
|
|
9
|
-
module Deplate::Symbols::Plain
|
10
12
|
def symbol_quote(invoker)
|
11
13
|
""" #"""
|
12
14
|
end
|
@@ -22,37 +24,5 @@ module Deplate::Symbols::Plain
|
|
22
24
|
def symbol_amp(invoker)
|
23
25
|
"&" #"&"
|
24
26
|
end
|
25
|
-
|
26
|
-
def doublequote_open(invoker)
|
27
|
-
%{"}
|
28
|
-
end
|
29
|
-
|
30
|
-
def doublequote_close(invoker)
|
31
|
-
%{"}
|
32
|
-
end
|
33
|
-
|
34
|
-
def singlequote_open(invoker)
|
35
|
-
%{'}
|
36
|
-
end
|
37
|
-
|
38
|
-
def singlequote_close(invoker)
|
39
|
-
%{'}
|
40
|
-
end
|
41
|
-
|
42
|
-
def nonbreakingspace(invoker)
|
43
|
-
%{ }
|
44
|
-
end
|
45
|
-
|
46
|
-
def symbol_paragraph(invoker)
|
47
|
-
%{§}
|
48
|
-
end
|
49
|
-
|
50
|
-
def format_symbol(invoker, sym)
|
51
|
-
return plain_text(sym)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class Deplate::Core
|
56
|
-
@@symbols["plain"] = Deplate::Symbols::Plain
|
57
27
|
end
|
58
28
|
|
@@ -3,10 +3,12 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 27-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 26-Nov-2005.
|
7
|
+
# @Revision: 0.45
|
8
8
|
|
9
|
-
|
9
|
+
class Deplate::Symbols::SGML < Deplate::Symbols
|
10
|
+
self.myname = :sgml
|
11
|
+
|
10
12
|
def symbol_quote(invoker)
|
11
13
|
""" #"""
|
12
14
|
end
|
@@ -72,7 +74,8 @@ module Deplate::Symbols::SGML
|
|
72
74
|
when "=="
|
73
75
|
return "≡" #"≡"
|
74
76
|
when "+++", "###", "???", "!!!"
|
75
|
-
|
77
|
+
p = @formatter.formatted_inline("para", @formatter.plain_text(sym))
|
78
|
+
m = @formatter.formatted_inline("sidebar", p)
|
76
79
|
if defined?(invoker.epilogue)
|
77
80
|
invoker.epilogue << m
|
78
81
|
return ""
|
@@ -86,12 +89,8 @@ module Deplate::Symbols::SGML
|
|
86
89
|
# when "<~>"
|
87
90
|
# return ""
|
88
91
|
else
|
89
|
-
|
92
|
+
super
|
90
93
|
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
94
|
-
class Deplate::Core
|
95
|
-
@@symbols[:sgml] = Deplate::Symbols::SGML
|
96
|
-
end
|
97
|
-
|
@@ -3,10 +3,12 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 27-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 26-Nov-2005.
|
7
|
+
# @Revision: 0.37
|
8
|
+
|
9
|
+
class Deplate::Symbols::Utf8 < Deplate::Symbols
|
10
|
+
self.myname = "utf-8"
|
8
11
|
|
9
|
-
module Deplate::Symbols::Utf8
|
10
12
|
def doublequote_open(invoker)
|
11
13
|
%{“}
|
12
14
|
end
|
@@ -56,7 +58,8 @@ module Deplate::Symbols::Utf8
|
|
56
58
|
when "=="
|
57
59
|
return "≡"
|
58
60
|
when "+++", "###", "???", "!!!"
|
59
|
-
|
61
|
+
p = @formatter.formatted_inline("para", @formatter.plain_text(sym))
|
62
|
+
m = @formatter.formatted_inline("sidebar", p)
|
60
63
|
if defined?(invoker.epilogue)
|
61
64
|
invoker.epilogue << m
|
62
65
|
return ""
|
@@ -70,12 +73,8 @@ module Deplate::Symbols::Utf8
|
|
70
73
|
# when "<~>"
|
71
74
|
# return ""
|
72
75
|
else
|
73
|
-
|
76
|
+
super
|
74
77
|
end
|
75
78
|
end
|
76
79
|
end
|
77
80
|
|
78
|
-
class Deplate::Core
|
79
|
-
@@symbols["utf-8"] = Deplate::Symbols::Utf8
|
80
|
-
end
|
81
|
-
|
@@ -3,14 +3,14 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 27-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 26-Nov-2005.
|
7
|
+
# @Revision: 0.31
|
8
8
|
|
9
9
|
require "deplate/mod/symbols-utf-8"
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
class Deplate::Symbols::XML < Deplate::Symbols::Utf8
|
12
|
+
self.myname = :xml
|
13
|
+
|
14
14
|
def symbol_quote(invoker)
|
15
15
|
"""
|
16
16
|
end
|
@@ -28,7 +28,3 @@ module Deplate::Symbols::XML
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
class Deplate::Core
|
32
|
-
@@symbols[:xml] = Deplate::Symbols::XML
|
33
|
-
end
|
34
|
-
|
@@ -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: 27-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 12-Nov-2005.
|
7
|
+
# @Revision: 0.19
|
8
8
|
#
|
9
9
|
# Description:
|
10
10
|
# This module provides an alternative syntax for regions, like:
|
@@ -15,11 +15,11 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
class Deplate::Element::RegionSyntaxAlt < Deplate::Element::Region
|
18
|
-
|
19
|
-
|
18
|
+
register_element
|
19
|
+
set_rx(/^(\s*)(={4,})\s*([A-Z][A-Za-z]*)(.*)$/)
|
20
20
|
|
21
21
|
def get_endrx
|
22
|
-
/^#{Regexp.escape(@match[
|
22
|
+
/^#{get_indent}#{Regexp.escape(@match[2])}(\s+.*)?$/
|
23
23
|
end
|
24
24
|
|
25
25
|
def get_name
|
data/lib/deplate/mod/utf8.rb
CHANGED
File without changes
|
File without changes
|
data/lib/deplate/mod/xmlrpc.rb
CHANGED
File without changes
|
@@ -3,30 +3,30 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 01-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 31-Mai-2006.
|
7
|
+
# @Revision: 0.225
|
8
8
|
|
9
|
-
require
|
9
|
+
require 'deplate/zh-cn'
|
10
10
|
|
11
11
|
class Deplate::Formatter
|
12
12
|
attr_reader :cjk_space, :cjk_nospace
|
13
13
|
def hook_pre_setup_zh_cn_autospace
|
14
|
-
@cjk_space =
|
15
|
-
@cjk_nospace =
|
14
|
+
@cjk_space = ' '
|
15
|
+
@cjk_nospace = ''
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
class Deplate::Formatter::LaTeX
|
20
20
|
def hook_pre_setup_zh_cn_autospace
|
21
|
-
@cjk_space =
|
22
|
-
@cjk_nospace =
|
21
|
+
@cjk_space = '~'
|
22
|
+
@cjk_nospace = ' '
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
class Deplate::Core
|
27
|
-
@cjk_nonchars =
|
28
|
-
@cjk_rx_C = Regexp.new(
|
29
|
-
@cjk_rx_a = Regexp.new(
|
27
|
+
@cjk_nonchars = '%c-%c' % [33, 0xA0]
|
28
|
+
@cjk_rx_C = Regexp.new('[^%s]' % @cjk_nonchars)
|
29
|
+
@cjk_rx_a = Regexp.new('[%s]' % @cjk_nonchars)
|
30
30
|
class << self
|
31
31
|
attr_reader :cjk_nonchars, :cjk_rx_a, :cjk_rx_C
|
32
32
|
end
|
@@ -35,13 +35,13 @@ class Deplate::Core
|
|
35
35
|
class << self
|
36
36
|
def join_particles(particles)
|
37
37
|
acc = []
|
38
|
-
prev =
|
38
|
+
prev = ''
|
39
39
|
prev_cjk = false
|
40
|
-
particles.delete(
|
40
|
+
particles.delete('')
|
41
41
|
particles.each_with_index do |e, i|
|
42
|
-
if e ==
|
42
|
+
if e == ' '
|
43
43
|
enext = particles[i + 1]
|
44
|
-
if prev ==
|
44
|
+
if prev == ' ' or enext == ' '
|
45
45
|
elsif @formatter.cjk_smart_blanks and prev =~ Deplate::Core.cjk_rx_C and enext =~ Deplate::Core.cjk_rx_C
|
46
46
|
acc << @formatter.cjk_nospace
|
47
47
|
else
|
@@ -70,21 +70,19 @@ end
|
|
70
70
|
|
71
71
|
class Deplate::Element
|
72
72
|
def join_lines(accum)
|
73
|
-
accum.join(
|
73
|
+
accum.join(' ')
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
class Deplate::Particle::Space < Deplate::Particle
|
78
|
-
|
79
|
-
@rx = /^ /
|
78
|
+
set_rx(/^ /)
|
80
79
|
def setup
|
81
|
-
@elt =
|
80
|
+
@elt = ' '
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
84
|
class Deplate::Particle::NonCJK < Deplate::Particle
|
86
|
-
#
|
87
|
-
@rx = /^([#{Deplate::Core.cjk_nonchars}])/o
|
85
|
+
set_rx(/^([#{Deplate::Core.cjk_nonchars}])/o)
|
88
86
|
@part = nil
|
89
87
|
|
90
88
|
class << self
|
data/lib/deplate/mod/zh-cn.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: 01-Aug-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 12-Nov-2005.
|
7
|
+
# @Revision: 0.163
|
8
8
|
|
9
9
|
require "deplate/zh-cn"
|
10
10
|
|
@@ -20,8 +20,7 @@ class Deplate::Element
|
|
20
20
|
end
|
21
21
|
|
22
22
|
class Deplate::Particle::SwallowedSpace < Deplate::Particle
|
23
|
-
|
24
|
-
@rx = /^ +/
|
23
|
+
set_rx(/^ +/)
|
25
24
|
|
26
25
|
def setup
|
27
26
|
@elt = @deplate.formatter.cjk_smart_blanks ? "" : " "
|
@@ -29,8 +28,7 @@ class Deplate::Particle::SwallowedSpace < Deplate::Particle
|
|
29
28
|
end
|
30
29
|
|
31
30
|
class Deplate::Particle::Space < Deplate::Particle
|
32
|
-
|
33
|
-
@rx = /^~/
|
31
|
+
set_rx(/^~/)
|
34
32
|
|
35
33
|
def setup
|
36
34
|
@elt = "~"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# nukumi2.rb
|
2
|
+
# @Author: Thomas Link (samul AT web de)
|
3
|
+
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
4
|
+
# @Created: 31-Dez-2005.
|
5
|
+
# @Last Change: 31-Dez-2005.
|
6
|
+
# @Revision: 0.33
|
7
|
+
#
|
8
|
+
# = Usage
|
9
|
+
# Add require 'deplate/nukumi2' to your nukumi2 config.rb.
|
10
|
+
#
|
11
|
+
# = TODO
|
12
|
+
# - check inline latex etc. (set the directory for auxiliary files)
|
13
|
+
|
14
|
+
require 'deplate/deplate-string'
|
15
|
+
|
16
|
+
if Nukumi2::VERSION != '0.5'
|
17
|
+
Deplate::Core.log('deplate support was created for Nukumi2 0.5 and is not guaranteed to work with other versions', :anyway)
|
18
|
+
end
|
19
|
+
|
20
|
+
Nukumi2::Entry::DEFAULT_ENCODING.replace 'DeplateString'
|
21
|
+
|
22
|
+
o = DeplateString.deplate_options
|
23
|
+
o.variables['levelshift'] = '4'
|
24
|
+
o.variables['headings'] = 'plain'
|
25
|
+
o.variables['auxiliaryDir'] = 'data'
|
26
|
+
o.variables['mandatoryID'] = true
|
27
|
+
|
28
|
+
class FileBackend
|
29
|
+
class Parser
|
30
|
+
def self.parse(io)
|
31
|
+
entry = Nukumi2::Entry.new
|
32
|
+
|
33
|
+
metadata = []
|
34
|
+
|
35
|
+
while line = io.gets
|
36
|
+
break if line.chomp.empty?
|
37
|
+
metadata << line
|
38
|
+
end
|
39
|
+
|
40
|
+
meta = DeplateString.new(metadata.join)
|
41
|
+
meta.to_html
|
42
|
+
|
43
|
+
date = meta.deplate_converter.get_clip('date')
|
44
|
+
entry.time = Time.parse(date.elt) if date
|
45
|
+
|
46
|
+
subject = meta.deplate_converter.get_clip('title')
|
47
|
+
entry.title = subject.elt if subject
|
48
|
+
|
49
|
+
meta.deplate_variables.each do |field, value|
|
50
|
+
if value
|
51
|
+
case field
|
52
|
+
when 'keywords'
|
53
|
+
entry.categories.concat value.split(/\s*[,;]\s*/)
|
54
|
+
when 'encoding'
|
55
|
+
else
|
56
|
+
if entry.respond_to? field + "="
|
57
|
+
entry.send field + "=", value
|
58
|
+
else
|
59
|
+
entry.fields[field] = value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
entry.content = io.read
|
66
|
+
|
67
|
+
entry
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
data/lib/deplate/once-method.rb
CHANGED
File without changes
|
data/lib/deplate/output.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: 04-Dez-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 28-Apr-2006.
|
7
|
+
# @Revision: 0.257
|
8
8
|
|
9
9
|
require 'forwardable'
|
10
10
|
require 'deplate/metadata'
|
@@ -24,6 +24,7 @@ class Deplate::Output
|
|
24
24
|
attr_accessor :pre_matter, :body, :post_matter
|
25
25
|
attr_accessor :top_heading, :index
|
26
26
|
attr_accessor :destination
|
27
|
+
attr_reader :attributes
|
27
28
|
# , :metadata
|
28
29
|
|
29
30
|
def_delegator(:@deplate, :slot_by_name)
|
@@ -55,9 +56,11 @@ class Deplate::Output
|
|
55
56
|
@variables = deplate.variables
|
56
57
|
@templates = deplate.templates
|
57
58
|
@meta = Deplate::Metadata.new(deplate, self)
|
59
|
+
@attributes = {}
|
58
60
|
# @metadata = {}
|
59
61
|
@destination = nil
|
60
62
|
@index = nil
|
63
|
+
@output = nil
|
61
64
|
if inherited_output
|
62
65
|
@pre_matter = inherited_output.pre_matter.dup
|
63
66
|
@body = @@body_template.dup
|
@@ -74,15 +77,13 @@ class Deplate::Output
|
|
74
77
|
def body_flush
|
75
78
|
call_methods_matching(@formatter, /^hook_pre_body_flush_/)
|
76
79
|
save!
|
77
|
-
log([
|
80
|
+
log(['Flushing formatted elements', @destination], :debug)
|
78
81
|
process
|
79
82
|
call_methods_matching(@formatter, /^hook_post_body_flush_/)
|
80
83
|
end
|
81
84
|
|
82
85
|
def save!
|
83
|
-
|
84
|
-
@output = nil
|
85
|
-
else
|
86
|
+
unless do_i_feel_empty?
|
86
87
|
call_methods_matching(@formatter, /^hook_pre_output_save_/)
|
87
88
|
@index ||= @top_heading.top_index
|
88
89
|
@destination ||= @top_heading.destination
|
@@ -91,25 +92,24 @@ class Deplate::Output
|
|
91
92
|
@post_matter = @post_matter.dup
|
92
93
|
call_methods_matching(@formatter, /^hook_post_output_save_/)
|
93
94
|
end
|
94
|
-
log([
|
95
|
+
log(['Save output', destination], :debug)
|
95
96
|
end
|
96
97
|
|
97
98
|
def process
|
98
99
|
if @options.included
|
99
100
|
peel!
|
100
101
|
else
|
101
|
-
tmpl = @options.template || @variables[
|
102
|
+
tmpl = @options.template || @variables['template']
|
102
103
|
if tmpl
|
103
|
-
@variables["@idx"] = @index[0].to_s
|
104
104
|
if File.exist?(tmpl)
|
105
105
|
fill_in_template(tmpl)
|
106
106
|
else
|
107
107
|
template_file = @templates[tmpl]
|
108
108
|
if template_file
|
109
|
-
log([
|
109
|
+
log(['Using template', template_file], :debug)
|
110
110
|
fill_in_template(template_file)
|
111
111
|
else
|
112
|
-
log([
|
112
|
+
log(['Unknown template', tmpl], :error)
|
113
113
|
flatten!
|
114
114
|
end
|
115
115
|
end
|
@@ -133,7 +133,7 @@ class Deplate::Output
|
|
133
133
|
body_empty?
|
134
134
|
end
|
135
135
|
end
|
136
|
-
private :do_i_feel_empty?
|
136
|
+
# private :do_i_feel_empty?
|
137
137
|
|
138
138
|
def peel!
|
139
139
|
unless do_i_feel_empty?
|
@@ -148,14 +148,12 @@ class Deplate::Output
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def fill_in_template(template_file)
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
:post => @post_matter)
|
158
|
-
end
|
151
|
+
unless do_i_feel_empty?
|
152
|
+
t = Deplate::Template.new(:file => template_file)
|
153
|
+
@output = t.fill_in(@deplate,
|
154
|
+
:pre => @pre_matter,
|
155
|
+
:body => @body,
|
156
|
+
:post => @post_matter)
|
159
157
|
end
|
160
158
|
end
|
161
159
|
|
@@ -170,7 +168,7 @@ class Deplate::Output
|
|
170
168
|
else
|
171
169
|
pos = slot_by_name(pos)
|
172
170
|
unless pos or pos == 0
|
173
|
-
log(["Undefined slot", pos, type
|
171
|
+
log(["Undefined slot", pos, type], :error) if pos.nil?
|
174
172
|
return
|
175
173
|
end
|
176
174
|
case type
|