diff --git a/examples/example2/treate/html/but_i_have.haml b/examples/example2/treate/html/but_i_have.haml deleted file mode 100644 index 94b11fb..0000000 --- a/examples/example2/treate/html/but_i_have.haml +++ /dev/null @@ -1,16 +0,0 @@ -.but_i_have - :textile - h2. But I Already Use Haml / Erubis / Builder and They're Great. - - Repeat after me: Tater is _not_ Haml. - - * Tater is _not_ Haml. - * Tater is _not_ Haml. - * Tater is _not_ Haml. - - *Tater* is not a templating engine. It's completely engine-agnostic. In fact, you can use Haml, - Erubis, Builder, Textile, and any other engine you want and still get the benefit of Tater's - _actual_ features. Again, Tater doesn't care about what you're actually displaying in your templates, - just how they're ordered. You can sit a Haml file right next to an ERB file and a Builder file. Tater - doesn't know, or care, that you've done this. - \ No newline at end of file diff --git a/examples/example2/treate/html/content.haml b/examples/example2/treate/html/content.haml new file mode 100644 index 0000000..07c094b --- /dev/null +++ b/examples/example2/treate/html/content.haml @@ -0,0 +1,5 @@ +%ol + - all_sections do |s| + %li{:id => s} + :markdown + #{yield} diff --git a/examples/example2/treate/html/header.haml b/examples/example2/treate/html/header.haml deleted file mode 100644 index d618e76..0000000 --- a/examples/example2/treate/html/header.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h1 - Welcome to Tater Tots -%h2 - Templates for Ruby: The Object-Oriented Templating System - -%ol - %li= yield - %li= yield diff --git a/examples/example2/treate/html/main.haml b/examples/example2/treate/html/main.haml index e4904df..cca8747 100644 --- a/examples/example2/treate/html/main.haml +++ b/examples/example2/treate/html/main.haml @@ -4,4 +4,14 @@ %title Tater Tots %body - %div= yield \ No newline at end of file + #page + #title + :markdown + #{yield} + + #content= yield + + #copyright + :markdown + #{yield} + \ No newline at end of file diff --git a/examples/example2/treate/html/setup.rb b/examples/example2/treate/html/setup.rb new file mode 100644 index 0000000..32ba1e7 --- /dev/null +++ b/examples/example2/treate/html/setup.rb @@ -0,0 +1,5 @@ +inherits 'treate/markdown' + +def init + sections 'main', ['title', 'content', ['what_is', 'but_i_have'], 'copyright'] +end diff --git a/examples/example2/treate/html/what_is.haml b/examples/example2/treate/html/what_is.haml deleted file mode 100644 index 31493ea..0000000 --- a/examples/example2/treate/html/what_is.haml +++ /dev/null @@ -1,40 +0,0 @@ -.what_is_this - :textile - h2. What is This? - - *Tater Tots* (or _Tater_ for short) is an _object-oriented_ templating system that doesn't care about - what templating engines you like to use. It's kind of like a meta-templating engine, because it really - only cares about where your templates come from-- not what's in them. All you have to give Tater is - a list of "sections" that make up your template. - - h4. Wait, Did you say object oriented? _For files?_ - - Yes. I did. *Tater*'s goal is to bring modularity to your templates by introducing this nifty new concept - called _"Object-Oriented Programming"_. It allows you to essentially "subclass" a template from another one, - inheriting all of the parent template's behaviour. It also allows you to solve another problem common to - complex templates: _coupling_. - - Now bear with me here, coupling is considered a common problem in software, but you've probably never heard - someone tell you that your templates files suffer from that problem. Coupling is a necessary dependency from - one module to another, making it impossible to break the two modules apart. So when you directly call a template - from one of your other template files, you are creating exactly that kind of coupling. - - How do we solve template coupling? *Sections*. - - h4. Sections? - - You might know these as _partials_. But partials are *ugly*. Partials get lost deep inside your templates - and never get out. Then, when you need to create a derivative template using everything but that one partial, - you have to make yet another partial which includes the first one, or use some fancy if/then/else logic with - crazy local variables to hide it from the original template. This gets messy fast, because it's all done - from _inside_ the template. - - Sections are as simple as a list. In fact, the sections of a template are exactly that-- a list of sub-templates - that make up the whole. You can compound as many of these lists as you want to create your abstracted template - from nothing but a list of filenames-- then let *Tater* sort it out! - - If you need to visualize this concept, just think about all the templates and partials you used to create any - page in your last website. List them in order from top to bottom, add in some heirarchy rules, and there you go, - you've just made a list of all of your template's sections. It's as simple as that. - - diff --git a/examples/example2/treate/markdown/but_i_have.txt b/examples/example2/treate/markdown/but_i_have.txt new file mode 100644 index 0000000..4947bc1 --- /dev/null +++ b/examples/example2/treate/markdown/but_i_have.txt @@ -0,0 +1,14 @@ +## But I Already Use Haml / Erubis / Builder and They're Great. + +Repeat after me: Tater is _not_ Haml. + +### Tater is _not_ Haml. +#### Tater is _not_ Haml. +##### Tater is _not_ Haml. + +**Tater** is not a templating engine. It's completely engine-agnostic. In fact, you can use Haml, +Erubis, Builder, Textile, and any other engine you want and still get the benefit of Tater's +_actual_ features. Again, Tater doesn't care about what you're actually displaying in your templates, +just how they're ordered. You can sit a Haml file right next to an ERB file and a Builder file. Tater +doesn't know, or care, that you've done this. + diff --git a/examples/example2/treate/markdown/copyright.erb b/examples/example2/treate/markdown/copyright.erb new file mode 100644 index 0000000..a2fa518 --- /dev/null +++ b/examples/example2/treate/markdown/copyright.erb @@ -0,0 +1,3 @@ + +_Copyright 2008 Loren Segal._ +_All code licensed under the MIT License._ \ No newline at end of file diff --git a/examples/example2/treate/markdown/setup.rb b/examples/example2/treate/markdown/setup.rb new file mode 100644 index 0000000..5edf3f2 --- /dev/null +++ b/examples/example2/treate/markdown/setup.rb @@ -0,0 +1,3 @@ +def init + sections 'title', 'what_is', 'but_i_have', 'copyright' +end \ No newline at end of file diff --git a/examples/example2/treate/markdown/title.txt b/examples/example2/treate/markdown/title.txt new file mode 100644 index 0000000..8942c72 --- /dev/null +++ b/examples/example2/treate/markdown/title.txt @@ -0,0 +1,2 @@ +# Welcome to Tater Tots +## Templates for Ruby: The Object-Oriented Templating System diff --git a/examples/example2/treate/markdown/what_is.txt b/examples/example2/treate/markdown/what_is.txt new file mode 100644 index 0000000..84c113e --- /dev/null +++ b/examples/example2/treate/markdown/what_is.txt @@ -0,0 +1,36 @@ +## What is This? + +**Tater Tots** (or _Tater_ for short) is an _object-oriented_ templating system that doesn't care about +what templating engines you like to use. It's kind of like a meta-templating engine, because it really +only cares about where your templates come from-- not what's in them. All you have to give Tater is +a list of "sections" that make up your template. + +#### Wait, Did you say object oriented? _For files?_ + +Yes. I did. **Tater**'s goal is to bring modularity to your templates by introducing this nifty new concept +called _"Object-Oriented Programming"_. It allows you to essentially "subclass" a template from another one, +inheriting all of the parent template's behaviour. It also allows you to solve another problem common to +complex templates: _coupling_. + +Now bear with me here, coupling is considered a common problem in software, but you've probably never heard +someone tell you that your templates files suffer from that problem. Coupling is a necessary dependency from +one module to another, making it impossible to break the two modules apart. So when you directly call a template +from one of your other template files, you are creating exactly that kind of coupling. + +How do we solve template coupling? **Sections**. + +#### Sections? + +You might know these as _partials_. But partials are **ugly**. Partials get lost deep inside your templates +and never get out. Then, when you need to create a derivative template using everything but that one partial, +you have to make yet another partial which includes the first one, or use some fancy if/then/else logic with +crazy local variables to hide it from the original template. This gets messy fast, because it's all done +from _inside_ the template. + +Sections are as simple as a list. In fact, the sections of a template are exactly that-- a list of sub-templates +that make up the whole. You can compound as many of these lists as you want to create your abstracted template +from nothing but a list of filenames-- then let **Tater** sort it out! + +If you need to visualize this concept, just think about all the templates and partials you used to create any +page in your last website. List them in order from top to bottom, add in some heirarchy rules, and there you go, +you've just made a list of all of your template's sections. It's as simple as that. diff --git a/examples/example2/treate/readme/readme_notice.txt b/examples/example2/treate/readme/readme_notice.txt new file mode 100644 index 0000000..529f4fa --- /dev/null +++ b/examples/example2/treate/readme/readme_notice.txt @@ -0,0 +1,6 @@ +## You Should Also Know + +That this `README` was generated by **Treate**. Try it: + + `ruby examples/example2/run.rb readme` + diff --git a/examples/example2/treate/readme/setup.rb b/examples/example2/treate/readme/setup.rb new file mode 100644 index 0000000..5f3805f --- /dev/null +++ b/examples/example2/treate/readme/setup.rb @@ -0,0 +1,6 @@ +inherits 'treate/markdown' + +def init + super + sections.insert_before('copyright', 'readme_notice') +end \ No newline at end of file diff --git a/examples/example2/treate/setup.rb b/examples/example2/treate/setup.rb deleted file mode 100644 index b74dcbd..0000000 --- a/examples/example2/treate/setup.rb +++ /dev/null @@ -1,3 +0,0 @@ -def init - sections 'main', ['header', ['what_is', 'but_i_have'], 'copyright'] -end diff --git a/examples/example2/treate/textile/content/setup.rb b/examples/example2/treate/textile/content/setup.rb deleted file mode 100644 index fc66b2d..0000000 --- a/examples/example2/treate/textile/content/setup.rb +++ /dev/null @@ -1,3 +0,0 @@ -def init - sections 'what_is', 'but_i_have' -end \ No newline at end of file diff --git a/examples/example2/treate/textile/copyright.erb b/examples/example2/treate/textile/copyright.erb deleted file mode 100644 index 34a14f9..0000000 --- a/examples/example2/treate/textile/copyright.erb +++ /dev/null @@ -1 +0,0 @@ -============== Copyright 2008 Loren Segal \ No newline at end of file diff --git a/examples/example2/treate/textile/header.erb b/examples/example2/treate/textile/header.erb deleted file mode 100644 index cd9bb66..0000000 --- a/examples/example2/treate/textile/header.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> \ No newline at end of file diff --git a/examples/example2/treate/textile/main.erb b/examples/example2/treate/textile/main.erb deleted file mode 100644 index cd9bb66..0000000 --- a/examples/example2/treate/textile/main.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> \ No newline at end of file