deplate 0.8 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/AUTHORS.TXT +19 -16
  2. data/CHANGES.TXT +214 -248
  3. data/NEWS.TXT +47 -30
  4. data/README.TXT +0 -1
  5. data/TODO.TXT +93 -20
  6. data/VERSION.TXT +1 -1
  7. data/bin/deplate.exy +192 -0
  8. data/etc/deplate.ini +70 -9
  9. data/lib/action_view/helpers/deplate.rb +33 -33
  10. data/lib/deplate.rb +2 -2
  11. data/lib/deplate/bib.rb +72 -41
  12. data/lib/deplate/builtin.rb +1 -1
  13. data/lib/deplate/cache.rb +1 -1
  14. data/lib/deplate/commands.rb +161 -102
  15. data/lib/deplate/common.rb +93 -7
  16. data/lib/deplate/converter.rb +10 -4
  17. data/lib/deplate/core.rb +215 -108
  18. data/lib/deplate/counters.rb +23 -8
  19. data/lib/deplate/css/article.css +9 -5
  20. data/lib/deplate/css/deplate.css +37 -3
  21. data/lib/deplate/css/heading-navbar.css +1 -1
  22. data/lib/deplate/css/highstep.css +18 -0
  23. data/lib/deplate/css/htmldoc.css +43 -0
  24. data/lib/deplate/css/layout-deplate-print.css +1 -1
  25. data/lib/deplate/css/layout-deplate.css +1 -1
  26. data/lib/deplate/css/play.css +101 -0
  27. data/lib/deplate/css/sans-serif.css +1 -1
  28. data/lib/deplate/css/serif-e.css +1 -1
  29. data/lib/deplate/css/serif-rel.css +1 -1
  30. data/lib/deplate/css/serif.css +1 -1
  31. data/lib/deplate/css/slides.css +1 -1
  32. data/lib/deplate/css/styles.css +4 -0
  33. data/lib/deplate/css/tabbar-right.css +54 -8
  34. data/lib/deplate/css/tabbar-top.css +28 -9
  35. data/lib/deplate/css/text-sans-serif.css +1 -1
  36. data/lib/deplate/css/text-serif.css +1 -1
  37. data/lib/deplate/define.rb +71 -38
  38. data/lib/deplate/deplate-string.rb +3 -3
  39. data/lib/deplate/docbook.rb +9 -9
  40. data/lib/deplate/elements.rb +173 -84
  41. data/lib/deplate/etc.rb +6 -8
  42. data/lib/deplate/external.rb +9 -5
  43. data/lib/deplate/fmt/dbk-article-4.1.2.rb +4 -3
  44. data/lib/deplate/fmt/dbk-article.rb +9 -8
  45. data/lib/deplate/fmt/dbk-book.rb +4 -3
  46. data/lib/deplate/fmt/dbk-ref.rb +5 -4
  47. data/lib/deplate/fmt/dbk-slides.rb +4 -3
  48. data/lib/deplate/fmt/dbk-snippet.rb +4 -3
  49. data/lib/deplate/fmt/html-snippet.rb +1 -1
  50. data/lib/deplate/fmt/html.rb +186 -46
  51. data/lib/deplate/fmt/htmlsite.rb +19 -9
  52. data/lib/deplate/fmt/htmlslides.rb +1 -1
  53. data/lib/deplate/fmt/htmlwebsite.rb +1 -1
  54. data/lib/deplate/fmt/latex-dramatist.rb +175 -0
  55. data/lib/deplate/fmt/latex-snippet.rb +1 -1
  56. data/lib/deplate/fmt/latex.rb +132 -80
  57. data/lib/deplate/fmt/null.rb +1 -1
  58. data/lib/deplate/fmt/php.rb +1 -1
  59. data/lib/deplate/fmt/phpsite.rb +1 -1
  60. data/lib/deplate/fmt/plain.rb +16 -9
  61. data/lib/deplate/fmt/template.rb +1 -1
  62. data/lib/deplate/fmt/xhtml10t.rb +1 -1
  63. data/lib/deplate/formatter-snippet.rb +1 -1
  64. data/lib/deplate/formatter.rb +272 -81
  65. data/lib/deplate/guesslanguage.rb +57 -0
  66. data/lib/deplate/input.rb +205 -50
  67. data/lib/deplate/input/deplate-headings.rb +9 -11
  68. data/lib/deplate/input/deplate-restricted.rb +3 -23
  69. data/lib/deplate/input/deplate.rb +1 -1
  70. data/lib/deplate/input/play.rb +208 -0
  71. data/lib/deplate/input/rdoc.rb +37 -15
  72. data/lib/deplate/input/template.rb +6 -11
  73. data/lib/deplate/lib/Makefile.config +53 -4
  74. data/lib/deplate/lib/html/parbreak +3 -0
  75. data/lib/deplate/lib/javascript/StepwiseNextPage.js +8 -0
  76. data/lib/deplate/lib/javascript/StepwiseNextPage_confirm.js +8 -0
  77. data/lib/deplate/lib/latex/deplate.sty +36 -0
  78. data/lib/deplate/lib/latex/parbreak +6 -0
  79. data/lib/deplate/lib/php/page-comment.inc.php +5 -5
  80. data/lib/deplate/lib/plain/parbreak +6 -0
  81. data/lib/deplate/locale/de.latin1 +87 -15
  82. data/lib/deplate/locale/de.latin1_data +60 -0
  83. data/lib/deplate/locale/en.latin1_data +46 -0
  84. data/lib/deplate/locale/fr.latin1_data +74 -0
  85. data/lib/deplate/locale/ru.koi8-r_data +63 -0
  86. data/lib/deplate/locale/{zh_cn.gb2312 → zh_CN.GB2312} +0 -0
  87. data/lib/deplate/macros.rb +106 -32
  88. data/lib/deplate/messages.rb +22 -8
  89. data/lib/deplate/metadata.rb +1 -1
  90. data/lib/deplate/metadata/marshal.rb +1 -1
  91. data/lib/deplate/metadata/xml.rb +1 -1
  92. data/lib/deplate/metadata/yaml.rb +1 -1
  93. data/lib/deplate/mod/anyword.rb +4 -4
  94. data/lib/deplate/mod/babelfish.rb +1 -1
  95. data/lib/deplate/mod/code-gvim.rb +14 -8
  96. data/lib/deplate/mod/code-gvim71.rb +52 -0
  97. data/lib/deplate/mod/code-highlight.rb +35 -19
  98. data/lib/deplate/mod/colored-log.rb +1 -1
  99. data/lib/deplate/mod/endnotes.rb +1 -1
  100. data/lib/deplate/mod/guesslanguage.rb +75 -0
  101. data/lib/deplate/mod/html-asciimath.rb +1 -1
  102. data/lib/deplate/mod/html-deplate-button.rb +1 -1
  103. data/lib/deplate/mod/html-headings-navbar.rb +1 -1
  104. data/lib/deplate/mod/html-highstep.rb +43 -0
  105. data/lib/deplate/mod/html-jsmath.rb +1 -1
  106. data/lib/deplate/mod/html-obfuscate-email.rb +1 -1
  107. data/lib/deplate/mod/html-sidebar.rb +1 -1
  108. data/lib/deplate/mod/iconv.rb +1 -1
  109. data/lib/deplate/mod/imgurl.rb +1 -1
  110. data/lib/deplate/mod/inlatex-compound.rb +1 -1
  111. data/lib/deplate/mod/koma.rb +4 -4
  112. data/lib/deplate/mod/{de.rb → lang-de.rb} +1 -1
  113. data/lib/deplate/mod/{en.rb → lang-en.rb} +1 -1
  114. data/lib/deplate/mod/{ru_koi8-r.rb → lang-ru-koi8-r.rb} +1 -1
  115. data/lib/deplate/mod/lang-ru.rb +9 -0
  116. data/lib/deplate/mod/{zh-cn-autospace.rb → lang-zh_CN-autospace.rb} +3 -3
  117. data/lib/deplate/mod/{zh-cn.rb → lang-zh_CN.rb} +8 -8
  118. data/lib/deplate/mod/latex-emph-table-head.rb +1 -1
  119. data/lib/deplate/mod/latex-styles.rb +6 -6
  120. data/lib/deplate/mod/latex-verbatim-small.rb +1 -1
  121. data/lib/deplate/mod/linkmap.rb +128 -0
  122. data/lib/deplate/mod/makefile.rb +23 -22
  123. data/lib/deplate/mod/mark-external-urls.rb +13 -7
  124. data/lib/deplate/mod/markup-1-warn.rb +1 -1
  125. data/lib/deplate/mod/markup-1.rb +1 -1
  126. data/lib/deplate/mod/navbar-png.rb +5 -4
  127. data/lib/deplate/mod/noindent.rb +1 -1
  128. data/lib/deplate/mod/numpara.rb +1 -1
  129. data/lib/deplate/mod/particle-math.rb +1 -1
  130. data/lib/deplate/mod/php-extra.rb +1 -1
  131. data/lib/deplate/mod/pstoedit.rb +1 -1
  132. data/lib/deplate/mod/recode.rb +1 -1
  133. data/lib/deplate/mod/smart-dash.rb +1 -1
  134. data/lib/deplate/mod/smiley.rb +1 -1
  135. data/lib/deplate/mod/soffice.rb +1 -1
  136. data/lib/deplate/mod/symbols-latin1.rb +1 -1
  137. data/lib/deplate/mod/symbols-od-utf-8.rb +1 -1
  138. data/lib/deplate/mod/symbols-plain.rb +1 -1
  139. data/lib/deplate/mod/symbols-sgml.rb +1 -1
  140. data/lib/deplate/mod/symbols-utf-8.rb +1 -1
  141. data/lib/deplate/mod/symbols-xml.rb +1 -1
  142. data/lib/deplate/mod/syntax-region-alt.rb +1 -1
  143. data/lib/deplate/mod/utf8.rb +1 -1
  144. data/lib/deplate/mod/validate-html.rb +1 -1
  145. data/lib/deplate/mod/xmlrpc.rb +37 -36
  146. data/lib/deplate/nukumi2.rb +4 -4
  147. data/lib/deplate/once-method.rb +1 -1
  148. data/lib/deplate/output.rb +12 -4
  149. data/lib/deplate/particles.rb +52 -22
  150. data/lib/deplate/regions.rb +160 -90
  151. data/lib/deplate/skeletons.rb +4 -3
  152. data/lib/deplate/structured.rb +19 -13
  153. data/lib/deplate/template.rb +17 -9
  154. data/lib/deplate/templates/html-doc.html +8 -11
  155. data/lib/deplate/templates/html-tabbar-right.html +1 -1
  156. data/lib/deplate/templates/html-tabbar-top.html +3 -3
  157. data/lib/deplate/variables.rb +25 -9
  158. data/lib/deplate/wiki-markup.rb +14 -3
  159. data/lib/deplate/xml.rb +3 -4
  160. data/lib/deplate/{zh-cn.rb → zh_CN.rb} +16 -16
  161. data/man/man1/deplate.1 +80 -65
  162. metadata +72 -48
  163. data/lib/deplate/mod/fr.rb +0 -46
@@ -1,5 +1,5 @@
1
1
  # metadata.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 15-Aug-2005.
@@ -1,5 +1,5 @@
1
1
  # yaml.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 20-M�r-2005.
@@ -1,5 +1,5 @@
1
1
  # xml.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 20-M�r-2005.
@@ -1,5 +1,5 @@
1
1
  # yaml.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 20-M�r-2005.
@@ -1,15 +1,15 @@
1
1
  # anyword.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 11-Sep-2004.
6
- # @Last Change: 12-Nov-2005.
7
- # @Revision: 0.94
6
+ # @Last Change: 2007-06-30.
7
+ # @Revision: 0.96
8
8
 
9
9
  class Deplate::Core
10
10
  def module_initialize_anyword
11
11
  list = @variables["anyword_list"]
12
- acc = list ? list.split(/\s*,\s*/) : []
12
+ acc = list ? Deplate::Core.split_list(list, ',', ';') : []
13
13
 
14
14
  cat = @variables["anyword_catalog"]
15
15
  if cat
@@ -1,5 +1,5 @@
1
1
  # babelfish.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 05-Sep-2004.
@@ -1,10 +1,10 @@
1
1
  # code-gvim.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 26-Feb-2005.
6
- # @Last Change: 23-Dez-2005.
7
- # @Revision: 0.97
6
+ # @Last Change: 2007-08-28.
7
+ # @Revision: 0.106
8
8
  #
9
9
  # = Description
10
10
  # This module provides a specialized syntax highlighter using gvim. Adds
@@ -18,15 +18,20 @@ require 'fileutils'
18
18
  require 'tmpdir'
19
19
 
20
20
  class Deplate::Regions::Code
21
- add_highlighter(nil, "html", :gvim_to_html)
22
- add_highlighter(nil, "htmlslides", :gvim_to_html)
23
- add_highlighter(nil, "htmlsite", :gvim_to_html)
21
+ add_highlighter(nil, 'html', :gvim_to_html)
22
+ add_highlighter(nil, 'htmlslides', :gvim_to_html)
23
+ add_highlighter(nil, 'htmlsite', :gvim_to_html)
24
+ add_highlighter(nil, 'html-snippet', :gvim_to_html)
25
+ add_highlighter(nil, 'xhtml10t', :gvim_to_html)
26
+ add_highlighter(nil, 'php', :gvim_to_html)
27
+ add_highlighter(nil, 'phpsite', :gvim_to_html)
24
28
 
25
29
  def gvim_to_html(syntax, style, text)
26
30
  unless @deplate.allow_external
27
31
  return
28
32
  end
29
- gvim = %{#{Deplate::External.get_app('gvim')} -f +"syn on" +"let use_xhtml = 1" +"setf #{syntax}" +"colorscheme #{style || "default"}" +"run! syntax/2html.vim" +"wq" +"q" deplateGvim}
33
+ gvim = %{#{Deplate::External.get_app('gvim')} -f +"syn on" +"let use_xhtml = 1" +"set ft=#{syntax}" +"colorscheme #{style || "default"}" +"run! syntax/2html.vim" +"wq" +"q" deplateGvim}
34
+ # p "DBG #{gvim}"
30
35
  @deplate.in_working_dir(Dir.tmpdir) do
31
36
  FileUtils.rm("deplateGvim.html") if File.exist?("deplateGvim.html")
32
37
  Deplate::External.write_file(self, "deplateGvim") {|io| io.puts(text)}
@@ -45,7 +50,8 @@ class Deplate::Regions::Code
45
50
  end
46
51
  end
47
52
  rv << %{</div>}
48
- return rv.join("\n")
53
+ # return rv.join("\n")
54
+ return rv
49
55
  else
50
56
  log("Error when running gvim", :error)
51
57
  end
@@ -0,0 +1,52 @@
1
+ # code-gvim.rb
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
+ # @Website: http://deplate.sf.net/
4
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
+ # @Created: 26-Feb-2005.
6
+ # @Last Change: 2007-08-28.
7
+ # @Revision: 0.109
8
+ #
9
+ # = Description
10
+ # This module provides a specialized syntax highlighter using gvim. Adds
11
+ # Deplate::Regions::Code#gvim_to_html.
12
+ #
13
+ # = Usage
14
+ # = TODO
15
+ # = CHANGES
16
+
17
+ require 'fileutils'
18
+ require 'tmpdir'
19
+ require 'hpricot'
20
+
21
+ class Deplate::Regions::Code
22
+ add_highlighter(nil, 'html', :gvim_to_html)
23
+ add_highlighter(nil, 'htmlslides', :gvim_to_html)
24
+ add_highlighter(nil, 'htmlsite', :gvim_to_html)
25
+ add_highlighter(nil, 'html-snippet', :gvim_to_html)
26
+ add_highlighter(nil, 'xhtml10t', :gvim_to_html)
27
+ add_highlighter(nil, 'php', :gvim_to_html)
28
+ add_highlighter(nil, 'phpsite', :gvim_to_html)
29
+
30
+ def gvim_to_html(syntax, style, text)
31
+ unless @deplate.allow_external
32
+ return
33
+ end
34
+ gvim = %{#{Deplate::External.get_app('gvim')} -f +"syn on" +"let use_xhtml = 1" +"set ft=#{syntax}" +"colorscheme #{style || "default"}" +"run! syntax/2html.vim" +"wq" +"q" deplateGvim}
35
+ # p "DBG #{gvim}"
36
+ @deplate.in_working_dir(Dir.tmpdir) do
37
+ FileUtils.rm("deplateGvim.html") if File.exist?("deplateGvim.html")
38
+ Deplate::External.write_file(self, "deplateGvim") {|io| io.puts(text)}
39
+ IO.popen(gvim) {|io| puts io.gets until io.eof }
40
+ if File.exist?("deplateGvim.html")
41
+ html = File.read('deplateGvim.html')
42
+ doc = Hpricot(html).at('body')
43
+ doc = doc.inner_html
44
+ return [%{<div class="code">\n#{doc}\n</div>}]
45
+ else
46
+ log("Error when running gvim", :error)
47
+ end
48
+ end
49
+ return nil
50
+ end
51
+ end
52
+
@@ -1,10 +1,10 @@
1
1
  # code-highlight.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 27-Feb-2005.
6
- # @Last Change: 23-Dez-2005.
7
- # @Revision: 0.42
6
+ # @Last Change: 2007-09-30.
7
+ # @Revision: 0.65
8
8
  #
9
9
  # = Description
10
10
  # Highlight code regions using Andr� Simon's
@@ -29,10 +29,15 @@ class Deplate::Formatter::LaTeX
29
29
  end
30
30
 
31
31
  class Deplate::Regions::Code
32
- add_highlighter(nil, "html", :highlight)
33
- add_highlighter(nil, "htmlslides", :highlight)
34
- add_highlighter(nil, "xhtml", :highlight)
35
- add_highlighter(nil, "latex", :highlight)
32
+ add_highlighter(nil, 'html', :highlight)
33
+ add_highlighter(nil, 'htmlslides', :highlight)
34
+ add_highlighter(nil, 'htmlsite', :highlight)
35
+ add_highlighter(nil, 'html-snippet', :highlight)
36
+ add_highlighter(nil, 'php', :highlight)
37
+ add_highlighter(nil, 'phpsite', :highlight)
38
+ add_highlighter(nil, 'xhtml10t', :highlight)
39
+ add_highlighter(nil, 'latex', :highlight)
40
+ add_highlighter(nil, 'latex-snippet', :highlight)
36
41
 
37
42
  class << self
38
43
  def get_style_ext(style)
@@ -46,44 +51,55 @@ class Deplate::Regions::Code
46
51
  end
47
52
  formatter = @deplate.formatter
48
53
  style_ext = Deplate::Regions::Code::get_style_ext(style)
49
- if defined?(Deplate::Formatter::XHTML10transitional) and formatter.kind_of?(Deplate::Formatter::XHTML10transitional)
54
+ args = []
55
+ # if defined?(Deplate::Formatter::XHTML10transitional) and formatter.kind_of?(Deplate::Formatter::XHTML10transitional)
56
+ if formatter.formatter_related?('xhtml')
50
57
  mode = :xhtml
51
- args = "--xhtml"
58
+ args << "--xhtml"
52
59
  style_out = "highlight#{style_ext}.css"
53
- elsif defined?(Deplate::Formatter::HTML) and formatter.kind_of?(Deplate::Formatter::HTML)
60
+ # elsif defined?(Deplate::Formatter::HTML) and formatter.kind_of?(Deplate::Formatter::HTML)
61
+ elsif formatter.formatter_related?('html')
54
62
  mode = :html
55
- args = "--css-outfile=highlight#{style_ext}.css"
63
+ # args << "--css-outfile=highlight#{style_ext}.css"
64
+ # args << "--style-outfile=highlight#{style_ext}.css"
56
65
  style_out = "highlight#{style_ext}.css"
57
66
  css = formatter.head_link_tag(%{rel="stylesheet" type="text/css" href="#{style_out}"})
58
67
  log(["Code: You need to copy highlight's style definition", "highlight#{style_ext}.css"], :anyway)
59
68
  @postponed_format << Proc.new do |container|
60
69
  container.deplate.formatter.union_at(:pre, :css, css)
61
70
  end
62
- elsif defined?(Deplate::Formatter::LaTeX) and formatter.kind_of?(Deplate::Formatter::LaTeX)
71
+ # elsif defined?(Deplate::Formatter::LaTeX) and formatter.kind_of?(Deplate::Formatter::LaTeX)
72
+ elsif formatter.formatter_related?('latex')
63
73
  mode = :latex
64
- args = "--latex"
74
+ args << "--latex"
75
+ if @deplate.options.messages.prop('lang', formatter) == 'german'
76
+ args << '-r'
77
+ end
65
78
  style_out = "highlight#{style_ext}.sty"
66
79
  log(["Code: You need to copy highlight's style definition", "highlight#{style_ext}.sty"], :anyway)
67
- elsif defined?(Deplate::Formatter::Docbook) and formatter.kind_of?(Deplate::Formatter::Docbook)
68
- log("Code: ''highlight'' doesn't support docbook!", :error)
80
+ # elsif defined?(Deplate::Formatter::Docbook) and formatter.kind_of?(Deplate::Formatter::Docbook)
81
+ elsif formatter.formatter_related?('dbk')
82
+ log("Code: 'highlight' doesn't support docbook!", :error)
69
83
  return nil
70
84
  else
71
- log("Code: ''highlight'' can't create output for this formatter!", :error)
85
+ log("Code: 'highlight' cannot create output for this formatter!", :error)
72
86
  return nil
73
87
  end
74
88
  if style
75
89
  style = %{--style=#{style}}
76
90
  end
77
91
  tw = @deplate.variables["tabwidth"] || 4
78
- cmd = "#{Deplate::External.get_app('highlight')} --fragment --wrap --replace-tabs=#{tw} --syntax #{syntax} --style-outfile=#{style_out} #{style} #{args}"
92
+ cmd = "#{Deplate::External.get_app('highlight')} --fragment --wrap --replace-tabs=#{tw} --syntax #{syntax} --style-outfile=#{style_out} #{style} #{args.join(' ')}"
79
93
  Deplate::External.log_popen(self, cmd) do |io|
80
94
  io.puts(text)
81
95
  io.close_write
82
- text = io.read
96
+ # text = io.read
97
+ text = io.readlines.collect {|l| l.chomp}
83
98
  end
84
99
  case mode
85
100
  when :html, :xhtml
86
- text = [%{<div class="code">}, "<pre>", text, "</pre>", %{</div>}].join
101
+ # text = [%{<div class="code">}, "<pre>", text, "</pre>", %{</div>}].join
102
+ text = [%{<div class="code">}, "<pre>", text, "</pre>", %{</div>}]
87
103
  end
88
104
  return text
89
105
  end
@@ -1,5 +1,5 @@
1
1
  # colored-log.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 05-Mai-2005.
@@ -1,5 +1,5 @@
1
1
  # endnotes.rb -- display endnotes instead of footnotes
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 20-Aug-2004.
@@ -0,0 +1,75 @@
1
+ # guesslanguage.rb
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
+ # @Created: 2006-12-29.
5
+ # @Last Change: 2007-09-29.
6
+ # @Revision: 0.1.72
7
+
8
+ require 'deplate/guesslanguage'
9
+
10
+ class Deplate::Core
11
+ def deplate_initialize_guesslanguage
12
+ @options.guesslanguage = Guesslanguage.new
13
+ @options.guesslanguage_once = false
14
+ @options.guesslanguage_collected = {}
15
+ for dir in Deplate::Core.library_directories(true, 'locale')
16
+ for file in Dir[File.join(dir, '*_data')]
17
+ lang = File.basename(file, '.*')
18
+ text = File.read(file)
19
+ @options.guesslanguage.register(lang, text)
20
+ log(['Guesslanguage', lang, file])
21
+ end
22
+ end
23
+ end
24
+
25
+ def guesslanguage(text)
26
+ unless text.empty? or @formatter.kind_of?(Deplate::Formatter::Template)
27
+ text0 = text.gsub(/^\s*#.*$|^\s*%.*$|\{.*?\}/, '')
28
+ if text0 =~ /\w/
29
+ diff, lang = @options.guesslanguage.guess_with_diff(text0)
30
+ if lang
31
+ lang0 = @options.guesslanguage_collected[:best]
32
+ diff0 = lang0 ? @options.guesslanguage_collected[lang0] : nil
33
+ if !diff0 or diff < diff0
34
+ log(['Guesslanguage: Switch to', lang])
35
+ if lang0 and lang0 != lang
36
+ log(['Guesslanguage: Possible conflict', lang, '%1.2f' % diff, lang0, '%1.2f' % diff0], :anyway)
37
+ end
38
+ @options.guesslanguage_collected[:best] = lang
39
+ @options.guesslanguage_collected[lang] = diff
40
+ @options.guesslanguage_once = true
41
+ set_lang(lang)
42
+ else
43
+ if lang != lang0
44
+ log(['Guesslanguage: Ignore switch', lang, '%1.2f' % diff, lang0, '%1.2f' % diff0])
45
+ log(text, :debug)
46
+ # p "DBG", text, text0
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ alias :guesslanguage_include_each :include_each
55
+ def include_each(enum, array, sourcename=nil)
56
+ case enum
57
+ when Array
58
+ enum = enum.join("\n")
59
+ end
60
+ rv = nil
61
+ lang = @@message_object.prop('lang')
62
+ begin
63
+ guesslanguage(enum) unless @options.guesslanguage_once
64
+ rv = guesslanguage_include_each(enum, array, sourcename)
65
+ ensure
66
+ # TBD: Temporarily switch languages
67
+ # if lang != @@message_object.prop('lang')
68
+ # log(['Guesslanguage: Switch to', lang])
69
+ # set_lang(lang)
70
+ # end
71
+ end
72
+ return rv
73
+ end
74
+ end
75
+
@@ -1,5 +1,5 @@
1
1
  # html-asciimath.rb -- Support for asciimath.js
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 30-Dez-2004.
@@ -1,5 +1,5 @@
1
1
  # html-deplate-button.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 05-Sep-2004.
@@ -1,5 +1,5 @@
1
1
  # html-headings-navbar.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 15-Nov-2004.
@@ -0,0 +1,43 @@
1
+ # html-highstep.rb
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
+ # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
4
+ # @Created: 2007-01-06.
5
+ # @Last Change: 2007-01-12.
6
+ # @Revision: 0.31
7
+ #
8
+ # = Description
9
+ # Provide the macro ''step'' to mark text for stepwise highlighting.
10
+
11
+ class Deplate::Macro::HighStep < Deplate::Macro::FormattedText
12
+ attr_reader :step_index
13
+ register_as 'step'
14
+ def setup(text)
15
+ @step_index = @deplate.formatter.stepwise_next
16
+ super
17
+ end
18
+ def process
19
+ format_particle(:format_highstep, self, super)
20
+ end
21
+ end
22
+
23
+ class Deplate::Formatter
24
+ def format_highstep(invoker, txt=nil)
25
+ format_emphasize(invoker, txt)
26
+ end
27
+ end
28
+
29
+ class Deplate::Formatter::HTML
30
+ def format_highstep(invoker, txt=nil)
31
+ txt ||= invoker.elt || invoker.text
32
+ idx = invoker.step_index
33
+ beg = (@variables['stepwiseBegin'] || '0').to_i
34
+ cls = (beg == 0 or idx > beg) ? 'steppreview' : 'stephighlight'
35
+ args = {
36
+ # 'style' => "visibility:#{vis};"
37
+ 'class' => cls,
38
+ 'id' => "HighStep#{idx}",
39
+ }
40
+ inline_tag(invoker, 'span', txt, args)
41
+ end
42
+ end
43
+
@@ -1,5 +1,5 @@
1
1
  # html-jsmath.rb -- Support for jsmath.js
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 30-Dez-2004.
@@ -1,5 +1,5 @@
1
1
  # html-obfuscate-email.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 13-Jul-2005.
@@ -1,5 +1,5 @@
1
1
  # mod-html-sidebar.rb -- A popup-mini-toc for html output
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 19-Jul-2004.
@@ -1,5 +1,5 @@
1
1
  # iconv.rb
2
- # @Author: Thomas Link (samul AT web.de)
2
+ # @Author: Thomas Link (micathom AT gmail com)
3
3
  # @Website: http://deplate.sf.net/
4
4
  # @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
5
5
  # @Created: 11-Apr-2005.