Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit. Included strip tag.

  • Loading branch information...
commit 333794ca30381e1d8b88111176d2a113703902e0 0 parents
@underdude underdude authored
Showing with 79 additions and 0 deletions.
  1. +9 −0 LICENCE
  2. +56 −0 README.md
  3. +14 −0 strip.rb
9 LICENCE
@@ -0,0 +1,9 @@
+The MIT License (MIT)
+
+Copyright (c) 2012 Aucor Oy
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
56 README.md
@@ -0,0 +1,56 @@
+Jekyll plugins by Aucor
+=======================
+
+Collection of plugins for the Jekyll static site generator.
+
+
+Overview
+--------
+
+Plugins included in this repository:
+
+* **strip.rb** - Block tag for trimming away unwanted newlines and whitespace between them.
+
+
+Usage
+-----
+
+### Strip.rb
+
+Using eg. forloops to generate navigation produces often a huge amount of ugly whitespace. Wrapping the section with `{% strip %}{% endstrip %}` replaces the blocks of whitespace with one newline keeping the resulting in pretty markup.
+
+Example:
+
+ {% strip %}<ul>
+
+ <li>List item 1</li>
+
+
+
+
+ <li>List item 2</li>
+
+ <li>List item 3</li>
+
+
+ </ul>{% endstrip %}
+
+becomes:
+
+ <ul>
+ <li>List item 1</li>
+ <li>List item 2</li>
+ <li>List item 3</li>
+ </ul>
+
+
+Author
+------
+
+Plugins written by Janne Ala-Äijälä of [Aucor Oy](http://www.aucor.fi)
+
+
+Copyright
+---------
+
+Copyright (c) 2012 Aucor Oy. Released under MIT Licence (see LICENCE for details).
14 strip.rb
@@ -0,0 +1,14 @@
+# Replaces multiple newlines and whitespace
+# between them with one newline
+
+module Jekyll
+ class StripTag < Liquid::Block
+
+ def render(context)
+ super.gsub /\n\s*\n/, "\n"
+ end
+
+ end
+end
+
+Liquid::Template.register_tag('strip', Jekyll::StripTag)
Please sign in to comment.
Something went wrong with that request. Please try again.