swift format
This commit is contained in:
@@ -7,12 +7,12 @@ public protocol HBMustacheSequence {
|
||||
func renderInvertedSection(with template: HBMustacheTemplate) -> String
|
||||
}
|
||||
|
||||
extension Sequence {
|
||||
public extension Sequence {
|
||||
/// Render section using template
|
||||
public func renderSection(with template: HBMustacheTemplate) -> String {
|
||||
func renderSection(with template: HBMustacheTemplate) -> String {
|
||||
var string = ""
|
||||
var context = HBMustacheContext(first: true)
|
||||
var iterator = self.makeIterator()
|
||||
var iterator = makeIterator()
|
||||
guard var currentObject = iterator.next() else { return "" }
|
||||
|
||||
while let object = iterator.next() {
|
||||
@@ -24,19 +24,18 @@ extension Sequence {
|
||||
|
||||
context.last = true
|
||||
string += template.render(currentObject, context: context)
|
||||
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
|
||||
/// Render inverted section using template
|
||||
public func renderInvertedSection(with template: HBMustacheTemplate) -> String {
|
||||
func renderInvertedSection(with template: HBMustacheTemplate) -> String {
|
||||
var iterator = makeIterator()
|
||||
if iterator.next() == nil {
|
||||
return template.render(self)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Array: HBMustacheSequence {}
|
||||
|
||||
Reference in New Issue
Block a user