badges: cleanup. enforce all template fields to be lower case. thanx @adamdmharvey
Signed-off-by: Andreas Stenius <git@astekk.se>
This commit is contained in:
committed by
Fredrik Adelöw
parent
38cc67e551
commit
0f30b99bc2
@@ -20,9 +20,9 @@ export const badges: Badge[] = [
|
||||
{
|
||||
id: 'pingback',
|
||||
kind: 'entity',
|
||||
description: 'Link back to _{app.title}',
|
||||
label: '_{app.title}',
|
||||
message: '_{entity.kind}: _{entity.metadata.name}',
|
||||
description: 'Link to _{entity.metadata.name} in _{app.title}',
|
||||
label: '_{entity.kind}',
|
||||
message: '_{entity.metadata.name}',
|
||||
style: 'flat-square',
|
||||
},
|
||||
{
|
||||
@@ -39,7 +39,6 @@ export const badges: Badge[] = [
|
||||
description: 'Entity owner badge',
|
||||
label: 'owner',
|
||||
message: '_{entity.spec.owner}',
|
||||
color: 'blue',
|
||||
style: 'flat-square',
|
||||
},
|
||||
{
|
||||
@@ -48,7 +47,6 @@ export const badges: Badge[] = [
|
||||
link: '_{entity_url}/docs',
|
||||
label: 'docs',
|
||||
message: '_{entity.metadata.name}',
|
||||
color: 'navyblue',
|
||||
style: 'flat-square',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -100,7 +100,7 @@ export class DefaultBadgeBuilder implements BadgeBuilder {
|
||||
|
||||
private render(template: string, context: object): string {
|
||||
try {
|
||||
return interpolate(template.replace(/_{/g, '${'), context);
|
||||
return interpolate(template.replace(/_{/g, '${'), context).toLowerCase();
|
||||
} catch (err) {
|
||||
this.logger.info(
|
||||
`badge template error: ${err}. In template: "${template}"`,
|
||||
@@ -110,7 +110,10 @@ export class DefaultBadgeBuilder implements BadgeBuilder {
|
||||
}
|
||||
|
||||
private getMarkdownCode(params: Badge, badge_url: string): string {
|
||||
const alt_text = `${params.description}, ${params.label}: ${params.message}`;
|
||||
let alt_text = `${params.label}: ${params.message}`;
|
||||
if (params.description !== params.label) {
|
||||
alt_text = `${params.description}, ${alt_text}`;
|
||||
}
|
||||
const tooltip = params.description ? ` "${params.description}"` : '';
|
||||
const img = ``;
|
||||
return params.link ? `[${img}](${params.link})` : img;
|
||||
|
||||
Reference in New Issue
Block a user