App.Encyclopedia.Dialog = (function() {
	/** Create a link to an encyclopedia dialog for a given article with the given text
	 * @param {string} text Text for link
	 * @param {string} article Encyclopdia article to link to
	 * @returns {string} SugarCube link markup
	 */
	function makeLinkSC(text, article) {
		return App.UI.link(text, () => showArticleInDialog(article));
	}

	/** Create a link to an encyclopedia dialog for a given article with the given text
	 * @param {string} text Text for link
	 * @param {string} article Encyclopdia article to link to
	 * @returns {HTMLElement} DOM link element
	 */
	function makeLinkDOM(text, article) {
		return App.UI.DOM.link(text, () => showArticleInDialog(article));
	}

	/** Show a given encyclopedia article in the encyclopedia dialog
	 * @param {string} article
	 */
	function showArticleInDialog(article) {
		let origEncyclopedia = V.encyclopedia;
		if (Dialog.isOpen()) {
			Dialog.close();
		}
		Dialog.setup("Encyclopedia", "encyclopedia");
		V.encyclopedia = article;
		$(Dialog.body()).empty().wiki(jsInclude("Encyclopedia"));
		Dialog.open();
		V.encyclopedia = origEncyclopedia;
	}

	return {
		linkSC: makeLinkSC,
		linkDOM: makeLinkDOM
	};
})();

src/gui/Encyclopedia/encyclopediaDialog.js