ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
WordOnlyMarkdown.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Data\Text\Shape;
22 
24 use ILIAS\Data\Text;
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.