diff options
author | Morgan Bazalgette <git@howl.moe> | 2018-02-27 08:09:18 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-02-27 09:09:18 +0200 |
commit | 535445c32ee730988033728b3b91c4d6f456e08c (patch) | |
tree | 34cd5b9807faf01018f47f74a34ed5b584df5158 /public/vendor | |
parent | 769ab1e4240f820efdb231832cb7957cb4902807 (diff) | |
download | gitea-535445c32ee730988033728b3b91c4d6f456e08c.tar.gz gitea-535445c32ee730988033728b3b91c4d6f456e08c.zip |
Rework special link parsing in the post-processing of markup (#3354)
* Get rid of autolink
* autolink in markdown
* Replace email addresses with mailto links
* better handling of links
* Remove autolink.js from footer
* Refactor entire html.go
* fix some bugs
* Make tests green, move what we can to html_internal_test, various other changes to processor logic
* Make markdown tests work again
This is just a description to allow me to force push in order to restart
the drone build.
* Fix failing markdown tests in routers/api/v1/misc
* Add license headers, log errors, future-proof <body>
* fix formatting
Diffstat (limited to 'public/vendor')
-rw-r--r-- | public/vendor/plugins/autolink/LICENSE | 21 | ||||
-rw-r--r-- | public/vendor/plugins/autolink/autolink.js | 45 |
2 files changed, 0 insertions, 66 deletions
diff --git a/public/vendor/plugins/autolink/LICENSE b/public/vendor/plugins/autolink/LICENSE deleted file mode 100644 index bb35e8b86d..0000000000 --- a/public/vendor/plugins/autolink/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 egoist 0x142857@gmail.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.
\ No newline at end of file diff --git a/public/vendor/plugins/autolink/autolink.js b/public/vendor/plugins/autolink/autolink.js deleted file mode 100644 index 2993954ab6..0000000000 --- a/public/vendor/plugins/autolink/autolink.js +++ /dev/null @@ -1,45 +0,0 @@ -(function () { - var re = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-]*)?\??(?:[\-\+:=&;%@\.\w]*)#?(?:[\.\!\/\\\w]*))?)/g; - function textNodesUnder(node) { - var textNodes = []; - if(typeof document.createTreeWalker === 'function') { - // Efficient TreeWalker - var currentNode, walker; - walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, null, false); - while(currentNode = walker.nextNode()) { - textNodes.push(currentNode); - } - } else { - // Less efficient recursive function - for(node = node.firstChild; node; node = node.nextSibling) { - if(node.nodeType === 3) { - textNodes.push(node); - } else { - textNodes = textNodes.concat(textNodesUnder(node)); - } - } - } - return textNodes; - } - - function processNode(node) { - re.lastIndex = 0; - var results = re.exec(node.textContent); - if(results !== null) { - if($(node).parents().filter('code').length === 0) { - $(node).replaceWith( - $('<span />').html( - node.nodeValue.replace(re, '<a href="$1">$1</a>') - ) - ); - } - } - } - - jQuery.fn.autolink = function () { - this.each(function () { - textNodesUnder(this).forEach(processNode); - }); - return this; - }; -})(); |