diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-01-31 16:23:54 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-01-31 16:24:14 -0400 |
| commit | 6c32e484a4ad6be5690c1083b9131d0338e3c5b9 (patch) | |
| tree | a178068848f792f7fb92854c0437ba4d23b4ab7c /src | |
| parent | 35835ba646b83ccf8d2c698fea31ece32269f5c4 (diff) | |
wiki-data: drop various parsing exports
Diffstat (limited to 'src')
| -rw-r--r-- | src/common-util/wiki-data.js | 15 | ||||
| -rw-r--r-- | src/data/things/Language.js | 3 | ||||
| -rw-r--r-- | src/data/yaml.js | 7 |
3 files changed, 6 insertions, 19 deletions
diff --git a/src/common-util/wiki-data.js b/src/common-util/wiki-data.js index 42bbc939..36392fcb 100644 --- a/src/common-util/wiki-data.js +++ b/src/common-util/wiki-data.js @@ -104,19 +104,8 @@ const dateRegex = groupName => const commentaryRegexRaw = String.raw`^<i>(?<artistText>.+?):<\/i>(?: \((?<annotation>(?:.*?(?=,|\)[^)]*$))*?)(?:,? ?(?:(?<dateKind>sometime|throughout|around) )?${dateRegex('date')}(?: ?- ?${dateRegex('secondDate')})?(?: (?<accessKind>captured|accessed) ${dateRegex('accessDate')})?)?\))?`; -export const commentaryRegexCaseInsensitive = - new RegExp(commentaryRegexRaw, 'gmi'); -export const commentaryRegexCaseSensitive = +const commentaryRegex = new RegExp(commentaryRegexRaw, 'gm'); -export const commentaryRegexCaseSensitiveOneShot = - new RegExp(commentaryRegexRaw); - -export const languageOptionRegex = /{(?<name>[A-Z0-9_]+)}/g; - -// The #validators function isOldStyleLyrics() describes -// what this regular expression detects against. -export const multipleLyricsDetectionRegex = - /^<i>.*:<\/i>/m; export function matchContentEntries(sourceText) { const matchEntries = []; @@ -130,7 +119,7 @@ export function matchContentEntries(sourceText) { .replace(/\n*$/, ''); for (const {0: matchText, index: startIndex, groups: matchEntry} - of sourceText.matchAll(commentaryRegexCaseSensitive)) { + of sourceText.matchAll(commentaryRegex)) { if (previousMatchEntry) { previousMatchEntry.body = trimBody(sourceText.slice(previousEndIndex, startIndex)); diff --git a/src/data/things/Language.js b/src/data/things/Language.js index 7f3f43de..48ba0659 100644 --- a/src/data/things/Language.js +++ b/src/data/things/Language.js @@ -7,7 +7,6 @@ import * as html from '#html'; import {accumulateSum, empty, withEntries} from '#sugar'; import {isLanguageCode, isObject} from '#validators'; import Thing from '#thing'; -import {languageOptionRegex} from '#wiki-data'; import { externalLinkSpec, @@ -21,6 +20,8 @@ import {exitWithoutDependency, exposeConstant} from '#composite/control-flow'; import {flag, name} from '#composite/wiki-properties'; +const languageOptionRegex = /{(?<name>[A-Z0-9_]+)}/g; + export class Language extends Thing { static [Thing.getPropertyDescriptors] = () => ({ // Update & expose diff --git a/src/data/yaml.js b/src/data/yaml.js index 2afaffb5..0a7fce93 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -13,7 +13,7 @@ import {parseContentNodes, splitContentNodesAround} from '#replacer'; import {sortByName} from '#sort'; import Thing from '#thing'; import thingConstructors from '#things'; -import {matchContentEntries, multipleLyricsDetectionRegex} from '#wiki-data'; +import {matchContentEntries} from '#wiki-data'; import { aggregateThrows, @@ -1055,10 +1055,7 @@ export function parseReferencingSources(value, {subdoc, ReferencingSourcesEntry} } export function parseLyrics(value, {subdoc, LyricsEntry}) { - if ( - typeof value === 'string' && - !multipleLyricsDetectionRegex.test(value) - ) { + if (typeof value === 'string' && !/^<i>.*:<\/i>/m.test(value)) { const document = {'Body': value}; return [subdoc(LyricsEntry, document, {bindInto: 'thing'})]; |