From 3f82b43baa5f4e28a2db700c195644a15ac69a9b Mon Sep 17 00:00:00 2001 From: Anna Dabrowska Date: Wed, 1 Nov 2023 08:48:33 +0100 Subject: [PATCH] Remove HTML and PHP nodes: no longer supported since Jack Jackrum --- _test/json/html_block.json | 35 ---------------------- _test/json/html_block.txt | 7 ----- _test/json/html_inline.json | 30 ------------------- _test/json/html_inline.txt | 1 - _test/json/php_block.json | 35 ---------------------- _test/json/php_block.txt | 9 ------ _test/json/php_inline.json | 30 ------------------- _test/json/php_inline.txt | 1 - _test/renderer.test.php | 1 - parser/HtmlPhpNode.php | 48 ------------------------------ parser/Node.php | 4 --- script/schema.js | 58 ------------------------------------- 12 files changed, 259 deletions(-) delete mode 100644 _test/json/html_block.json delete mode 100644 _test/json/html_block.txt delete mode 100644 _test/json/html_inline.json delete mode 100644 _test/json/html_inline.txt delete mode 100644 _test/json/php_block.json delete mode 100644 _test/json/php_block.txt delete mode 100644 _test/json/php_inline.json delete mode 100644 _test/json/php_inline.txt delete mode 100644 parser/HtmlPhpNode.php diff --git a/_test/json/html_block.json b/_test/json/html_block.json deleted file mode 100644 index dddac8c9..00000000 --- a/_test/json/html_block.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Foo" - } - ] - }, - { - "type": "html_block", - "content": [ - { - "type": "text", - "text": "

And this is some block HTML<\/p>" - } - ], - "attrs": { - "class": "html_block" - } - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Bar" - } - ] - } - ] -} diff --git a/_test/json/html_block.txt b/_test/json/html_block.txt deleted file mode 100644 index 1e266609..00000000 --- a/_test/json/html_block.txt +++ /dev/null @@ -1,7 +0,0 @@ -Foo - - -

And this is some block HTML

- - -Bar diff --git a/_test/json/html_inline.json b/_test/json/html_inline.json deleted file mode 100644 index af575a87..00000000 --- a/_test/json/html_inline.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Foo " - }, - { - "type": "html_inline", - "content": [ - { - "type": "text", - "text": "This is some inline HTML<\/span>" - } - ], - "attrs": { - "class": "html_inline" - } - }, - { - "type": "text", - "text": " Bar" - } - ] - } - ] -} diff --git a/_test/json/html_inline.txt b/_test/json/html_inline.txt deleted file mode 100644 index 4357ccef..00000000 --- a/_test/json/html_inline.txt +++ /dev/null @@ -1 +0,0 @@ -Foo This is some inline HTML Bar diff --git a/_test/json/php_block.json b/_test/json/php_block.json deleted file mode 100644 index acf07452..00000000 --- a/_test/json/php_block.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Foo" - } - ] - }, - { - "type": "php_block", - "content": [ - { - "type": "text", - "text": "echo '
The same, but inside a block level element:<\/td>';\necho ''.phpversion().'<\/td>';\necho '<\/tr><\/table>';" - } - ], - "attrs": { - "class": "php_block" - } - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Bar" - } - ] - } - ] -} diff --git a/_test/json/php_block.txt b/_test/json/php_block.txt deleted file mode 100644 index 629a6325..00000000 --- a/_test/json/php_block.txt +++ /dev/null @@ -1,9 +0,0 @@ -Foo - - -echo ''; -echo ''; -echo '
The same, but inside a block level element:'.phpversion().'
'; -
- -Bar diff --git a/_test/json/php_inline.json b/_test/json/php_inline.json deleted file mode 100644 index 77a3f402..00000000 --- a/_test/json/php_inline.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "type": "doc", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Foo " - }, - { - "type": "php_inline", - "content": [ - { - "type": "text", - "text": " echo 'The PHP version: '; echo phpversion(); echo ' (generated inline HTML)'; " - } - ], - "attrs": { - "class": "php_inline" - } - }, - { - "type": "text", - "text": " Bar" - } - ] - } - ] -} diff --git a/_test/json/php_inline.txt b/_test/json/php_inline.txt deleted file mode 100644 index 0067527e..00000000 --- a/_test/json/php_inline.txt +++ /dev/null @@ -1 +0,0 @@ -Foo echo 'The PHP version: '; echo phpversion(); echo ' (generated inline HTML)'; Bar diff --git a/_test/renderer.test.php b/_test/renderer.test.php index 8d8a0178..435c0b79 100644 --- a/_test/renderer.test.php +++ b/_test/renderer.test.php @@ -23,7 +23,6 @@ public function test_renderer($dokuwikiMarkup, $expectedJSON, $msg) global $ID; $ID = 'wiki:syntax'; $instructions = p_get_instructions($dokuwikiMarkup); -// print_r($instructions); $doc = p_render('prosemirror', $instructions, $info); $this->assertJsonStringEqualsJsonString($expectedJSON, $doc, $msg); } diff --git a/parser/HtmlPhpNode.php b/parser/HtmlPhpNode.php deleted file mode 100644 index 3d4e1ab7..00000000 --- a/parser/HtmlPhpNode.php +++ /dev/null @@ -1,48 +0,0 @@ -parent = &$parent; - $this->data = $data; - } - - public function toSyntax() - { - switch ($this->data['type']) { - case 'html_inline': - { - $tagname = 'html'; - $blockLinebreak = ''; - break; - } - case 'html_block': - { - $tagname = 'HTML'; - $blockLinebreak = "\n"; - break; - } - case 'php_inline': - { - $tagname = 'php'; - $blockLinebreak = ''; - break; - } - case 'php_block': - { - $tagname = 'PHP'; - $blockLinebreak = "\n"; - break; - } - } - - return "<$tagname>$blockLinebreak" . $this->data['content'][0]['text'] . "$blockLinebreak"; - } -} diff --git a/parser/Node.php b/parser/Node.php index a5bfd986..9d4aed42 100644 --- a/parser/Node.php +++ b/parser/Node.php @@ -16,10 +16,6 @@ abstract class Node implements NodeInterface 'heading' => HeadingNode::class, 'preformatted' => PreformattedNode::class, 'code_block' => CodeBlockNode::class, - 'html_inline' => HtmlPhpNode::class, - 'html_block' => HtmlPhpNode::class, - 'php_inline' => HtmlPhpNode::class, - 'php_block' => HtmlPhpNode::class, 'blockquote' => QuoteNode::class, 'image' => ImageNode::class, 'hard_break' => HardBreakNode::class, diff --git a/script/schema.js b/script/schema.js index 317ea807..90de308c 100644 --- a/script/schema.js +++ b/script/schema.js @@ -85,64 +85,6 @@ export default function getSpec() { codeBlock.group = 'protected_block'; nodes = nodes.update('code_block', codeBlock); - nodes = nodes.addToEnd('html_block', { - content: 'text*', - marks: '', - group: 'protected_block', - attrs: { - class: { default: 'html_block' }, - }, - code: true, - defining: true, - toDOM(node) { - return ['pre', node.attrs, 0]; - }, - }); - - nodes = nodes.addToEnd('html_inline', { - content: 'text*', - marks: '', - group: 'inline', - attrs: { - class: { default: 'html_inline' }, - }, - inline: true, - code: true, - defining: true, - toDOM(node) { - return ['code', node.attrs, 0]; - }, - }); - - nodes = nodes.addToEnd('php_block', { - content: 'text*', - marks: '', - group: 'protected_block', - attrs: { - class: { default: 'php_block' }, - }, - code: true, - defining: true, - toDOM(node) { - return ['pre', node.attrs, 0]; - }, - }); - - nodes = nodes.addToEnd('php_inline', { - content: 'text*', - marks: '', - group: 'inline', - attrs: { - class: { default: 'php_inline' }, - }, - inline: true, - code: true, - defining: true, - toDOM(node) { - return ['code', node.attrs, 0]; - }, - }); - const quote = nodes.get('blockquote'); quote.content = '(block | blockquote | protected_block)+'; quote.group = 'container';