Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rewritten number formatting guide, so that it uses filters.

  • Loading branch information...
commit f5f8e185f284d779c49a1399ba9dd30ac99c0deb 1 parent fae0cef
@groue authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 Guides/sample_code/number_formatting.md
View
12 Guides/sample_code/number_formatting.md
@@ -42,7 +42,7 @@ NSNumberFormatter *decimalNumberFormatter = [[NSNumberFormatter alloc] init];
decimalNumberFormatter.numberStyle = kCFNumberFormatterDecimalStyle;
NSString *decimal = [numberFormatter stringFromNumber:value];
-// Render
+// Render "raw: 0.5, percent: 50 %, decimal: 0,5"
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
value, @"value",
percent, @"percent",
@@ -87,7 +87,7 @@ In this case, the best option is to declare a category on your model object, and
You would then render normally:
```objc
-// Render "50%"
+// Render "raw: 0.5, percent: 50 %, decimal: 0,5"
Model *model = ...
model.value = 0.5;
NSString *rendering = [template renderObject:model];
@@ -179,11 +179,17 @@ After we have told GRMustache how the `percent` and `decimal` filters should pro
/**
- * Render.
+ * Prepare our data
*/
Model *model = ...;
model.value = 0.5;
+
+
+ /**
+ * Render "raw: 0.5, percent: 50 %, decimal: 0,5"
+ */
+
return [template renderObject:model withFilters:filters];
}
```
Please sign in to comment.
Something went wrong with that request. Please try again.