diff --git a/parser/package.json b/parser/package.json index fafef67c..18950879 100644 --- a/parser/package.json +++ b/parser/package.json @@ -20,7 +20,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "expensify-common": "Expensify/expensify-common#0b1275e1f0809a5a2365b92d9fa92b11654b164f", + "expensify-common": "Expensify/expensify-common#9a68635cdcef4c81593c0f816a007bc9c707d46a", "patch-package": "^8.0.0", "underscore": "^1.13.6" } diff --git a/parser/patches/expensify-common+1.0.0.patch b/parser/patches/expensify-common+1.0.0.patch index 11cd667b..f0efa82f 100644 --- a/parser/patches/expensify-common+1.0.0.patch +++ b/parser/patches/expensify-common+1.0.0.patch @@ -20,18 +20,10 @@ index 49cebfb..a086055 100644 REPORT: { diff --git a/node_modules/expensify-common/lib/ExpensiMark.js b/node_modules/expensify-common/lib/ExpensiMark.js -index 1d3d775..6ab5fa3 100644 +index 5c6a593..e3b304e 100644 --- a/node_modules/expensify-common/lib/ExpensiMark.js +++ b/node_modules/expensify-common/lib/ExpensiMark.js -@@ -3,14 +3,13 @@ import Str from './str'; - import * as Constants from './CONST'; - import * as UrlPatterns from './Url'; - --const MARKDOWN_LINK = `\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)]\\(${UrlPatterns.MARKDOWN_URL_REGEX}\\)(?![^<]*(<\\/pre>|<\\/code>))`; --const MARKDOWN_LINK_REGEX = new RegExp(MARKDOWN_LINK, 'gi'); --const MARKDOWN_IMAGE_REGEX = new RegExp(`\\!${MARKDOWN_LINK}`, 'gi'); -+const MARKDOWN_LINK_REGEX = new RegExp(`\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)]\\(${UrlPatterns.MARKDOWN_URL_REGEX}\\)(?![^<]*(<\\/pre>|<\\/code>))`, 'gi'); -+const MARKDOWN_IMAGE_REGEX = new RegExp(`\\!(?:\\[([^\\][]*(?:\\[[^\\][]*][^\\][]*)*)])?\\(${UrlPatterns.MARKDOWN_URL_REGEX}\\)(?![^<]*(<\\/pre>|<\\/code>))`, 'gi'); +@@ -8,8 +8,8 @@ const MARKDOWN_IMAGE_REGEX = new RegExp(`\\!(?:\\[([^\\][]*(?:\\[[^\\][]*][^\\][ const SLACK_SPAN_NEW_LINE_TAG = ''; @@ -42,7 +34,7 @@ index 1d3d775..6ab5fa3 100644 /** * The list of regex replacements to do on a comment. Check the link regex is first so links are processed * before other delimiters -@@ -46,7 +45,7 @@ export default class ExpensiMark { +@@ -45,7 +45,7 @@ export default class ExpensiMark { return `
${group}`; }, rawInputReplacement: (match, __, textWithinFences) => { @@ -51,82 +43,34 @@ index 1d3d775..6ab5fa3 100644 const group = textWithinFences.replace(/(?:(?![\n\r])\s)/g, ' '); return `
${group}`; }, -@@ -118,13 +117,14 @@ export default class ExpensiMark { - * Converts markdown style images to img tags e.g. ![Expensify](https://www.expensify.com/attachment.png) - * We need to convert before linking rules since they will not try to create a link from an existing img - * tag. -- * Additional sanitization is done to the alt attribute to prevent parsing it further to html by later rules. -+ * Additional sanitization is done to the alt attribute to prevent parsing it further to html by later -+ * rules. - */ - { - name: 'image', - regex: MARKDOWN_IMAGE_REGEX, -- replacement: (match, g1, g2) => ``, -- rawInputReplacement: (match, g1, g2) => `` -+ replacement: (match, g1, g2) => ``, -+ rawInputReplacement: (match, g1, g2) => `` - }, - - /** @@ -176,7 +176,7 @@ export default class ExpensiMark { { - name: 'roomMentions', + name: 'reportMentions', - regex: /(?$1', }, -@@ -280,7 +280,7 @@ export default class ExpensiMark { - * Use [\s\S]* instead of .* to match newline - */ - name: 'italic', -- regex: /(\b_+|\b)(?!_blank")_((?![\s_])[\s\S]*?[^\s_])_(?![^\W_])(?![^<]*(<\/pre>|<\/code>|<\/a>|<\/mention-user>|_blank))/g, -+ regex: /(?]*)(\b_+|\b)(?!_blank")_((?![\s_])[\s\S]*?[^\s_](?)(?![^<]*(<\/pre>|<\/code>|<\/a>|<\/mention-user>|_blank))/g, - - // We want to add extraLeadingUnderscores back before the tag unless textWithinUnderscores starts with valid email - replacement: (match, extraLeadingUnderscores, textWithinUnderscores) => { -@@ -311,12 +311,12 @@ export default class ExpensiMark { - // \B will match everything that \b doesn't, so it works - // for * and ~: https://www.rexegg.com/regex-boundaries.html#notb - name: 'bold', -- regex: /\B\*(?![^<]*(?:<\/pre>|<\/code>|<\/a>))((?![\s*])[\s\S]*?[^\s*])\*\B(?![^<]*(<\/pre>|<\/code>|<\/a>))/g, -+ regex: /(?]*)\B\*((?![\s*])[\s\S]*?[^\s*](?)(?![^<]*(<\/pre>|<\/code>|<\/a>))/g, - replacement: (match, g1) => (g1.includes('') || this.containsNonPairTag(g1) ? match : `${g1}`), - }, - { - name: 'strikethrough', -- regex: /\B~((?![\s~])[\s\S]*?[^\s~])~\B(?![^<]*(<\/pre>|<\/code>|<\/a>))/g, -+ regex: /(?]*)\B~((?![\s~])[\s\S]*?[^\s~](?)(?![^<]*(<\/pre>|<\/code>|<\/a>))/g, - replacement: (match, g1) => (g1.includes('') || this.containsNonPairTag(g1) ? match : `