Browse files

Merge pull request #45 from begriffs/show_code

Includes HTML preview at the end of each styleguide block
  • Loading branch information...
2 parents a758afc + 92cef6f commit f91b740cba3083ab6c2992abbe9fa3cb9b70e603 @kneath committed Aug 2, 2012
Showing with 8 additions and 3 deletions.
  1. +2 −1 example/app.rb
  2. +4 −1 example/public/stylesheets/layout.css
  3. +2 −1 example/views/_styleguide_block.erb
View
3 example/app.rb
@@ -17,6 +17,7 @@
def styleguide_block(section, &block)
@section = @styleguide.section(section)
@example_html = capture{ block.call }
+ @escaped_html = ERB::Util.html_escape @example_html
@_out_buf << erb(:_styleguide_block)
end
@@ -29,4 +30,4 @@ def capture(&block)
ensure
@_out_buf = out
end
-end
+end
View
5 example/public/stylesheets/layout.css
@@ -136,5 +136,8 @@ h1.styleguide {
font-size: 12px;
font-weight: normal;
color: #222; }
+ .styleguide-example > .styleguide-code {
+ font-family: Monaco, monospace;
+ }
-/* @end */
+/* @end */
View
3 example/views/_styleguide_block.erb
@@ -20,5 +20,6 @@
<%= @example_html.sub('$modifier_class', " #{modifier.class_name}") %>
</div>
<% end %>
+ <pre class="styleguide-code"><%= @escaped_html %></pre>
-</div>
+</div>

0 comments on commit f91b740

Please sign in to comment.