From af97e99b39dcc07629bf7bbf6d0d5ca1a7611c47 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sun, 20 Jan 2019 02:28:17 +0000 Subject: [PATCH] Implement Rule --- src/Components/Blocks/Rule.php | 43 ++++++++++++++++++++++++++++++++++ src/Parsedown.php | 18 -------------- 2 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 src/Components/Blocks/Rule.php diff --git a/src/Components/Blocks/Rule.php b/src/Components/Blocks/Rule.php new file mode 100644 index 0000000..e846761 --- /dev/null +++ b/src/Components/Blocks/Rule.php @@ -0,0 +1,43 @@ +line()->text()[0]; + + if (\substr_count($Context->line()->text(), $marker) >= 3 and \chop($Context->line()->text(), " $marker") === '') { + return new self; + } + + return null; + } + + /** + * @return Element + */ + public function stateRenderable(Parsedown $_) + { + return Element::selfClosing('hr', []); + } +} diff --git a/src/Parsedown.php b/src/Parsedown.php index 236370a..5352931 100644 --- a/src/Parsedown.php +++ b/src/Parsedown.php @@ -334,24 +334,6 @@ class Parsedown return $Block; } - # - # Rule - - protected function blockRule(Context $Context) - { - $marker = $Context->line()->text()[0]; - - if (\substr_count($Context->line()->text(), $marker) >= 3 and \chop($Context->line()->text(), " $marker") === '') { - $Block = [ - 'element' => [ - 'name' => 'hr', - ], - ]; - - return $Block; - } - } - # # Setext