Created
May 23, 2011 11:14
-
-
Save tatey/986559 to your computer and use it in GitHub Desktop.
Experimenting with liquid and fragmented content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Layout.new.tap do |layout| | |
| layout.body <<-HTML | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| {{ content }} | |
| </body> | |
| </html> | |
| HTML | |
| end.save | |
| Page.new.tap do |page| | |
| page.layout = Layout.first | |
| page.body = <<-HTML | |
| <h1>{% part heading %}</h1> | |
| {% part body %} | |
| HTML | |
| end.save | |
| Part.new.tap do |part| | |
| part.label = 'heading' | |
| part.page = Page.first | |
| part.body = <<-HTML | |
| Heading | |
| HTML | |
| end.save | |
| Part.new.tap do |part| | |
| part.label = 'heading' | |
| part.page = Page.first | |
| part.body = <<-HTML | |
| <p>Lorem ipsum dolar sit amet</p> | |
| HTML | |
| end.save | |
| Page.first.render # => String | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <h1>Heading</h1> | |
| <p>Lorem ipsum dolar sit amet</p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment