diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-01-25 11:50:29 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-01-25 11:50:29 -0600 |
commit | 6c2d8f357e141149f5b21153e540957ed48cbbab (patch) | |
tree | e5d9a23849a27a9ebab103bb67af9102ef63d7a0 | |
parent | 21755ac9e9e349c4291e6f64109abe0b4588436d (diff) | |
download | gitlab-ce-copy-as-md.tar.gz |
Statisfy eslintcopy-as-md
-rw-r--r-- | app/assets/javascripts/copy_as_gfm.js.es6 | 24 | ||||
-rw-r--r-- | app/assets/javascripts/shortcuts_issuable.js | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/app/assets/javascripts/copy_as_gfm.js.es6 b/app/assets/javascripts/copy_as_gfm.js.es6 index 554849feb6b..b94125a4210 100644 --- a/app/assets/javascripts/copy_as_gfm.js.es6 +++ b/app/assets/javascripts/copy_as_gfm.js.es6 @@ -3,7 +3,6 @@ /*= require lib/utils/common_utils */ - (() => { const gfmRules = { // The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert @@ -96,11 +95,11 @@ let lines = text.trim().split('\n'); // Add two spaces to the front of subsequent list items lines, // or leave the line entirely blank. - lines = lines.map((s) => { - s = s.trim(); - if (s.length === 0) return ''; + lines = lines.map((l) => { + const line = l.trim(); + if (line.length === 0) return ''; - return ` ${s}`; + return ` ${line}`; }); return `<dl>\n${lines.join('\n')}\n</dl>`; @@ -111,20 +110,21 @@ }, }, SyntaxHighlightFilter: { - 'pre.code.highlight'(el, text) { + 'pre.code.highlight'(el, t) { + const text = t.trim(); + let lang = el.getAttribute('lang'); if (lang === 'plaintext') { lang = ''; } - text = text.trim(); - // Prefixes lines with 4 spaces if the code contains triple backticks + // Prefixes lines with 4 spaces if the code contains triple backticks if (lang === '' && text.match(/^```/gm)) { - return text.split('\n').map((s) => { - s = s.trim(); - if (s.length === 0) return ''; + return text.split('\n').map((l) => { + const line = l.trim(); + if (line.length === 0) return ''; - return ` ${s}`; + return ` ${line}`; }).join('\n'); } diff --git a/app/assets/javascripts/shortcuts_issuable.js b/app/assets/javascripts/shortcuts_issuable.js index 28491934c10..4ef516af8c8 100644 --- a/app/assets/javascripts/shortcuts_issuable.js +++ b/app/assets/javascripts/shortcuts_issuable.js @@ -61,7 +61,7 @@ replyField.val(function(_, current) { return current + separator + quote.join('') + "\n"; }); - + // Trigger autosave replyField.trigger('input'); |