Skip to content

Commit

Permalink
used nbsp for team text and rule reference
Browse files Browse the repository at this point in the history
  • Loading branch information
harvanchik committed Jan 24, 2023
1 parent d1b6ecf commit 1105e37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/routes/c/[casePlayId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@
const TEAM_REGEX = /Team ([ABKR])|[ABKR]-[0-9]{1,2}/g;
// replace the matched text with a u element
text = text.replace(TEAM_REGEX, match => {
// create a u element (and replace hyphens with non-breaking hyphens)
return `<u>${match}</u>`.replace(/-/g, '&#8209;');
// create a u element (use non-breaking hyphens and spaces)
return `<u>${match}</u>`.replace(/-/g, '&#8209;').replace(' ', '&nbsp;');
});
// create a regular expression to match team yardage lines
const YARD_REGEX = /([ABKR]'s\s[1-4]?[0-9])|([ABKR]'s)/g;
// replace the matched text with a bold element
text = text.replace(YARD_REGEX, match => {
// create a bold element
return `<b>${match}</b>`;
return `<b>${match}</b>`.replace(' ', '&nbsp;');
});
// create a regular expression to match a rule reference
const RULE_REGEX = /Rule ([0-9]{1,2}-[0-9]{1,2}-[0-9]{1,2}[A-Z]{0,1})/g;
// replace the matched text with a u element
text = text.replace(RULE_REGEX, match => {
// create a u element
return `<u>${match}</u>`;
return `<u>${match}</u>`.replace(/-/g, '&#8209;').replace(' ', '&nbsp;');
});
// if text matched 'accept', make the text green
text = text.replace(/accepts|accepted|accept/gi, '<span class="accept">$&</span>');
Expand Down

1 comment on commit 1105e37

@vercel
Copy link

@vercel vercel bot commented on 1105e37 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

case-play – ./

www.caseplay.org
caseplay.org
case-play-harvanchik.vercel.app
case-play-git-main-harvanchik.vercel.app

Please sign in to comment.