Skip to content

Commit

Permalink
fix: uško [@] rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed Mar 9, 2024
1 parent 401aa3d commit bbe1cad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/ResultsCard/ResultsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { wordHasForms } from 'utils/wordHasForms';

import { Clipboard } from 'components/Clipboard';

import { removeBrackets } from "../../utils/removeBrackets";

import './ResultsCard.scss';

import ErrorIcon from './images/error-icon.svg';
Expand Down Expand Up @@ -148,7 +150,7 @@ export const ResultsCard =
dispatch(showModalDialog({
type: MODAL_DIALOG_TYPES.MODAL_DIALOG_WORD_FORMS,
data: {
word: Dictionary.getField(item.raw, 'isv'),
word: removeBrackets(Dictionary.getField(item.raw, 'isv'), '[', ']'),
add: Dictionary.getField(item.raw, 'addition'),
details: Dictionary.getField(item.raw, 'partOfSpeech'),
},
Expand Down
5 changes: 3 additions & 2 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export class Table extends Component<ITableProps> {
}

private parseItem(raw): { str: string, attrs: any } {
let [str, rawAttrs] = raw.split('@');
// use negative lookahead for @] to avoid splitting by @ inside []
let [str, rawAttrs] = raw.split(/@(?!])/);
str = parseStr(str);
const attrs = {};
if (!rawAttrs) {
Expand All @@ -32,7 +33,7 @@ export class Table extends Component<ITableProps> {
}
attrs[exp[0]] = exp[1];
});

return {
str,
attrs,
Expand Down

0 comments on commit bbe1cad

Please sign in to comment.