Move examples to the new layout.
This commit is contained in:
parent
b2a9eab211
commit
6dbee67bb0
6
doc-src/content/stylesheets/_examples.sass
Normal file
6
doc-src/content/stylesheets/_examples.sass
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
.demo
|
||||||
|
article
|
||||||
|
text-align: left
|
||||||
|
h1
|
||||||
|
text-align: center
|
||||||
|
|
@ -277,6 +277,7 @@ article
|
|||||||
/* @end
|
/* @end
|
||||||
|
|
||||||
@import "reference"
|
@import "reference"
|
||||||
|
@import "examples"
|
||||||
|
|
||||||
/* @group OVERRIDES by page
|
/* @group OVERRIDES by page
|
||||||
|
|
||||||
|
@ -1,17 +1,4 @@
|
|||||||
!!! Strict
|
- render 'main' do
|
||||||
%html
|
- content_for(:additional_css) do
|
||||||
%head
|
= example_css
|
||||||
%title
|
%article= yield
|
||||||
#{@item[:title]} - Compass
|
|
||||||
%meta{ :content => "text/html; charset=utf-8", "http-equiv" => "Content-Type" }
|
|
||||||
- if @item[:meta_description]
|
|
||||||
%meta{:name => "description", :content => @item[:meta_description]}
|
|
||||||
%link(rel="shortcut icon" type="image/png" href="/docs/images/compass_icon.png")
|
|
||||||
%link{ :href => "/docs/stylesheets/legacy/example.css", :rel => "stylesheet", :type => "text/css", :media => "screen" }
|
|
||||||
%style{:type => "text/css"}= example_css
|
|
||||||
%body{body_attributes(@item)}
|
|
||||||
#container
|
|
||||||
#main
|
|
||||||
= yield
|
|
||||||
|
|
||||||
= render "partials/analytics"
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
/[if IE 6]
|
/[if IE 6]
|
||||||
%link{:charset => "utf-8", :href => "http://universal-ie6-css.googlecode.com/files/ie6.0.3.css", :rel => "stylesheet", :type => "text/css"}
|
%link{:charset => "utf-8", :href => "http://universal-ie6-css.googlecode.com/files/ie6.0.3.css", :rel => "stylesheet", :type => "text/css"}
|
||||||
%link{ :href => "/docs/stylesheets/ui-lightness/jquery-ui-1.7.2.custom.css", :rel => "stylesheet", :type => "text/css", :media => "screen" }
|
%link{ :href => "/docs/stylesheets/ui-lightness/jquery-ui-1.7.2.custom.css", :rel => "stylesheet", :type => "text/css", :media => "screen" }
|
||||||
|
- if @item[:content_for_additional_css]
|
||||||
|
%style(type="text/css")= @item[:content_for_additional_css]
|
||||||
%body{body_attributes(@item)}
|
%body{body_attributes(@item)}
|
||||||
%nav#skip-links
|
%nav#skip-links
|
||||||
%a{:href => "#content"} skip to content
|
%a{:href => "#content"} skip to content
|
||||||
|
@ -1,24 +1,13 @@
|
|||||||
%h1= @item[:title]
|
%h1 Demo: #{@item[:title]}
|
||||||
|
#demo= example_html
|
||||||
|
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
%table#example{:cellspacing=>"0", :cellpadding=>"0", :border=>"0"}
|
#how
|
||||||
%tr.source
|
#markup
|
||||||
%th HTML
|
%pre#haml= h(example_haml)
|
||||||
%th Sass
|
%pre#html= h(example_html)
|
||||||
%tr.source
|
#styles
|
||||||
%td.markup
|
%pre#scss= h(example_scss)
|
||||||
%pre
|
%pre#sass= h(example_sass)
|
||||||
%code.html= h(example_html)
|
%pre#css= h(example_css)
|
||||||
%td.stylesheet
|
|
||||||
%pre
|
|
||||||
%code.sass= h(example_sass)
|
|
||||||
%tr.output
|
|
||||||
%th Display
|
|
||||||
%th Generated CSS
|
|
||||||
%tr.output
|
|
||||||
%td.markup
|
|
||||||
= example_html
|
|
||||||
%td.stylesheet
|
|
||||||
%pre
|
|
||||||
%code.css= h(example_css)
|
|
||||||
|
@ -7,7 +7,10 @@ include Nanoc3::Helpers::Rendering
|
|||||||
include Nanoc3::Helpers::Breadcrumbs
|
include Nanoc3::Helpers::Breadcrumbs
|
||||||
|
|
||||||
def body_class(item)
|
def body_class(item)
|
||||||
(["docs"] + (item[:classnames] || [])).join(" ")
|
classes = ["docs"]
|
||||||
|
classes += item[:classnames] || []
|
||||||
|
classes << "demo" if item.identifier =~ /^\/examples/
|
||||||
|
classes.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def body_id(item)
|
def body_id(item)
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
def example_html
|
def example_haml
|
||||||
markup_item = @item.children.detect{|child| child.identifier =~ /markup/}
|
markup_item = @item.children.detect{|child| child.identifier =~ /markup/}
|
||||||
haml = markup_item.reps.find { |r| r.name == :default }.content_at_snapshot(:raw)
|
markup_item.reps.find { |r| r.name == :default }.content_at_snapshot(:raw)
|
||||||
Haml::Engine.new(haml).render
|
end
|
||||||
|
|
||||||
|
def example_html
|
||||||
|
Haml::Engine.new(example_haml).render
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_sass
|
def example_sass
|
||||||
@ -9,6 +12,10 @@ def example_sass
|
|||||||
markup_item.reps.find { |r| r.name == :default }.content_at_snapshot(:raw)
|
markup_item.reps.find { |r| r.name == :default }.content_at_snapshot(:raw)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def example_scss
|
||||||
|
Sass::Engine.new(example_sass).to_tree.to_scss
|
||||||
|
end
|
||||||
|
|
||||||
def example_css
|
def example_css
|
||||||
Sass::Engine.new(example_sass, Compass.sass_engine_options.merge(:line_comments => false)).render
|
Sass::Engine.new(example_sass, Compass.sass_engine_options.merge(:line_comments => false)).render
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user