Skip to content

Commit ea7719d

Browse files
author
Martin Brecht-Precht
committed
Handle the title attribute optional
1 parent 3891e4b commit ea7719d

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require": {
2626
"php": ">=5.3",
27-
"markdom/handler-interface": "^1.0.4",
27+
"markdom/handler-interface": "^1.0.5",
2828
"markenwerk/stack-util": "~1.0",
2929
"markenwerk/string-builder": "~1.0",
3030
"markenwerk/json-pretty-printer": "~1.0"

src/Dispatcher/PhpObjectDispatcher.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ private function processContents(array $contents)
175175
$this->eventDispatcher->onLineBreakContent($node->hard);
176176
break;
177177
case KeyNameTranslator::TYPE_LINK:
178-
$this->eventDispatcher->onLinkContentBegin($node->uri, $node->title);
178+
$title = isset($node->title) ? $node->title : null;
179+
$this->eventDispatcher->onLinkContentBegin($node->uri, $title);
179180
$this->processContents($node->contents);
180181
$this->eventDispatcher->onLinkContentEnd();
181182
break;

src/Handler/PhpObjectHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public function onLineBreakContent($hard)
385385
* @param string $title
386386
* @return void
387387
*/
388-
public function onLinkContentBegin($uri, $title)
388+
public function onLinkContentBegin($uri, $title = null)
389389
{
390390
$link = (object)array(
391391
KeyNameTranslator::ATTRIBUTE_COMMON_TYPE => KeyNameTranslator::TYPE_LINK,
@@ -403,7 +403,7 @@ public function onLinkContentBegin($uri, $title)
403403
* @param string $title
404404
* @return void
405405
*/
406-
public function onLinkContentEnd($uri, $title)
406+
public function onLinkContentEnd($uri, $title = null)
407407
{
408408
$this->contentParents->pop();
409409
}

src/Handler/XmlHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public function onLineBreakContent($hard)
420420
* @param string $title
421421
* @return void
422422
*/
423-
public function onLinkContentBegin($uri, $title)
423+
public function onLinkContentBegin($uri, $title = null)
424424
{
425425
$linkNode = $this->document->createElement(KeyNameTranslator::TYPE_LINK);
426426
$uriAttribute = $this->document->createAttribute(KeyNameTranslator::ATTRIBUTE_LINK_URI);
@@ -440,7 +440,7 @@ public function onLinkContentBegin($uri, $title)
440440
* @param string $title
441441
* @return void
442442
*/
443-
public function onLinkContentEnd($uri, $title)
443+
public function onLinkContentEnd($uri, $title = null)
444444
{
445445
$this->contentParents->pop();
446446
}

0 commit comments

Comments
 (0)