Skip to content

Commit

Permalink
Move footnotes to end of content for wanderertl130.id
Browse files Browse the repository at this point in the history
See: #1166
  • Loading branch information
dteviot committed Jan 16, 2024
1 parent a9bdd6f commit 48b318b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugin/js/parsers/WordpressBaseParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ parserFactory.register("rainingtl.org", function() { return new WordpressBasePar
parserFactory.register("raisingthedead.ninja", function() { return new WordpressBaseParser() });
parserFactory.register("skythewoodtl.com", function() { return new WordpressBaseParser() });
parserFactory.register("yoraikun.wordpress.com", function() { return new WordpressBaseParser() });
parserFactory.register("wanderertl130.id", function() { return new Wanderertl130Parser() });

parserFactory.registerRule(
// return probability (0.0 to 1.0) web page is a Wordpress page
Expand Down Expand Up @@ -46,8 +47,7 @@ class WordpressBaseParser extends Parser {

// find the node(s) holding the story content
findContent(dom) {
let content = WordpressBaseParser.findContentElement(dom);
return content;
return WordpressBaseParser.findContentElement(dom);
}

findParentNodeOfChapterLinkToRemoveAt(link) {
Expand All @@ -68,3 +68,15 @@ class WordpressBaseParser extends Parser {
return WordpressBaseParser.findChapterTitleElement(dom);
}
}

class Wanderertl130Parser extends WordpressBaseParser {
constructor() {
super();
}

preprocessRawDom(webPageDom) {
let content = this.findContent(webPageDom);
let footnotes = [...webPageDom.querySelectorAll("span.modern-footnotes-footnote__note")];
this.moveFootnotes(webPageDom, content, footnotes);
}
}

0 comments on commit 48b318b

Please sign in to comment.