scribble 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/scribble/support/context.rb +3 -1
- data/lib/scribble/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd8eed0dd90c0f26ad395bd9930d0111285f674e
|
4
|
+
data.tar.gz: 020cfc814ed54521e885279a176ec33ecfc8b500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fdf7f54319dc431fb920a02cbf82227c43d9d63025f65237e857edb03dc7f76318570dd2c76623689748e56c630cddcd8c4fabd40beb1a202073b2d707c98ad
|
7
|
+
data.tar.gz: cf937ab53bb1d4fcd8d3ea3efa01ba257f448a0a648ef7fdf3bb0eace7965fc69b0f5009016a79d0e60b09f9572949c42c932412d291d4acabcbfe90eb5c56bd
|
data/README.md
CHANGED
@@ -19,6 +19,10 @@ Scribble currently has solid architecture and features and it is already used in
|
|
19
19
|
* Pluggable loader architecture for working with partials and layouts
|
20
20
|
* Ability to convert between formats when inlining partials and layouts with mixed formats (for example: Markdown and HTML)
|
21
21
|
|
22
|
+
## Compatibility
|
23
|
+
|
24
|
+
Scribble is only compatible with Ruby 2.0 and Ruby 2.1 because it uses keyword arguments.
|
25
|
+
|
22
26
|
## Installation
|
23
27
|
|
24
28
|
Add this line to your application's Gemfile:
|
@@ -265,7 +269,7 @@ Nil does not support a literal notation but it can be returned by methods. It is
|
|
265
269
|
|
266
270
|
### Global methods
|
267
271
|
|
268
|
-
Scribble supports the global `if`, `partial`, and `layout` methods. The if method was shown in several previous examples. The `partial` and `layout` methods are similar in that they load a partial through
|
272
|
+
Scribble supports the global `if`, `partial`, and `layout` methods. The if method was shown in several previous examples. The `partial` and `layout` methods are similar in that they load a partial through the loader and render it (converting between any format disparities). The difference is that layout takes a block of content to which the partial can yield using the `content` method.
|
269
273
|
|
270
274
|
# Partial template (loaded by loader as 'foo')
|
271
275
|
|
@@ -379,7 +383,7 @@ The first line of the class implementation registers this method with the regist
|
|
379
383
|
8. The first call to `split_nodes` returns `Some text` which is added to the beginning of the array, together with the argument to `if` cast to a boolean (`false`).
|
380
384
|
9. The `send :elsif` returns and it renders the first list of nodes with a positive condition (`Some more text`)
|
381
385
|
|
382
|
-
This might be hard to wrap your head around but once you do it is a clean and easy way to extend the language with new `if`-like constructs without touching the parser. For examples of this, check out [Sitebox.io forms](http://www.sitebox.io/articles/form-method) and [Sitebox.io columns](http://www.sitebox.io/articles/columns-method). Implementations of block methods that don't use split methods are much easier, lake a look at [the implementation](https://github.com/stefankroes/scribble/blob/master/lib/scribble/methods/times.rb)
|
386
|
+
This might be hard to wrap your head around but once you do it is a clean and easy way to extend the language with new `if`-like constructs without touching the parser. For examples of this, check out [Sitebox.io forms](http://www.sitebox.io/articles/form-method) and [Sitebox.io columns](http://www.sitebox.io/articles/columns-method). Implementations of block methods that don't use split methods are much easier, lake a look at [the implementation](https://github.com/stefankroes/scribble/blob/master/lib/scribble/methods/times.rb) of the `times` method.
|
383
387
|
|
384
388
|
### Method implementation API
|
385
389
|
|
@@ -20,7 +20,9 @@ module Scribble
|
|
20
20
|
raise NotImplementedError, 'Class that includes context must implement nodes method'
|
21
21
|
end
|
22
22
|
|
23
|
-
def render nodes:
|
23
|
+
def render nodes: nil, context: self
|
24
|
+
nodes ||= self.nodes
|
25
|
+
|
24
26
|
if !require_conversion?
|
25
27
|
render_without_conversion nodes, context
|
26
28
|
|
data/lib/scribble/version.rb
CHANGED