From 664ef45637a2a5d21783924dfbff2c5556d134a1 Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Tue, 30 May 2017 16:48:10 -0500 Subject: [PATCH] Parser: Revert to PEG parser by default Fixes several small issues created with the TinyMCE parser. Focuses efforts on building a declarative formal grammar to handle our parsing needs. --- blocks/api/parser.js | 2 +- blocks/api/post.pegjs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/blocks/api/parser.js b/blocks/api/parser.js index 4bda5ecf86efbe..462ae2fe670015 100644 --- a/blocks/api/parser.js +++ b/blocks/api/parser.js @@ -232,4 +232,4 @@ export function parseWithGrammar( content ) { }, [] ); } -export default parseWithTinyMCE; +export default parseWithGrammar; diff --git a/blocks/api/post.pegjs b/blocks/api/post.pegjs index 1c7f9b56d6a6c2..d09e122bfb5bf4 100644 --- a/blocks/api/post.pegjs +++ b/blocks/api/post.pegjs @@ -39,7 +39,7 @@ WP_Block_End } } WP_Block_Type - = $(ASCII_Letter WP_Block_Type_Char*) + = $(ASCII_Letter (ASCII_AlphaNumeric / "/" ASCII_AlphaNumeric)*) HTML_Attribute_List = as:(_+ a:HTML_Attribute_Item { return a })* @@ -74,10 +74,6 @@ HTML_Attribute_Quoted HTML_Attribute_Name = $([a-zA-Z0-9:.]+) -WP_Block_Type_Char - = ASCII_AlphaNumeric - / [\/] - ASCII_AlphaNumeric = ASCII_Letter / ASCII_Digit