Skip to content

Commit

Permalink
closes #150
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 30, 2024
1 parent 7cf55b4 commit 47ca207
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p [innerHtml]="html">{{ text() }}</p>
<p [innerHtml]="html | faq:product() | markdown">{{ text() }}</p>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { environment } from '../../../../environments/environment';
})
export class CardTextComponent {
public text = input.required<string>();
public product = input<string>();

public html = '';

Expand Down
3 changes: 2 additions & 1 deletion src/app/_shared/pipes/faq.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export class FaqPipe implements PipeTransform {
private metaService = inject(MetaService);
private cardsService = inject(CardsService);

transform(value: string, ...args: string[]): string {
transform(value: string, ...args: (string | undefined)[]): string {
const [productId] = args;
if (!productId) return value ?? '';

const ruleRegex = /\$rule:([\d.]+)\$/gm;
value = value.replace(ruleRegex, (match, p1) => {
Expand Down
3 changes: 2 additions & 1 deletion src/app/card/card.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ <h3 itemprop="name" [innerHTML]="'Q: ' + (entry.q | faq:cardData.game | markdown
@for(entry of errata(); track $index) {
<ion-item>
<ion-label text-wrap>
<p [innerHTML]="'&bull; ' + entry.text | faq:cardData.game | markdown"></p>

<app-card-text [text]="'&bull; ' + entry.text" [product]="cardData.game"></app-card-text>
</ion-label>
</ion-item>
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/errata/errata.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@for(errataEntry of entry.errata; track $index) {
<ion-item>
<ion-label text-wrap>
<p [innerHTML]="errataEntry.text | faq:productId() | markdown"></p>
<app-card-text [text]="errataEntry.text" [product]="productId()"></app-card-text>
</ion-label>
</ion-item>
}
Expand Down

0 comments on commit 47ca207

Please sign in to comment.