right.js

import { Code } from "@thoughtsunificator/bbcode-parser-template"

/**
 * @global
 */
class RightCode extends Code {

	/**
		* @readonly
		* @type {string}
		*/
	static tagName = "right"

	/**
		* @param {Node} node
		* @returns {boolean}
		*/
	static testNode(node) {
		return node.nodeName === "DIV" && node.getAttribute("align") === "right"
	}

	/**
		* @param {Conversion} conversion
		* @returns {BBNode}
		*/
	static createBBNode(conversion) {
		const bbNode = conversion.bbDocument.createElement("right")
		return bbNode
	}

	/**
		* @param {Conversion} conversion
		* @returns {Node}
		*/
	static createNode(conversion) {
		const node = conversion.document.createElement("div")
		node.align = "right"
		return node
	}

}

export default RightCode