-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24ff306
commit f4c086a
Showing
7 changed files
with
80 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"osrs-web-scraper": patch | ||
--- | ||
|
||
Update @osrs-wiki/mediawiki-builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"osrs-web-scraper": patch | ||
--- | ||
|
||
Update table node parser to support new mediawiki-builder table format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/scrapers/news/sections/newsContent/nodes/__tests__/__snapshots__/table.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`table node A basic table should render 1`] = ` | ||
"{| style=\\"text-align: center;\\" class=\\"wikitable\\" | ||
|- | ||
! test | ||
! test | ||
|- | ||
| test | ||
| test | ||
|}" | ||
`; |
15 changes: 15 additions & 0 deletions
15
src/scrapers/news/sections/newsContent/nodes/__tests__/table.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { MediaWikiBuilder } from "@osrs-wiki/mediawiki-builder"; | ||
import parse from "node-html-parser"; | ||
|
||
import tableParser from "../table"; | ||
|
||
describe("table node", () => { | ||
test("A basic table should render", () => { | ||
const root = parse( | ||
"<table><tbody><tr><td>test</td><td>test</td></tr><tr><td>test</td><td>test</td></tr></tbody></table>" | ||
); | ||
const builder = new MediaWikiBuilder(); | ||
builder.addContents([tableParser(root.firstChild)].flat()); | ||
expect(builder.build()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters