From 047b5984b6dd17266dc07c9b0ef4cee82f84e914 Mon Sep 17 00:00:00 2001 From: muji Date: Sat, 23 Apr 2016 13:20:21 +0800 Subject: [PATCH 1/4] Support _htmlBlockType for html_inline. Add support for the _htmlBlockType property on inline HTML elements; this allows AST consumers to be able to know ahead of time the type for inline HTML elements which is useful when parsing processing instructions or comments. Moved the reHtmlBlockOpen RegExp to the common module so that it may be shared between the inline and block parsers. --- lib/blocks.js | 11 +---------- lib/common.js | 12 ++++++++++++ lib/inlines.js | 11 +++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/blocks.js b/lib/blocks.js index a7f405f7..1a8419ab 100644 --- a/lib/blocks.js +++ b/lib/blocks.js @@ -16,16 +16,7 @@ var C_OPEN_BRACKET = 91; var InlineParser = require('./inlines'); -var reHtmlBlockOpen = [ - /./, // dummy for 0 - /^<(?:script|pre|style)(?:\s|>|$)/i, - /^|"; var PROCESSINGINSTRUCTION = "[<][?].*?[?][>]"; -var DECLARATION = "]*>"; +var DECLARATION = "]*>"; var CDATA = ""; var HTMLTAG = "(?:" + OPENTAG + "|" + CLOSETAG + "|" + HTMLCOMMENT + "|" + PROCESSINGINSTRUCTION + "|" + DECLARATION + "|" + CDATA + ")"; @@ -32,7 +32,7 @@ var reHtmlBlockOpen = [ /^<(?:script|pre|style)(?:\s|>|$)/i, /^