Skip to content

Commit 28533c2

Browse files
committed
small fixups
1 parent b4c11a1 commit 28533c2

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Lexer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class Lexer
103103
* @var array The listeners in a flat array
104104
*/
105105
protected $listenerNames;
106+
106107
/**
107108
* @var array The listeners grouped by type and priority.
108109
*/

src/Line.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,19 @@ public function __construct($index, $input, array $attributes, Lexer $lexer, $ha
113113
$this->hasNewline = $hasNewline;
114114
}
115115

116+
/**
117+
* Whether the current line used to have attributes, which are stripped, thus turning it into a text-only insert
118+
*
119+
* @return bool
120+
*/
116121
public function isTextOnly()
117122
{
118123
return $this->textOnly;
119124
}
120125

126+
/**
127+
* Setter method to mark the line as text-only - after stripping the unknown attributes off of it
128+
*/
121129
public function setAsTextOnly()
122130
{
123131
$this->textOnly = true;

tests/ParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ParserTest extends TestCase
3434
'<h1>Head<strong>ing</strong></h1>' => '[{"insert":"Head"},{"attributes":{"bold":true},"insert":"ing"},{"attributes":{"header":1},"insert":"\n"}]',
3535
'<blockquote>Wichtig <strong>Fett</strong></blockquote>' => '[{"insert":"Wichtig "},{"attributes":{"bold":true},"insert":"Fett"},{"attributes":{"blockquote":true},"insert":"\n"}]',
3636
'<blockquote>Quote</blockquote>' => '[{"insert":"Quote"},{"attributes":{"blockquote":true},"insert":"\n"}]',
37-
'<h1>Header 1</h1>' => '[{"insert":"Header 1"},{"attributes":{"header":1},"insert":"\n"}]',
37+
'<h1>Heading 1</h1>' => '[{"insert":"Heading 1"},{"attributes":{"header":1},"insert":"\n"}]',
3838
'<h1>Hello</h1><p><br></p><p>This is the php quill <strong>parser</strong>!</p>' => '[{"insert":"Hello"},{"attributes":{"header":1},"insert":"\n"},{"insert":"\nThis is the php quill "},{"attributes":{"bold":true},"insert":"parser"},{"insert":"!\n"}]',
3939
'<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" src="https://www.youtube.com/embed/Ybq878PMe_U?showinfo=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>' => '[{"insert":{"video":"https://www.youtube.com/embed/Ybq878PMe_U?showinfo=0"}}]',
4040
'<p><img src="https://example.com/image.jpg" alt="" class="img-responsive img-fluid" />text</p>' => '[{"insert": {"image": "https://example.com/image.jpg"}},{"insert": "text\n"}]',

0 commit comments

Comments
 (0)