aboutsummaryrefslogtreecommitdiffstats
path: root/mod/help.php
diff options
context:
space:
mode:
authorhabeascodice <habeascodice@federated.social>2014-11-17 08:30:26 -0800
committerhabeascodice <habeascodice@federated.social>2014-11-17 08:30:26 -0800
commit540b7af2c12666047710dd8f5e0c54d23ae8872c (patch)
treeea90f72d9d308f6cb061a528c1f8494106e70087 /mod/help.php
parent80eb84e843cdca51bbf4ebda180f4de41351b9c4 (diff)
parentee38bebbd6a641eb953eacf493c085053442d972 (diff)
downloadvolse-hubzilla-540b7af2c12666047710dd8f5e0c54d23ae8872c.tar.gz
volse-hubzilla-540b7af2c12666047710dd8f5e0c54d23ae8872c.tar.bz2
volse-hubzilla-540b7af2c12666047710dd8f5e0c54d23ae8872c.zip
Merge branch 'master' of https://github.com/habeascodice/red
Diffstat (limited to 'mod/help.php')
-rw-r--r--mod/help.php26
1 files changed, 19 insertions, 7 deletions
diff --git a/mod/help.php b/mod/help.php
index 81ecd6ba9..4823f1c07 100644
--- a/mod/help.php
+++ b/mod/help.php
@@ -34,8 +34,6 @@ function help_content(&$a) {
$doctype = 'markdown';
- require_once('library/markdown.php');
-
$text = '';
if(argc() > 1) {
@@ -73,17 +71,22 @@ function help_content(&$a) {
));
}
- $text = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $text);
-
if($doctype === 'html')
$content = $text;
- if($doctype === 'markdown')
+ if($doctype === 'markdown') {
+ require_once('library/markdown.php');
+ # escape #include tags
+ $text = preg_replace('/#include/ism', '%%include', $text);
$content = Markdown($text);
+ $content = preg_replace('/%%include/ism', '#include', $content);
+ }
if($doctype === 'bbcode') {
require_once('include/bbcode.php');
$content = bbcode($text);
}
+ $content = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $content);
+
return replace_macros(get_markup_template("help.tpl"), array(
'$content' => $content
));
@@ -93,8 +96,17 @@ function help_content(&$a) {
function preg_callback_help_include($matches) {
- if($matches[1])
- return str_replace($matches[0],load_doc_file($matches[1]),$matches[0]);
+ if($matches[1]) {
+ $include = str_replace($matches[0],load_doc_file($matches[1]),$matches[0]);
+ if(preg_match('/\.bb$/', $matches[1])) {
+ require_once('include/bbcode.php');
+ $include = bbcode($include);
+ } elseif(preg_match('/\.md$/', $matches[1])) {
+ require_once('library/markdown.php');
+ $include = Markdown($include);
+ }
+ return $include;
+ }
}