Parse bbcode when page loads
This commit is contained in:
parent
05a9f0aa14
commit
6a82ff871f
@ -142,8 +142,8 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
$content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"');
|
$content = ($p['content'] !== '' ? htmlspecialchars_decode($p['content'],ENT_COMPAT) : '"# New page\n"');
|
||||||
// Render the Markdown-formatted page content in HTML
|
// Render the Markdown-formatted page content in HTML
|
||||||
require_once('library/markdown.php');
|
require_once('library/markdown.php');
|
||||||
$html = wiki_generate_toc(purify_html(Markdown(json_decode($content))));
|
$html = wiki_generate_toc(purify_html(Markdown(wiki_bbcode(json_decode($content)))));
|
||||||
$renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName);
|
$renderedContent = wiki_convert_links($html,argv(0).'/'.argv(1).'/'.$wikiUrlName);
|
||||||
$hide_editor = false;
|
$hide_editor = false;
|
||||||
$showPageControls = $wiki_editor;
|
$showPageControls = $wiki_editor;
|
||||||
|
@ -495,6 +495,12 @@ function wiki_convert_links($s, $wikiURL) {
|
|||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace the instances of the string [toc] with a list element that will be populated by
|
||||||
|
* a table of contents by the JavaScript library
|
||||||
|
* @param string $s
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function wiki_generate_toc($s) {
|
function wiki_generate_toc($s) {
|
||||||
|
|
||||||
if (strpos($s,'[toc]') !== false) {
|
if (strpos($s,'[toc]') !== false) {
|
||||||
|
Reference in New Issue
Block a user