ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
WordOnlyMarkdown.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Data\Text\Shape;
22
26
28{
32 public function getSupportedStructure(): array
33 {
34 return [
35 Structure::BOLD,
36 Structure::ITALIC
37 ];
38 }
39
40 public function fromString(string $text): Text\WordOnlyMarkdown
41 {
42 return new Text\WordOnlyMarkdown($this, $text);
43 }
44
45 public function isRawStringCompliant(string $text): bool
46 {
47 $options = mb_regex_set_options();
48 try {
49 mb_regex_set_options("m");
50 return !mb_ereg_match(
51 '.*((' . MRE::HEADINGS->value . ')|(' . MRE::UNORDERED_LIST->value . ')|(' . MRE::ORDERED_LIST->value . ')|' .
52 '(' . MRE::LINE_BREAK->value . ')|(' . MRE::PARAGRAPH->value . ')|(' . MRE::BLOCKQUOTE->value . ')|' .
53 '(' . MRE::CODEBLOCK->value . ')|(' . MRE::REF->value . ')|(' . MRE::LINK_REF_USAGE->value . ')|' .
54 '(' . MRE::IMAGE->value . ')|(' . MRE::IMAGE_REF_USAGE->value . '))',
55 $text
56 );
57 } finally {
58 mb_regex_set_options($options);
59 }
60 }
61}
MarkdownRegExps
Regular expressions to detect constructs from CommonMarkdown.