From cb05eeb16b684ae800d38be566349e817434eccb Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Sat, 29 Aug 2020 23:54:16 +0200 Subject: [PATCH] remove unused htag macro --- src/js/hTagMacroJS.js | 44 ------------------------------------------- src/js/utilsSC.js | 29 ---------------------------- 2 files changed, 73 deletions(-) delete mode 100644 src/js/hTagMacroJS.js diff --git a/src/js/hTagMacroJS.js b/src/js/hTagMacroJS.js deleted file mode 100644 index 0862ab25086..00000000000 --- a/src/js/hTagMacroJS.js +++ /dev/null @@ -1,44 +0,0 @@ - -/* -* <<htag>> macro -* A simple macro which allows to create wrapping html elements with dynamic IDs. -* idea blatantly robbed from the spanMacroJS.tw but expanded to a more generic -* case, allowing <div>, <button> or whatever you want. elements, default is for -* the div though. In addition, you can pass an object in as the first argument -* instead of an id, and each of the object's attributes will become attributes -* of the generate tag. -* -* Usage: <<htag id>>...<</htag>> -* Usage: <<htag id tag>>...<</htag>> -* Usage: <<htag attributes>>...<</htag>> -* Usage: <<htag attributes tag>>...<</htag>> -*/ -Macro.add('htag', { - tags: null, - handler() { - const payload = this.payload[0].contents.replace(/(^\n+|\n+$)/, ''); - let htag = 'div'; - let attributes; - - function munge(val, key) { - return `${key}="${val}"`; - } - - if (this.args.length === 0) { return this.error('invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>'); } - if (this.args.length > 1) { htag = String(this.args[1]).trim(); } - if (typeof this.args[0] === "object") { - attributes = $.map(this.args[0], munge).join(" "); - } else { - attributes = `id="${String(this.args[0]).trim()}"`; - } - if (Config.debug) { - this.debugView.modes({ - block: true - }); - } - - jQuery(`<${htag} ${attributes} />`) - .wiki(payload) - .appendTo(this.output); - } -}); diff --git a/src/js/utilsSC.js b/src/js/utilsSC.js index 50d0a12b444..b796c63e8d2 100644 --- a/src/js/utilsSC.js +++ b/src/js/utilsSC.js @@ -114,35 +114,6 @@ App.UI.replace = function(selector, newContent) { target.append(ins); }; -/** - * A simple macro which allows to create wrapping html elements with dynamic IDs. - * - * idea blatantly robbed from the spanMacroJS.tw but expanded to a more generic case, allowing <div>, - * <button> or whatever you want elements, default is for the div though. - * In addition, you can pass an object in as the first argument instead of an id, and each of the - * object's attributes will become attributes of the generate tag. - * - * @example - * htag('test', "red") // <div id="red">test</div> - * htag('test', {class: red}); // <div class="red">test</div> - * htag('test', {class: red, id: green}); // <div class="red" id="green">test</div> - * @param {string} text - * @param {string|object} attributes - * @param {string} [tag='div'] (optional) - * @returns {string} - */ -App.UI.htag = function(text, attributes, tag = 'div') { - const payload = text.replace(/(^\n+|\n+$)/, ""); - - if (typeof attributes === "object") { - attributes = $.map(attributes, (val, key) => `${key}="${val}"`).join(" "); - } else { - attributes = `id="${attributes.trim()}"`; - } - - return `<${tag} ${attributes}>${payload}</${tag}>`; -}; - App.UI.tabBar = function() { return { openTab: openTab, -- GitLab