simplify constructor

This commit is contained in:
Dennis Eichhorn 2023-11-10 04:30:02 +00:00
parent 7b90d4eb54
commit 36b7143829

View File

@ -423,22 +423,19 @@ class Markdown
$this->options['toc'] = $this->options['toc'] ?? false; $this->options['toc'] = $this->options['toc'] ?? false;
// Marks // Marks
$state = $this->options['mark'] ?? true; if ($this->options['mark'] ?? true) {
if ($state !== false) {
$this->inlineTypes['='][] = 'mark'; $this->inlineTypes['='][] = 'mark';
$this->inlineMarkerList .= '='; $this->inlineMarkerList .= '=';
} }
// Keystrokes // Keystrokes
$state = $this->options['keystrokes'] ?? true; if ($this->options['keystrokes'] ?? true) {
if ($state !== false) {
$this->inlineTypes['['][] = 'Keystrokes'; $this->inlineTypes['['][] = 'Keystrokes';
$this->inlineMarkerList .= '['; $this->inlineMarkerList .= '[';
} }
// Inline Math // Inline Math
$state = $this->options['math'] ?? false; if ($this->options['math'] ?? false) {
if ($state !== false) {
$this->inlineTypes['\\'][] = 'Math'; $this->inlineTypes['\\'][] = 'Math';
$this->inlineMarkerList .= '\\'; $this->inlineMarkerList .= '\\';
$this->inlineTypes['$'][] = 'Math'; $this->inlineTypes['$'][] = 'Math';
@ -446,28 +443,24 @@ class Markdown
} }
// Superscript // Superscript
$state = $this->options['sup'] ?? false; if ($this->options['sup'] ?? false) {
if ($state !== false) {
$this->inlineTypes['^'][] = 'Superscript'; $this->inlineTypes['^'][] = 'Superscript';
$this->inlineMarkerList .= '^'; $this->inlineMarkerList .= '^';
} }
// Subscript // Subscript
$state = $this->options['sub'] ?? false; if ($this->options['sub'] ?? false) {
if ($state !== false) {
$this->inlineTypes['~'][] = 'Subscript'; $this->inlineTypes['~'][] = 'Subscript';
} }
// Emojis // Emojis
$state = $this->options['emojis'] ?? true; if ($this->options['emojis'] ?? true) {
if ($state !== false) {
$this->inlineTypes[':'][] = 'Emojis'; $this->inlineTypes[':'][] = 'Emojis';
$this->inlineMarkerList .= ':'; $this->inlineMarkerList .= ':';
} }
// Typographer // Typographer
$state = $this->options['typographer'] ?? false; if ($this->options['typographer'] ?? false) {
if ($state !== false) {
$this->inlineTypes['('][] = 'Typographer'; $this->inlineTypes['('][] = 'Typographer';
$this->inlineMarkerList .= '('; $this->inlineMarkerList .= '(';
$this->inlineTypes['.'][] = 'Typographer'; $this->inlineTypes['.'][] = 'Typographer';
@ -481,8 +474,7 @@ class Markdown
} }
// Smartypants // Smartypants
$state = $this->options['smarty'] ?? false; if ($this->options['smarty'] ?? false) {
if ($state !== false) {
$this->inlineTypes['<'][] = 'Smartypants'; $this->inlineTypes['<'][] = 'Smartypants';
$this->inlineMarkerList .= '<'; $this->inlineMarkerList .= '<';
$this->inlineTypes['>'][] = 'Smartypants'; $this->inlineTypes['>'][] = 'Smartypants';
@ -500,21 +492,18 @@ class Markdown
} }
// Block Math // Block Math
$state = $this->options['math'] ?? false; if ($this->options['math'] ?? false) {
if ($state !== false) {
$this->blockTypes['\\'][] = 'Math'; $this->blockTypes['\\'][] = 'Math';
$this->blockTypes['$'][] = 'Math'; $this->blockTypes['$'][] = 'Math';
} }
// Task // Task
$state = $this->options['lists']['tasks'] ?? true; if ($this->options['lists']['tasks'] ?? true) {
if ($state !== false) {
$this->blockTypes['['][] = 'Checkbox'; $this->blockTypes['['][] = 'Checkbox';
} }
// Embedding // Embeding
$state = $this->options['embeding'] ?? false; if ($this->options['embeding'] ?? false) {
if ($state !== false) {
$this->inlineTypes['['][] = 'Embeding'; $this->inlineTypes['['][] = 'Embeding';
$this->inlineMarkerList .= '['; $this->inlineMarkerList .= '[';
} }