mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1013 B
33 lines
1013 B
/**
|
|
* @author Titus Wormer
|
|
* @copyright 2015 Titus Wormer
|
|
* @license MIT
|
|
* @module remark:parse:util:html
|
|
* @fileoverview HTML regexes.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
|
|
var unquoted = '[^"\'=<>`\\u0000-\\u0020]+';
|
|
var singleQuoted = '\'[^\']*\'';
|
|
var doubleQuoted = '"[^"]*"';
|
|
var attributeValue = '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')';
|
|
var attribute = '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)';
|
|
var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
|
|
var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
|
|
var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
|
|
var processing = '<[?].*?[?]>';
|
|
var declaration = '<![A-Za-z]+\\s+[^>]*>';
|
|
var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
|
|
|
|
exports.openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')');
|
|
|
|
exports.tag = new RegExp('^(?:' +
|
|
openTag + '|' +
|
|
closeTag + '|' +
|
|
comment + '|' +
|
|
processing + '|' +
|
|
declaration + '|' +
|
|
cdata +
|
|
')');
|
|
|