Skip to content

Commit

Permalink
Issue #33: added braces helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMario committed Mar 15, 2018
1 parent 4d8afe9 commit 7456e15
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.swagger.codegen.handlebars.helpers;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

public class BracesHelper implements Helper<String> {

public static final String NAME = "braces";
private static final String RIGHTT_ORIENTATION = "right";
private static final String LEFT_CURLY_BRACES = "{{";
private static final String RIGHT_CURLY_BRACES = "}}";

@Override
public Object apply(String orientation, Options options) {
if (RIGHTT_ORIENTATION.equalsIgnoreCase(orientation)) {
return RIGHT_CURLY_BRACES;
}
return LEFT_CURLY_BRACES;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.swagger.codegen.CodegenResponse;
import io.swagger.codegen.CodegenSecurity;
import io.swagger.codegen.SupportingFile;
import io.swagger.codegen.handlebars.helpers.BracesHelper;
import io.swagger.codegen.handlebars.helpers.HasHelper;
import io.swagger.codegen.handlebars.helpers.HasNotHelper;
import io.swagger.codegen.handlebars.helpers.IsHelper;
Expand Down Expand Up @@ -3257,6 +3258,7 @@ public void addHandlebarHelpers(Handlebars handlebars) {
handlebars.registerHelper(HasHelper.NAME, new HasHelper());
handlebars.registerHelper(IsNotHelper.NAME, new IsNotHelper());
handlebars.registerHelper(HasNotHelper.NAME, new HasNotHelper());
handlebars.registerHelper(BracesHelper.NAME, new BracesHelper());
}

@Override
Expand Down

0 comments on commit 7456e15

Please # to comment.