webby 0.8.2 → 0.8.3

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 (123) hide show
  1. data/History.txt +20 -0
  2. data/Manifest.txt +46 -2
  3. data/Rakefile +4 -3
  4. data/bin/webby +1 -1
  5. data/data/Rakefile +0 -1
  6. data/data/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
  7. data/data/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
  8. data/data/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
  9. data/data/content/s5/blank.gif +0 -0
  10. data/data/content/s5/bodybg.gif +0 -0
  11. data/data/content/s5/framing.css +23 -0
  12. data/data/content/s5/iepngfix.htc +42 -0
  13. data/data/content/s5/opera.css +7 -0
  14. data/data/content/s5/outline.css +15 -0
  15. data/data/content/s5/pretty.css +86 -0
  16. data/data/content/s5/print.css +1 -0
  17. data/data/content/s5/s5-core.css +9 -0
  18. data/data/content/s5/slides.css +3 -0
  19. data/data/content/s5/slides.js +553 -0
  20. data/data/lib/breadcrumbs.rb +0 -0
  21. data/data/tasks/blog.rake +71 -0
  22. data/data/tasks/build.rake +27 -0
  23. data/data/tasks/create.rake +19 -1
  24. data/data/tasks/deploy.rake +2 -2
  25. data/data/tasks/setup.rb +4 -1
  26. data/data/templates/atom_feed.erb +20 -13
  27. data/data/templates/page.erb +1 -1
  28. data/data/templates/presentation.erb +40 -0
  29. data/examples/presentation/Rakefile +14 -0
  30. data/examples/presentation/content/_sample_code.txt +10 -0
  31. data/examples/presentation/content/css/uv/twilight.css +137 -0
  32. data/examples/presentation/content/index.txt +63 -0
  33. data/examples/presentation/content/s5/blank.gif +0 -0
  34. data/examples/presentation/content/s5/bodybg.gif +0 -0
  35. data/examples/presentation/content/s5/framing.css +23 -0
  36. data/examples/presentation/content/s5/iepngfix.htc +42 -0
  37. data/examples/presentation/content/s5/opera.css +7 -0
  38. data/examples/presentation/content/s5/outline.css +15 -0
  39. data/examples/presentation/content/s5/pretty.css +86 -0
  40. data/examples/presentation/content/s5/print.css +1 -0
  41. data/examples/presentation/content/s5/s5-core.css +9 -0
  42. data/examples/presentation/content/s5/slides.css +3 -0
  43. data/examples/presentation/content/s5/slides.js +553 -0
  44. data/examples/presentation/layouts/presentation.rhtml +43 -0
  45. data/examples/presentation/tasks/blog.rake +71 -0
  46. data/examples/presentation/tasks/build.rake +27 -0
  47. data/examples/presentation/tasks/create.rake +22 -0
  48. data/examples/presentation/tasks/deploy.rake +22 -0
  49. data/examples/presentation/tasks/growl.rake +12 -0
  50. data/examples/presentation/tasks/heel.rake +28 -0
  51. data/examples/presentation/tasks/setup.rb +17 -0
  52. data/examples/presentation/tasks/validate.rake +19 -0
  53. data/examples/presentation/templates/_partial.erb +13 -0
  54. data/examples/presentation/templates/presentation.erb +40 -0
  55. data/examples/webby/Rakefile +3 -2
  56. data/examples/webby/content/css/blueprint/screen.css +1 -1
  57. data/examples/webby/content/css/coderay.css +0 -15
  58. data/examples/webby/content/css/site.css +18 -13
  59. data/examples/webby/content/css/uv/twilight.css +137 -0
  60. data/examples/webby/content/index.txt +6 -10
  61. data/examples/webby/content/manual/index.txt +83 -122
  62. data/examples/webby/content/reference/index.txt +161 -16
  63. data/examples/webby/content/script/jquery.js +1 -1
  64. data/examples/webby/content/tips_and_tricks/index.txt +1 -1
  65. data/examples/webby/content/tutorial/index.txt +1 -1
  66. data/examples/webby/layouts/default.rhtml +2 -7
  67. data/examples/webby/tasks/blog.rake +71 -0
  68. data/examples/webby/tasks/build.rake +27 -0
  69. data/examples/webby/tasks/create.rake +19 -1
  70. data/examples/webby/tasks/deploy.rake +2 -2
  71. data/examples/webby/tasks/setup.rb +4 -20
  72. data/examples/webby/templates/page.erb +1 -1
  73. data/lib/webby.rb +30 -5
  74. data/lib/webby/auto_builder.rb +0 -2
  75. data/lib/webby/builder.rb +51 -5
  76. data/lib/webby/filters.rb +3 -3
  77. data/lib/webby/filters/basepath.rb +7 -7
  78. data/lib/webby/filters/erb.rb +0 -2
  79. data/lib/webby/filters/haml.rb +0 -2
  80. data/lib/webby/filters/markdown.rb +0 -2
  81. data/lib/webby/filters/outline.rb +43 -2
  82. data/lib/webby/filters/sass.rb +0 -2
  83. data/lib/webby/filters/slides.rb +56 -0
  84. data/lib/webby/filters/textile.rb +0 -2
  85. data/lib/webby/filters/tidy.rb +0 -2
  86. data/lib/webby/helpers.rb +0 -2
  87. data/lib/webby/helpers/capture_helper.rb +141 -0
  88. data/lib/webby/helpers/coderay_helper.rb +5 -16
  89. data/lib/webby/helpers/graphviz_helper.rb +6 -18
  90. data/lib/webby/helpers/tag_helper.rb +0 -2
  91. data/lib/webby/helpers/tex_img_helper.rb +5 -16
  92. data/lib/webby/helpers/ultraviolet_helper.rb +11 -22
  93. data/lib/webby/helpers/url_helper.rb +2 -4
  94. data/lib/webby/link_validator.rb +0 -2
  95. data/lib/webby/main.rb +0 -2
  96. data/lib/webby/renderer.rb +163 -37
  97. data/lib/webby/resources.rb +0 -2
  98. data/lib/webby/resources/db.rb +37 -27
  99. data/lib/webby/resources/file.rb +0 -2
  100. data/lib/webby/resources/layout.rb +0 -2
  101. data/lib/webby/resources/page.rb +4 -9
  102. data/lib/webby/resources/partial.rb +1 -3
  103. data/lib/webby/resources/resource.rb +10 -2
  104. data/lib/webby/resources/static.rb +0 -2
  105. data/lib/webby/stelan/mktemp.rb +0 -2
  106. data/lib/webby/stelan/spawner.rb +0 -2
  107. data/lib/webby/utils.rb +0 -2
  108. data/spec/spec_helper.rb +1 -4
  109. data/spec/webby/helpers/capture_helper_spec.rb +56 -0
  110. data/spec/webby/resources/file_spec.rb +0 -1
  111. data/tasks/ann.rake +7 -4
  112. data/tasks/bones.rake +2 -2
  113. data/tasks/gem.rake +26 -14
  114. data/tasks/notes.rake +11 -5
  115. data/tasks/post_load.rake +4 -2
  116. data/tasks/rdoc.rake +4 -2
  117. data/tasks/rubyforge.rake +3 -3
  118. data/tasks/setup.rb +24 -9
  119. data/tasks/spec.rake +1 -1
  120. data/tasks/website.rake +1 -1
  121. metadata +51 -7
  122. data/lib/webby/webby_task.rb +0 -134
  123. data/tasks/svn.rake +0 -45
@@ -1,5 +1,3 @@
1
- # $Id: erb.rb 68 2007-12-09 07:45:37Z tim_pease $
2
-
3
1
  require 'erb'
4
2
 
5
3
  # Render text via ERB using the built in ERB library.
@@ -1,5 +1,3 @@
1
- # $Id: haml.rb 112 2008-01-26 05:31:48Z tim_pease $
2
-
3
1
  try_require 'haml'
4
2
 
5
3
  # Render text via the Haml library
@@ -1,5 +1,3 @@
1
- # $Id: markdown.rb 68 2007-12-09 07:45:37Z tim_pease $
2
-
3
1
  try_require 'bluecloth'
4
2
 
5
3
  # Render text via markdown using the BlueCloth library.
@@ -1,5 +1,3 @@
1
- # $Id: outline.rb 192 2008-03-08 16:27:29Z tim_pease $
2
-
3
1
  require 'hpricot'
4
2
 
5
3
  module Webby
@@ -24,6 +22,49 @@ module Filters
24
22
  # it should be used after any markup langauge filters (textile, markdown,
25
23
  # etc.).
26
24
  #
25
+ # The following attributes can be specified in the <toc /> tag itself to
26
+ # control how outline numbering is performed by the filter. The attributes
27
+ # can be used in combination with one another.
28
+ #
29
+ # === numbering
30
+ #
31
+ # If set to "off", this will prevent numbers from being inserted into the
32
+ # page. The default is "on".
33
+ #
34
+ # <toc numbering="off" />
35
+ #
36
+ # === numbering_start
37
+ #
38
+ # This is the number to start with when inserting outline numbers into a
39
+ # page. The default is 1.
40
+ #
41
+ # <toc numbering_start="3" />
42
+ #
43
+ # === toc_style
44
+ #
45
+ # The style of the Table of Contents list to generated. This will be
46
+ # either "ol" for an ordered list or "ul" for an unordered list. The
47
+ # default is an ordered list.
48
+ #
49
+ # <toc toc_style="ul" />
50
+ #
51
+ # === toc_range
52
+ #
53
+ # This limits the numbering to only a subset of the HTML heading tags. The
54
+ # defaul is to number all the heading tags.
55
+ #
56
+ # <toc toc_range="h1-h3" />
57
+ #
58
+ # In this example, only the heading tags h1, h2, and h3 will be numbered
59
+ # and included in the table of contents listing.
60
+ #
61
+ # ==== Example
62
+ #
63
+ # Generate a table of contents using an unordered list, starting with the
64
+ # number 2, and only numbering heading levels 2, 3, and 4.
65
+ #
66
+ # <toc numbering_start="2" toc_style="ul" toc_range="h2-h4" />
67
+ #
27
68
  class Outline
28
69
  include ERB::Util
29
70
 
@@ -1,5 +1,3 @@
1
- # $Id: sass.rb 68 2007-12-09 07:45:37Z tim_pease $
2
-
3
1
  try_require 'sass'
4
2
 
5
3
  # Render text via the Sass library (part of Haml)
@@ -0,0 +1,56 @@
1
+ module Webby
2
+ module Filters
3
+
4
+ # The Slides filter is used to generate an S5 presentation from HTML input
5
+ # text. The input HTML is scanned for <h1> tags and slide divs are inserted
6
+ # before each <h1> tag found.
7
+ #
8
+ # When the HTML is rendered into the presentation layout, the result is an
9
+ # S5 presentation -- provided that the layout includes the appropriate S5
10
+ # javascript and CSS files.
11
+ #
12
+ class Slides
13
+
14
+ START_SLIDE = %{<div class="slide">#$/}
15
+ END_SLIDE = %{</div>#$/#$/}
16
+
17
+ # call-seq:
18
+ # Slides.new( html )
19
+ #
20
+ # Creates a new slides filter that will operate on the given
21
+ # _html_ string.
22
+ #
23
+ def initialize( str )
24
+ @str = str
25
+ @open = false
26
+ end
27
+
28
+ # call-seq:
29
+ # filter => html
30
+ #
31
+ # Process the original html document passed to the filter when it was
32
+ # created. The document will be scanned for H1 heading tags and slide
33
+ # divs will be inserted into the page before each H1 tag that is found.
34
+ #
35
+ def filter
36
+ result = []
37
+
38
+ @str.split(%r/\<h1\>/i).each do |slide|
39
+ next if slide.strip.empty?
40
+ result << START_SLIDE << '<h1>' << slide << END_SLIDE
41
+ end
42
+
43
+ result.join
44
+ end
45
+ end # class Slides
46
+
47
+ # Insert slide divs into the input HTML text.
48
+ #
49
+ register :slides do |input|
50
+ Slides.new(input).filter
51
+ end
52
+
53
+ end # module Filters
54
+ end # module Webby
55
+
56
+ # EOF
@@ -1,5 +1,3 @@
1
- # $Id: textile.rb 71 2007-12-13 05:45:53Z tim_pease $
2
-
3
1
  try_require 'redcloth'
4
2
 
5
3
  # Render text via textile using the RedCloth library.
@@ -1,5 +1,3 @@
1
- # $Id: tidy.rb 192 2008-03-08 16:27:29Z tim_pease $
2
-
3
1
  require 'fileutils'
4
2
  require 'tempfile'
5
3
 
@@ -1,5 +1,3 @@
1
- # $Id: helpers.rb 167 2008-02-24 00:59:54Z tim_pease $
2
-
3
1
  require Webby.libpath(*%w[webby renderer])
4
2
 
5
3
  module Webby
@@ -0,0 +1,141 @@
1
+
2
+ module Webby::Helpers
3
+
4
+ # Based on code from Rails and Merb.
5
+ #
6
+ module CaptureHelper
7
+
8
+ # Called in pages and partials to store up content for later use. Takes a
9
+ # string and/or a block. First, the string is evaluated, and then the
10
+ # block is captured using the capture() helper provided by the template
11
+ # languages. The two are concatenated together.
12
+ #
13
+ # Content is retrieved by calling the method without a string or a block.
14
+ #
15
+ # ==== Parameters
16
+ # obj<Object>:: The key in the conetnt_for hash.
17
+ # string<String>:: Textual content. Defaults to nil.
18
+ # &block:: A block to be evaluated and concatenated to string.
19
+ #
20
+ # ==== Returns
21
+ # Any content associated with the key (or nil).
22
+ #
23
+ # ==== Example
24
+ # content_for(:foo, "Foo")
25
+ # content_for(:foo) #=> "Foo"
26
+ # content_for(:foo, "Bar")
27
+ # content_for(:foo) #=> "FooBar"
28
+ #
29
+ def content_for( obj, string = nil, &block )
30
+ return @_content_for[obj] unless string || block_given?
31
+
32
+ cur = @_content_for[obj].to_s
33
+ new = string.to_s + (block_given? ? capture_erb(&block) : "")
34
+ @_content_for[obj] = cur + new
35
+ end
36
+
37
+ # Returns true if there is content for the given key. Otherwise returns
38
+ # false.
39
+ #
40
+ # ==== Parameters
41
+ # obj<Object>:: The key in the conetnt_for hash.
42
+ #
43
+ # ==== Example
44
+ # content_for(:foo, "Foo")
45
+ # content_for?(:foo) #=> true
46
+ # content_for?(:bar) #=> false
47
+ #
48
+ def content_for?( obj )
49
+ @_content_for.key?(obj)
50
+ end
51
+
52
+ # Deletes any content associated with the given object in the content_for
53
+ # hash.
54
+ #
55
+ # ==== Parameters
56
+ # obj<Object>:: The key in the conetnt_for hash.
57
+ #
58
+ # ==== Returns
59
+ # Any content associated with the key (or nil).
60
+ #
61
+ # ==== Example
62
+ # content_for(:foo, "Foo")
63
+ # content_for?(:foo) #=> true
64
+ # delete_content_for(:foo)
65
+ # content_for?(:foo) #=> false
66
+ #
67
+ def delete_content_for( obj )
68
+ @_content_for.delete(obj)
69
+ end
70
+
71
+ # This method is used to capture content from an ERB filter evaluation. It
72
+ # is useful to helpers that need to process chunks of data during ERB filter
73
+ # processing.
74
+ #
75
+ # ==== Parameters
76
+ # *args:: Arguments to pass to the block.
77
+ # &block:: The ERB block to call.
78
+ #
79
+ # ==== Returns
80
+ # String:: The output of the block.
81
+ #
82
+ # ==== Examples
83
+ # Capture being used in an ERB page:
84
+ #
85
+ # <% @foo = capture_erb do %>
86
+ # <p>Some Foo content!</p>
87
+ # <% end %>
88
+ #
89
+ def capture_erb( *args, &block )
90
+ # get the buffer from the block's binding
91
+ buffer = _erb_buffer(block.binding) rescue nil
92
+
93
+ # If there is no buffer, just call the block and get the contents
94
+ if buffer.nil?
95
+ block.call(*args)
96
+ # If there is a buffer, execute the block, then extract its contents
97
+ else
98
+ pos = buffer.length
99
+ block.call(*args)
100
+
101
+ # extract the block
102
+ data = buffer[pos..-1]
103
+
104
+ # replace it in the original with empty string
105
+ buffer[pos..-1] = ""
106
+
107
+ data
108
+ end
109
+ end
110
+
111
+ # This method is used to concatenate content into the ERB output buffer.
112
+ # It is usefule to helpers that need to insert transformed text back into
113
+ # the ERB output buffer.
114
+ #
115
+ # ==== Parameters
116
+ # string<String>:: The string to insert into the ERB output.
117
+ # the_binding<Binding>:: The binding to pass to the buffer.
118
+ #
119
+ def concat_erb( string, the_binding )
120
+ _erb_buffer(the_binding) << string
121
+ end
122
+
123
+ # Provides direct acccess to the ERB buffer in the conext of the binding.
124
+ #
125
+ # ==== Parameters
126
+ # the_binding<Binding>:: The binding to pass to the buffer.
127
+ #
128
+ # ==== Returns
129
+ # The current ERB output buffer.
130
+ #
131
+ def _erb_buffer( the_binding )
132
+ eval("_erbout", the_binding, __FILE__, __LINE__)
133
+ end
134
+
135
+ end # module CaptureHelper
136
+
137
+ register(CaptureHelper)
138
+
139
+ end # module Webby::Helpers
140
+
141
+ # EOF
@@ -1,5 +1,3 @@
1
- # $Id: coderay_helper.rb 199 2008-03-11 18:54:45Z tim_pease $
2
-
3
1
  if try_require 'coderay'
4
2
  require 'enumerator'
5
3
 
@@ -33,15 +31,8 @@ module CodeRayHelper
33
31
  def coderay( *args, &block )
34
32
  opts = args.last.instance_of?(Hash) ? args.pop : {}
35
33
 
36
- buffer = eval('_erbout', block.binding)
37
- pos = buffer.length
38
- block.call(*args)
39
-
40
- text = buffer[pos..-1]
41
- if text.empty?
42
- buffer[pos..-1] = ''
43
- return
44
- end
34
+ text = capture_erb(&block)
35
+ return if text.empty?
45
36
 
46
37
  defaults = ::Webby.site.coderay
47
38
  lang = opts.getopt(:lang, defaults[:lang]).to_sym
@@ -62,12 +53,10 @@ module CodeRayHelper
62
53
  out << ::CodeRay.scan(text, lang).html(cr_opts)
63
54
  out << '</pre></div>'
64
55
 
65
- if @_cursor.remaining_filters.include? 'textile'
66
- out.insert 0, "<notextile>\n"
67
- out << "\n</notextile>"
68
- end
56
+ # put some guards around the output (specifically for textile)
57
+ out = _guard(out)
69
58
 
70
- buffer[pos..-1] = out
59
+ concat_erb(out, block.binding)
71
60
  return
72
61
  end
73
62
  end # module CodeRayHelper
@@ -1,5 +1,3 @@
1
- # $Id: graphviz_helper.rb 193 2008-03-09 02:32:37Z tim_pease $
2
-
3
1
  require 'fileutils'
4
2
  require 'tempfile'
5
3
 
@@ -64,24 +62,18 @@ module GraphvizHelper
64
62
  def graphviz( *args, &block )
65
63
  opts = args.last.instance_of?(Hash) ? args.pop : {}
66
64
 
65
+ text = capture_erb(&block)
66
+ return if text.empty?
67
+
67
68
  # create a temporary file for holding any error messages
68
69
  # from the graphviz program
69
70
  err = Tempfile.new('graphviz_err')
70
71
  err.close
71
72
 
72
- buffer = eval('_erbout', block.binding)
73
- pos = buffer.length
74
- block.call(*args)
75
-
76
73
  defaults = ::Webby.site.graphviz
77
74
  path = opts.getopt(:path, defaults[:path])
78
75
  cmd = opts.getopt(:cmd, defaults[:cmd])
79
76
  type = opts.getopt(:type, defaults[:type])
80
- text = buffer[pos..-1].strip
81
- if text.empty?
82
- buffer[pos..-1] = ''
83
- return
84
- end
85
77
 
86
78
  # pull the name of the graph|digraph out of the DOT script
87
79
  name = text.match(%r/\A\s*(?:strict\s+)?(?:di)?graph\s+([A-Za-z_][A-Za-z0-9_]*)\s+\{/o)[1]
@@ -127,14 +119,10 @@ module GraphvizHelper
127
119
  IO.popen(cmd, 'w') {|io| io.write text}
128
120
  GraphvizHelper.error_check(err)
129
121
 
130
- # see if we need to put some guards around the output
131
- # (specifically for textile)
132
- if @_cursor.remaining_filters.include? 'textile'
133
- out.insert 0, "<notextile>\n"
134
- out << "\n</notextile>"
135
- end
122
+ # put some guards around the output (specifically for textile)
123
+ out = _guard(out)
136
124
 
137
- buffer[pos..-1] = out
125
+ concat_erb(out, block.binding)
138
126
  return
139
127
  end
140
128
  end # module GraphvizHelper
@@ -1,5 +1,3 @@
1
- # $Id: tag_helper.rb 157 2008-02-20 17:41:00Z tim_pease $
2
-
3
1
  require 'erb'
4
2
  require 'set'
5
3
 
@@ -1,5 +1,3 @@
1
- # $Id: tex_img_helper.rb 193 2008-03-09 02:32:37Z tim_pease $
2
-
3
1
  require Webby.libpath(*%w[webby stelan mktemp])
4
2
  require 'fileutils'
5
3
 
@@ -43,15 +41,8 @@ module TexImgHelper
43
41
  name = args.first
44
42
  raise 'TeX graphics must have a name' if name.nil?
45
43
 
46
- buffer = eval('_erbout', block.binding)
47
- pos = buffer.length
48
- block.call(*args)
49
-
50
- text = buffer[pos..-1].strip
51
- if text.empty?
52
- buffer[pos..-1] = ''
53
- return
54
- end
44
+ text = capture_erb(&block)
45
+ return if text.empty?
55
46
 
56
47
  defaults = ::Webby.site.tex2img
57
48
  path = opts.getopt(:path, defaults[:path])
@@ -125,12 +116,10 @@ module TexImgHelper
125
116
  end
126
117
  out << " />\n"
127
118
 
128
- if @_cursor.remaining_filters.include? 'textile'
129
- out.insert 0, "<notextile>\n"
130
- out << "\n</notextile>"
131
- end
119
+ # put some guards around the output (specifically for textile)
120
+ out = _guard(out)
132
121
 
133
- buffer[pos..-1] = out
122
+ concat_erb(out, block.binding)
134
123
  return
135
124
  end
136
125
  end # module TexImgHelper
@@ -1,5 +1,3 @@
1
- # $Id: ultraviolet_helper.rb 199 2008-03-11 18:54:45Z tim_pease $
2
-
3
1
  # This code was provided by Guillaume Carbonneau -- http://radr.ca/
4
2
  # Many thanks for his support of Webby!
5
3
 
@@ -19,17 +17,17 @@ module UltraVioletHelper
19
17
  # <% uv( :lang => "ruby", :line_numbers => true ) do -%>
20
18
  # # Initializer for the class.
21
19
  # def initialize( string )
22
- # @str = stirng
20
+ # @str = string
23
21
  # end
24
22
  # <% end -%>
25
23
  #
26
24
  # The supported UltraViolet options are the following:
27
25
  #
28
- # :lang : the language to highlight (ruby, c, html, ...)
29
- # [defaults to 'ruby']
30
- # :line_numbers : true or false [defaults to false]
31
- # :theme : see list of available themes in ultraviolet
32
- # [defaults to 'mac_classic']
26
+ # :lang : the language to highlight (ruby, c, html, ...)
27
+ # [defaults to 'ruby']
28
+ # :line_numbers : true or false [defaults to false]
29
+ # :theme : see list of available themes in ultraviolet
30
+ # [defaults to 'mac_classic']
33
31
  #
34
32
  # The defaults can be overridden for an entire site by changing the SITE.uv
35
33
  # options hash in the Rakefile.
@@ -37,15 +35,8 @@ module UltraVioletHelper
37
35
  def uv( *args, &block )
38
36
  opts = args.last.instance_of?(Hash) ? args.pop : {}
39
37
 
40
- buffer = eval('_erbout', block.binding)
41
- pos = buffer.length
42
- block.call(*args)
43
-
44
- text = buffer[pos..-1]
45
- if text.empty?
46
- buffer[pos..-1] = ''
47
- return
48
- end
38
+ text = capture_erb(&block)
39
+ return if text.empty?
49
40
 
50
41
  defaults = ::Webby.site.uv
51
42
  lang = opts.getopt(:lang, defaults[:lang])
@@ -56,12 +47,10 @@ module UltraVioletHelper
56
47
  out << Uv.parse(text, "xhtml", lang, line_numbers, theme)
57
48
  out << '</div>'
58
49
 
59
- if @_cursor.remaining_filters.include? 'textile'
60
- out.insert 0, "<notextile>\n"
61
- out << "\n</notextile>"
62
- end
50
+ # put some guards around the output (specifically for textile)
51
+ out = _guard(out)
63
52
 
64
- buffer[pos..-1] = out
53
+ concat_erb(out, block.binding)
65
54
  return
66
55
  end
67
56
  end # module UltraVioletHelper