Version 1
[yaffs-website] / vendor / cebe / markdown / inline / StrikeoutTrait.php
diff --git a/vendor/cebe/markdown/inline/StrikeoutTrait.php b/vendor/cebe/markdown/inline/StrikeoutTrait.php
new file mode 100644 (file)
index 0000000..6373e14
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * @copyright Copyright (c) 2014 Carsten Brandt
+ * @license https://github.com/cebe/markdown/blob/master/LICENSE
+ * @link https://github.com/cebe/markdown#readme
+ */
+
+namespace cebe\markdown\inline;
+
+/**
+ * Adds strikeout inline elements
+ */
+trait StrikeoutTrait
+{
+       /**
+        * Parses the strikethrough feature.
+        * @marker ~~
+        */
+       protected function parseStrike($markdown)
+       {
+               if (preg_match('/^~~(.+?)~~/', $markdown, $matches)) {
+                       return [
+                               [
+                                       'strike',
+                                       $this->parseInline($matches[1])
+                               ],
+                               strlen($matches[0])
+                       ];
+               }
+               return [['text', $markdown[0] . $markdown[1]], 2];
+       }
+
+       protected function renderStrike($block)
+       {
+               return '<del>' . $this->renderAbsy($block[1]) . '</del>';
+       }
+}