mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Default value is intrinsic to a configurable, we can just always
retrieve that.
This commit is contained in:
@@ -78,7 +78,7 @@ final class Comment implements ContinuableBlock
|
||||
return new Handler(
|
||||
/** @return Text|RawHtml */
|
||||
function (State $State) {
|
||||
if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
|
||||
if ($State->get(SafeMode::class)->isEnabled()) {
|
||||
return new Text($this->html);
|
||||
} else {
|
||||
return new RawHtml($this->html);
|
||||
|
||||
@@ -58,10 +58,8 @@ final class Header implements Block
|
||||
|
||||
$text = \ltrim($Context->line()->text(), '#');
|
||||
|
||||
$StrictMode = $State->getOrDefault(StrictMode::class);
|
||||
|
||||
if (
|
||||
$StrictMode->isEnabled() && isset($text[0])
|
||||
$State->get(StrictMode::class)->isEnabled() && isset($text[0])
|
||||
and $text[0] !== ' ' and $text[0] !== "\t"
|
||||
) {
|
||||
return null;
|
||||
|
||||
@@ -76,9 +76,7 @@ final class Markup implements ContinuableBlock
|
||||
return new Handler(
|
||||
/** @return Element|RawHtml */
|
||||
function (State $State) {
|
||||
$SafeMode = $State->getOrDefault(SafeMode::class);
|
||||
|
||||
if ($SafeMode->isEnabled()) {
|
||||
if ($State->get(SafeMode::class)->isEnabled()) {
|
||||
return new Element('p', [], [new Text($this->html)]);
|
||||
} else {
|
||||
return new RawHtml($this->html);
|
||||
|
||||
@@ -51,7 +51,7 @@ final class Reference implements StateUpdatingBlock
|
||||
];
|
||||
|
||||
$State = $State->setting(
|
||||
$State->getOrDefault(DefinitionBook::class)->setting($id, $Data)
|
||||
$State->get(DefinitionBook::class)->setting($id, $Data)
|
||||
);
|
||||
|
||||
return new self($State);
|
||||
|
||||
@@ -83,7 +83,7 @@ final class Image implements Inline
|
||||
$attributes['title'] = $title;
|
||||
}
|
||||
|
||||
if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
|
||||
if ($State->get(SafeMode::class)->isEnabled()) {
|
||||
$attributes['src'] = Element::filterUnsafeUrl($attributes['src']);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ final class Link implements Inline
|
||||
$definition = \strtolower($label);
|
||||
}
|
||||
|
||||
$data = $State->getOrDefault(DefinitionBook::class)->lookup($definition);
|
||||
$data = $State->get(DefinitionBook::class)->lookup($definition);
|
||||
|
||||
if (! isset($data)) {
|
||||
return null;
|
||||
@@ -122,7 +122,7 @@ final class Link implements Inline
|
||||
$attributes['title'] = $this->title;
|
||||
}
|
||||
|
||||
if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
|
||||
if ($State->get(SafeMode::class)->isEnabled()) {
|
||||
$attributes['href'] = Element::filterUnsafeUrl($attributes['href']);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,9 +64,7 @@ final class Markup implements Inline
|
||||
return new Handler(
|
||||
/** @return Text|RawHtml */
|
||||
function (State $State) {
|
||||
$SafeMode = $State->getOrDefault(SafeMode::class);
|
||||
|
||||
if ($SafeMode->isEnabled()) {
|
||||
if ($State->get(SafeMode::class)->isEnabled()) {
|
||||
return new Text($this->html);
|
||||
} else {
|
||||
return new RawHtml($this->html);
|
||||
|
||||
Reference in New Issue
Block a user