setPageRegex(); parent::__construct(); } protected function setUp(): void { global $prefs, $user; $this->oldprefs = $prefs; $this->olduser = $user; } /** * remove the external Wikis defined in the tests */ protected function tearDown(): void { global $prefs, $user; $prefs = $this->oldprefs; $user = $this->olduser; } /** * @param $input * @param $output * @param array $options * @throws Exception */ public function testMarkdownParser(): void { global $prefs, $user; $user = 'admin'; $prefs['markdown_enabled'] = 'y'; $prefs['feature_wiki_argvariable'] = 'y'; $options['is_markdown'] = true; $this->assertEquals($this->html(), TikiLib::lib('parser')->parse_data($this->markdown(), $options)); } public function testReplaceLinks(): void { $template = "Link to ((%s)) in wiki syntax, as a ((%s|description)) and in [markdown](%s) syntax."; $content = sprintf($template, 'OldPageName', 'OldPageName', 'OldPageName'); $replaced = TikiLib::lib('parser')->replace_links($content, 'OldPageName', 'NewPageName'); $this->assertEquals(sprintf($template, 'NewPageName', 'NewPageName', 'NewPageName'), $replaced); } public function testGetPages(): void { global $prefs; $prefs['feature_wikiwords'] = 'y'; $content = "PageWikiWord ((The Wiki Way)) (alias(The Milky Way)) [markdown](markdown-page)"; $pages = TikiLib::lib('parser')->get_pages($content); $this->assertEquals(['The Wiki Way', 'The Milky Way', 'PageWikiWord', 'markdown-page'], $pages); } protected function markdown(): string { return "--- User: {{user}} --- Plugin test: {SUP()}**12**{SUP} --- # h1 Heading 8-) **This is bold text** __This is bold text__ *This is italic text* _This is italic text_ ~~Strikethrough~~ > Blockquotes can also be nested... >> ...by using additional greater-than signs right next to each other... > > > ...or with spaces between arrows. + Create a list by starting a line with `+`, `-`, or `*` + Sub-lists are made by indenting 2 spaces: - Marker character change forces new list start: * Ac tristique libero volutpat at + Facilisis in pretium nisl aliquet - Nulla volutpat aliquam velit + Very easy! 1. Lorem ipsum dolor sit amet 2. Consectetur adipiscing elit 3. Integer molestie lorem at massa 1. You can use sequential numbers... 1. ...or keep all the numbers as `1.` Start numbering with offset: 57. foo 1. bar Inline `code` // Some comments line 1 of code line 2 of code line 3 of code ``` Sample text here... ``` | Option | Description | | ------ | ----------- | | data | path to data files to supply the data that will be passed into templates. | | engine | engine to be used for processing templates. Handlebars is the default. | | ext | extension to be used for dest files. | Right aligned columns | Option | Description | | ------:| -----------:| | data | path to data files to supply the data that will be passed into templates. | | engine | engine to be used for processing templates. Handlebars is the default. | | ext | extension to be used for dest files. | [link text](http://example.org) [link with title](http://example.org/ \"title text!\") Autoconverted link https://example.org (enable linkify to see) Footnote 1 link[^first]. Footnote 2 link[^second]. Inline footnote^[Text of inline footnote] definition. Duplicated footnote reference[^second]. [^first]: Footnote **can have markup** and multiple paragraphs. [^second]: Footnote text. "; } protected function html(): string { return '
This is bold text
This is bold text
This is italic text
This is italic text
Strikethrough
Blockquotes can also be nested...
...by using additional greater-than signs right next to each other...
...or with spaces between arrows.
+, -, or *
1.
Start numbering with offset:
Inline code
// Some comments
line 1 of code
line 2 of code
line 3 of code
Sample text here...
| Option | Description |
|---|---|
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
Right aligned columns
| Option | Description |
|---|---|
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
Autoconverted link https://example.org (enable linkify to see)
Footnote 1 link1.
Footnote 2 link2.
Inline footnote3 definition.
Duplicated footnote reference2.
'; } }