From ffe3ee375494e5dfc70de6923a3054f7c8b445c5 Mon Sep 17 00:00:00 2001 From: Tetsuro Date: Fri, 16 Oct 2015 11:16:34 -0400 Subject: [PATCH] WIP --- _config.yml | 1 - _tags/control-flow.md | 138 ------------------------------- _tags/control-flow/case-when | 27 ++++++ _tags/control-flow/elsif-else.md | 26 ++++++ _tags/control-flow/if.md | 21 +++++ _tags/control-flow/index.html | 15 ++++ _tags/control-flow/unless.md | 31 +++++++ basics/index.html | 8 -- tags/index.html | 7 +- 9 files changed, 126 insertions(+), 148 deletions(-) delete mode 100644 _tags/control-flow.md create mode 100644 _tags/control-flow/case-when create mode 100644 _tags/control-flow/elsif-else.md create mode 100644 _tags/control-flow/if.md create mode 100644 _tags/control-flow/index.html create mode 100644 _tags/control-flow/unless.md diff --git a/_config.yml b/_config.yml index 914ffa2..870f8e1 100644 --- a/_config.yml +++ b/_config.yml @@ -11,7 +11,6 @@ collections: output: true tags: output: true - permalink: /tags/:path/ exclude: - README.md - CNAME diff --git a/_tags/control-flow.md b/_tags/control-flow.md deleted file mode 100644 index 035582e..0000000 --- a/_tags/control-flow.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: Control Flow ---- - -Control Flow tags determine which block of code should be executed based on different conditions. - - -## if - -

Executes a block of code only if a certain condition is met.

- -

Input

- -
-{% highlight html %}{% raw %} -{% if product.title == 'Awesome Shoes' %} - These shoes are awesome! -{% endif %} -{% endraw %}{% endhighlight %} -
- -

Output

- -
-{% highlight html %}{% raw %} -These shoes are awesome! -{% endraw %}{% endhighlight %} -
- - -## elsif / else - -

Adds more conditions within an if or unless block.

- -

Input

- -
-{% highlight html %}{% raw %} - - {% if customer.name == 'kevin' %} - Hey Kevin! - {% elsif customer.name == 'anonymous' %} - Hey Anonymous! - {% else %} - Hi Stranger! - {% endif %} -{% endraw %}{% endhighlight %} -
- -

Output

- -
-{% highlight html %}{% raw %} -Hey Anonymous! -{% endraw %}{% endhighlight %} -
- - - - -## case/when - -

Creates a switch statement to compare a variable with different values. case initializes the switch statement, and when compares its values.

- -

Input

- -
-{% highlight html %}{% raw %} -{% assign handle = 'cake' %} -{% case handle %} - {% when 'cake' %} - This is a cake - {% when 'cookie' %} - This is a cookie - {% else %} - This is not a cake nor a cookie -{% endcase %} -{% endraw %}{% endhighlight %} -
- -

Output

- -
-{% highlight html %}{% raw %} -This is a cake -{% endraw %}{% endhighlight %} -
- - - - - - - -## unless - -

Similar to if, but executes a block of code only if a certain condition is not met.

- -

Input

- -
-{% highlight html %}{% raw %} - {% unless product.title == 'Awesome Shoes' %} - These shoes are not awesome. - {% endunless %} -{% endraw %}{% endhighlight %} -
- -

Output

- -
-{% highlight html %}{% raw %} -These shoes are not awesome. -{% endraw %}{% endhighlight %} -
- -This would be the equivalent of doing the following: - -
-{% highlight html %}{% raw %} - {% if product.title != 'Awesome Shoes' %} - These shoes are not awesome. - {% endif %} -{% endraw %}{% endhighlight %} -
- - - - - - - - - - - - - diff --git a/_tags/control-flow/case-when b/_tags/control-flow/case-when new file mode 100644 index 0000000..f79ea84 --- /dev/null +++ b/_tags/control-flow/case-when @@ -0,0 +1,27 @@ +## case/when + +

Creates a switch statement to compare a variable with different values. case initializes the switch statement, and when compares its values.

+ +

Input

+ +
+{% highlight html %}{% raw %} +{% assign handle = 'cake' %} +{% case handle %} + {% when 'cake' %} + This is a cake + {% when 'cookie' %} + This is a cookie + {% else %} + This is not a cake nor a cookie +{% endcase %} +{% endraw %}{% endhighlight %} +
+ +

Output

+ +
+{% highlight html %}{% raw %} +This is a cake +{% endraw %}{% endhighlight %} +
diff --git a/_tags/control-flow/elsif-else.md b/_tags/control-flow/elsif-else.md new file mode 100644 index 0000000..e08623d --- /dev/null +++ b/_tags/control-flow/elsif-else.md @@ -0,0 +1,26 @@ +## elsif / else + +

Adds more conditions within an if or unless block.

+ +

Input

+ +
+{% highlight html %}{% raw %} + + {% if customer.name == 'kevin' %} + Hey Kevin! + {% elsif customer.name == 'anonymous' %} + Hey Anonymous! + {% else %} + Hi Stranger! + {% endif %} +{% endraw %}{% endhighlight %} +
+ +

Output

+ +
+{% highlight html %}{% raw %} +Hey Anonymous! +{% endraw %}{% endhighlight %} +
diff --git a/_tags/control-flow/if.md b/_tags/control-flow/if.md new file mode 100644 index 0000000..f41b842 --- /dev/null +++ b/_tags/control-flow/if.md @@ -0,0 +1,21 @@ +## if + +

Executes a block of code only if a certain condition is met.

+ +

Input

+ +
+{% highlight html %}{% raw %} +{% if product.title == 'Awesome Shoes' %} + These shoes are awesome! +{% endif %} +{% endraw %}{% endhighlight %} +
+ +

Output

+ +
+{% highlight html %}{% raw %} +These shoes are awesome! +{% endraw %}{% endhighlight %} +
diff --git a/_tags/control-flow/index.html b/_tags/control-flow/index.html new file mode 100644 index 0000000..7fca750 --- /dev/null +++ b/_tags/control-flow/index.html @@ -0,0 +1,15 @@ +--- +layout: default +--- + +CONTROL FLOW HERE + sss + +{% for doc in site.collections["tags"].docs %} +
+

{{ doc.title }}

+
+ {{ doc.content }} +
+
+{% endfor %} diff --git a/_tags/control-flow/unless.md b/_tags/control-flow/unless.md new file mode 100644 index 0000000..3733404 --- /dev/null +++ b/_tags/control-flow/unless.md @@ -0,0 +1,31 @@ +## unless + +

Similar to if, but executes a block of code only if a certain condition is not met.

+ +

Input

+ +
+{% highlight html %}{% raw %} + {% unless product.title == 'Awesome Shoes' %} + These shoes are not awesome. + {% endunless %} +{% endraw %}{% endhighlight %} +
+ +

Output

+ +
+{% highlight html %}{% raw %} +These shoes are not awesome. +{% endraw %}{% endhighlight %} +
+ +This would be the equivalent of doing the following: + +
+{% highlight html %}{% raw %} + {% if product.title != 'Awesome Shoes' %} + These shoes are not awesome. + {% endif %} +{% endraw %}{% endhighlight %} +
diff --git a/basics/index.html b/basics/index.html index ec015db..1ab753a 100644 --- a/basics/index.html +++ b/basics/index.html @@ -2,11 +2,3 @@ layout: default --- -{% for doc in site.collections["basics"].docs %} -
-

{{ doc.title }}

-
- {{ doc.content }} -
-
-{% endfor %} diff --git a/tags/index.html b/tags/index.html index 925fb36..f0cf854 100644 --- a/tags/index.html +++ b/tags/index.html @@ -2,5 +2,10 @@ layout: default --- -Tags here. +sss +{{ site.collections["tags"] }} + +{% for doc in site.collections["tags"].docs %} + +{% endfor %}