diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-06-25 14:29:52 -0500 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-06-25 14:29:52 -0500 |
commit | 0df3978cc5891f1383dd0dbcdc1c6b4c0010e645 (patch) | |
tree | 26549c9d00b9af36faa5c452cbe0ac95379451e9 /Zotlabs | |
parent | 241b257556826e172707689b89e6f07687f8f556 (diff) | |
download | volse-hubzilla-0df3978cc5891f1383dd0dbcdc1c6b4c0010e645.tar.gz volse-hubzilla-0df3978cc5891f1383dd0dbcdc1c6b4c0010e645.tar.bz2 volse-hubzilla-0df3978cc5891f1383dd0dbcdc1c6b4c0010e645.zip |
A page name wrapped in double brackets is converted into a link to another page in the current wiki
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Wiki.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 1c3add38f..de5863d2e 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -74,7 +74,9 @@ class Wiki extends \Zotlabs\Web\Controller { // Configure page template $wikiheaderName = t('Wiki'); $wikiheaderPage = t('Sandbox'); - $content = '"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."'; + require_once('library/markdown.php'); + $content = t('"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."'); + $renderedContent = Markdown(json_decode($content)); $hide_editor = false; $showPageControls = false; $showNewWikiButton = $wiki_owner; @@ -122,6 +124,9 @@ class Wiki extends \Zotlabs\Web\Controller { goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName); } $content = ($p['content'] !== '' ? $p['content'] : '"# New page\n"'); + // Render the Markdown-formatted page content in HTML + require_once('library/markdown.php'); + $renderedContent = wiki_convert_links(Markdown(json_decode($content)),argv(0).'/'.argv(1).'/'.$wikiUrlName); $hide_editor = false; $showPageControls = $wiki_editor; $showNewWikiButton = $wiki_owner; @@ -133,8 +138,6 @@ class Wiki extends \Zotlabs\Web\Controller { default: // Strip the extraneous URL components goaway('/'.argv(0).'/'.argv(1).'/'.$wikiUrlName.'/'.$pageUrlName); } - // Render the Markdown-formatted page content in HTML - require_once('library/markdown.php'); $wikiModalID = random_string(3); $wikiModal = replace_macros( @@ -162,7 +165,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$acl' => $x['acl'], '$bang' => $x['bang'], '$content' => $content, - '$renderedContent' => Markdown(json_decode($content)), + '$renderedContent' => $renderedContent, '$wikiName' => array('wikiName', t('Enter the name of your new wiki:'), '', ''), '$pageName' => array('pageName', t('Enter the name of the new page:'), '', ''), '$pageRename' => array('pageRename', t('Enter the new name:'), '', ''), @@ -193,8 +196,12 @@ class Wiki extends \Zotlabs\Web\Controller { // Render mardown-formatted text in HTML for preview if((argc() > 2) && (argv(2) === 'preview')) { $content = $_POST['content']; + $resource_id = $_POST['resource_id']; require_once('library/markdown.php'); $html = purify_html(Markdown($content)); + $w = wiki_get_wiki($resource_id); + $wikiURL = argv(0).'/'.argv(1).'/'.$w['urlName']; + $html = wiki_convert_links($html,$wikiURL); json_return_and_die(array('html' => $html, 'success' => true)); } |