Skip to content

Commit

Permalink
misc: Use "scrape" instead of "parse".
Browse files Browse the repository at this point in the history
  • Loading branch information
vxern committed Mar 2, 2024
1 parent df77db5 commit fe3c191
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/tabs/synthesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function scrapeBranch<T extends TreeTypes, R extends Row.Row>(
options: ParserOptions,
): R | undefined {
const root = $($branch.children(Selectors.contentTabs.synthesis.body.row.element));
const row = Row.parse($, root, options);
const row = Row.scrape($, root, options);
if (row === undefined) {
return undefined;
}
Expand Down Expand Up @@ -248,7 +248,7 @@ function scrapeEtymology($: CheerioAPI, $body: Cheerio<Element>, options: Parser

const etymologies: Etymology[] = [];
for (const row of rows) {
const etymology = Row.parse($, $(row), options);
const etymology = Row.scrape($, $(row), options);
if (etymology === undefined) {
continue;
}
Expand Down
10 changes: 5 additions & 5 deletions src/tabs/synthesis/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ interface Contents extends WithMetadata<string> {}

export interface Row extends Contents {}

export function parse($: CheerioAPI, row: Cheerio<Element>, options: ParserOptions): Row | undefined {
const contents = getContents($, row, options);
export function scrape($: CheerioAPI, $row: Cheerio<Element>, options: ParserOptions): Row | undefined {
const contents = scrapeContents($, $row, options);
if (contents === undefined) {
return undefined;
}

return contents;
}

function getContents(
function scrapeContents(
$: CheerioAPI,
row: Cheerio<Element>,
$row: Cheerio<Element>,
{ excludeCopyrighted }: ParserOptions,
): Contents | undefined {
const section = row.children(Selectors.contentTabs.synthesis.body.row.contents.element);
const section = $row.children(Selectors.contentTabs.synthesis.body.row.contents.element);

const sources = section
.children(Selectors.contentTabs.synthesis.body.row.contents.sources)
Expand Down

0 comments on commit fe3c191

Please sign in to comment.