From a3d93c6f12f3ecdf96951355f5fe454b8659a2b2 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Sun, 20 Dec 2020 09:58:23 +0100
Subject: [PATCH] Add pure DOM passage

---
 src/004-base/domPassage.js | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 src/004-base/domPassage.js

diff --git a/src/004-base/domPassage.js b/src/004-base/domPassage.js
new file mode 100644
index 00000000000..441a8a87ef7
--- /dev/null
+++ b/src/004-base/domPassage.js
@@ -0,0 +1,26 @@
+/**
+ * A pure DOM Passage, the SugarCube Wikifier never gets invoked.
+ */
+App.DomPassage = class extends Passage {
+	/**
+	 * @param {string} title
+	 * @param {function():DocumentFragment|function():HTMLElement} callback
+	 * @param {string[]} tags
+	 */
+	constructor(title, callback, tags = []) {
+		super(title, {
+			hasAttribute: a => a === "tags",
+			getAttribute: () => tags.join(" ")
+		});
+		this.callback = callback;
+
+		Story.add(this);
+	}
+
+	/**
+	 * @returns {DocumentFragment|HTMLElement}
+	 */
+	render() {
+		return this.callback();
+	}
+};
-- 
GitLab