Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: util/template for handlebars (#5878)
- Loading branch information
Showing
15 changed files
with
63 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as handlebars from 'handlebars'; | ||
|
||
handlebars.registerHelper('encodeURIComponent', encodeURIComponent); | ||
|
||
export function compile(template: string, input: any): string { | ||
return handlebars.compile(template)(input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import handlebars from 'handlebars'; | ||
import * as template from '../../../util/template'; | ||
import { BranchConfig } from '../../common'; | ||
|
||
// istanbul ignore next | ||
export function getPrBanner(config: BranchConfig): string { | ||
if (config.global && config.global.prBanner) { | ||
return handlebars.compile(config.global.prBanner)(config) + '\n\n'; | ||
return template.compile(config.global.prBanner, config) + '\n\n'; | ||
} | ||
if (config.isGroup) { | ||
return ''; // TODO: why? | ||
} | ||
if (!config.prBanner) { | ||
return ''; | ||
} | ||
return handlebars.compile(config.prBanner)(config) + '\n\n'; | ||
return template.compile(config.prBanner.toString(), config) + '\n\n'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import handlebars from 'handlebars'; | ||
import * as template from '../../../util/template'; | ||
import { BranchConfig } from '../../common'; | ||
|
||
// istanbul ignore next | ||
export function getPrFooter(config: BranchConfig): string { | ||
if (config.global && config.global.prFooter) { | ||
return '\n---\n\n' + handlebars.compile(config.global.prFooter)(config); | ||
return '\n---\n\n' + template.compile(config.global.prFooter, config); | ||
} | ||
return ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters