-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated converter to remove HTML comments.
- Loading branch information
1 parent
6bf1cfc
commit 7d9dc74
Showing
1 changed file
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
<meta charset="UTF-8"> | ||
<title>HTML to Aris</title> | ||
<title>HTML to Aris Converter</title> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script> | ||
|
@@ -21,13 +21,17 @@ | |
var isArray = isT('Array'); | ||
|
||
self.htmlToCtx = function (html) { | ||
|
||
var tagRe = /<(\/)?([^\s<>"'`=]+)((\s+[^\s<>"'`=]+(\s*=\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^'">\s]+))?)+\s*|\s*)(\/)?>/g; | ||
var attrRe = /([^\s<>"'`=]+)(\s*=\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^'">\s]+))?/g; | ||
var voidsRe = /area|base|br|col|command|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr/; | ||
var stripWsRe = /^\s*|\s*$|([\s])+/g; | ||
|
||
var m, root = [''], stack = {c: root}, last = 0, d, tag, k, v; | ||
|
||
// remove comments | ||
html = html.replace(/("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|`[^`\\]*(?:\\.[^`\\]*)*`)|(<!--[\S\s]*?-->)/g, '$1'); | ||
|
||
while (m = tagRe.exec(html)) { | ||
if (!stack) | ||
stack = {c: root}; | ||
|