Skip to content

Commit

Permalink
Merge branch 'master' into parse-punctuation
Browse files Browse the repository at this point in the history
  • Loading branch information
Casheeew authored Dec 16, 2023
2 parents ed41ec2 + 64e4598 commit b4004b5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Build Libs
run: npm run build-libs

- name: Lint JS
run: npm run test-lint-js
env:
CI: true

- name: Validate JS Types
run: npm run test-ts
env:
CI: true

- name: Lint CSS
run: npm run test-lint-css
env:
Expand All @@ -40,9 +48,6 @@ jobs:
env:
CI: true

- name: Build Libs
run: npm run build-libs

- name: Tests
run: npm run test-code
env:
Expand Down
12 changes: 6 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"markdown.extension.toc.levels": "1..3",
"[javascript]": {
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.organizeImports": true,
"source.fixAll.eslint": true
"source.addMissingImports": "explicit",
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.addMissingImports": false,
"source.organizeImports": false,
"source.fixAll.eslint": true
"source.addMissingImports": "never",
"source.organizeImports": "never",
"source.fixAll.eslint": "explicit"
},
},
"eslint.format.enable": true,
Expand Down
19 changes: 3 additions & 16 deletions ext/js/dom/document-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,9 @@ export class DocumentUtil {
* @param {boolean} layoutAwareScan Whether or not layout-aware scan mode should be used.
* @param {number} extent The length of the sentence to extract.
* @param {boolean} terminateAtNewlines Whether or not a sentence should be terminated at newline characters.
* @param {Map<string, *[]>} terminatorMap A mapping of characters that terminate a sentence.
* Format:
* ```js
* new Map([ [character: string, [includeCharacterAtStart: boolean, includeCharacterAtEnd: boolean]], ... ])
* ```
* @param {Map<string, *[]>} forwardQuoteMap A mapping of quote characters that delimit a sentence.
* Format:
* ```js
* new Map([ [character: string, [otherCharacter: string, includeCharacterAtStart: boolean]], ... ])
* ```
* @param {Map<string, *[]>} backwardQuoteMap A mapping of quote characters that delimit a sentence,
* which is the inverse of forwardQuoteMap.
* Format:
* ```js
* new Map([ [character: string, [otherCharacter: string, includeCharacterAtEnd: boolean]], ... ])
* ```
* @param {import('text-scanner').SentenceTerminatorMap} terminatorMap A mapping of characters that terminate a sentence.
* @param {import('text-scanner').SentenceForwardQuoteMap} forwardQuoteMap A mapping of quote characters that delimit a sentence.
* @param {import('text-scanner').SentenceBackwardQuoteMap} backwardQuoteMap A mapping of quote characters that delimit a sentence, which is the inverse of forwardQuoteMap.
* @returns {{text: string, offset: number}} The sentence and the offset to the original source.
*/
static extractSentence(source, layoutAwareScan, extent, terminateAtNewlines, terminatorMap, forwardQuoteMap, backwardQuoteMap) {
Expand Down
6 changes: 3 additions & 3 deletions ext/js/language/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export class TextScanner extends EventDispatcher {
this._sentenceScanExtent = 0;
/** @type {boolean} */
this._sentenceTerminateAtNewlines = true;
/** @type {Map<string, [includeCharacterAtStart: boolean, includeCharacterAtEnd: boolean]>} */
/** @type {import('text-scanner').SentenceTerminatorMap} */
this._sentenceTerminatorMap = new Map();
/** @type {Map<string, [character: string, includeCharacterAtStart: boolean]>} */
/** @type {import('text-scanner').SentenceForwardQuoteMap} */
this._sentenceForwardQuoteMap = new Map();
/** @type {Map<string, [character: string, includeCharacterAtEnd: boolean]>} */
/** @type {import('text-scanner').SentenceBackwardQuoteMap} */
this._sentenceBackwardQuoteMap = new Map();
/** @type {import('text-scanner').InputConfig[]} */
this._inputs = [];
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"scripts": {
"build": "node ./dev/bin/build.js",
"build-libs": "node ./dev/bin/build-libs.js",
"test": "npm run test-lint-js && npm run test-ts && npm run test-ts-dev && npm run test-ts-test && npm run test-lint-css && npm run test-lint-html && npm run test-code && npm run test-build",
"test": "npm run test-lint-js && npm run test-ts && npm run test-lint-css && npm run test-lint-html && npm run test-code && npm run test-build",
"test-lint-js": "npx eslint .",
"test-lint-css": "npx stylelint \"ext/**/*.css\" \"test/**/*.css\" \"dev/**/*.css\"",
"test-lint-html": "npx html-validate \"ext/**/*.html\" \"test/**/*.html\" \"dev/**/*.html\"",
"test-ts": "npx tsc --noEmit --project jsconfig.json",
"test-ts": "npm run test-ts-main && npm run test-ts-dev && npm run test-ts-test",
"test-ts-main": "npx tsc --noEmit --project jsconfig.json",
"test-ts-dev": "npx tsc --noEmit --project dev/jsconfig.json",
"test-ts-test": "npx tsc --noEmit --project test/jsconfig.json",
"test-code": "vitest run",
Expand Down
6 changes: 6 additions & 0 deletions types/ext/text-scanner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,9 @@ export type PointerEventType = (
'click' |
'script'
);

export type SentenceTerminatorMap = Map<string, [includeCharacterAtStart: boolean, includeCharacterAtEnd: boolean]>;

export type SentenceForwardQuoteMap = Map<string, [character: string, includeCharacterAtStart: boolean]>;

export type SentenceBackwardQuoteMap = Map<string, [character: string, includeCharacterAtEnd: boolean]>;

0 comments on commit b4004b5

Please sign in to comment.