mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit b05c9f28ac942b1ebc367c47b07640dbcfc57e59
parent abc74d73f698f900b1fd5232e2927f5d08576519
Author: markseu <mark2011@mayberg.se>
Date:   Thu, 21 Aug 2014 16:50:28 +0200

Hello online demo (primum non nocere)

Diffstat:
MREADME.md | 2+-
Msystem/config/config.ini | 1+
Msystem/core/core-markdownextra.php | 19++++++++++++++++---
Msystem/core/core.php | 3++-
4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -1,4 +1,4 @@ -Yellow 0.3.14 +Yellow 0.3.15 ============= Yellow is for people who make websites. [Visit website](http://datenstrom.se/yellow). diff --git a/system/config/config.ini b/system/config/config.ini @@ -26,6 +26,7 @@ contentDir = content/ contentHomeDir = home/ contentDefaultFile = page.txt contentPagination = page +contentRemoveHtml = 0 contentExtension = .txt configExtension = .ini errorPageFile = error(.*).txt diff --git a/system/core/core-markdownextra.php b/system/core/core-markdownextra.php @@ -34,6 +34,8 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser $this->yellow = $yellow; $this->page = $page; $this->idAttributes = array(); + $this->no_markup = (bool)$this->yellow->config->get("contentRemoveHtml"); + $this->no_entities = (bool)$this->yellow->config->get("contentRemoveHtml"); parent::__construct(); } @@ -43,12 +45,13 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser $text = preg_replace("/@pageRead/i", $page->get("pageRead"), $text); $text = preg_replace("/@pageEdit/i", $page->get("pageEdit"), $text); $text = preg_replace("/@pageError/i", $page->get("pageError"), $text); + $text = $this->transform($text); $callback = function($matches) use ($page) { $matches[2] = $page->yellow->toolbox->normaliseLocation($matches[2], $page->base, $page->location); return "<a$matches[1]href=\"$matches[2]\"$matches[3]>"; }; - return preg_replace_callback("/<a(.*?)href=\"([^\"]+)\"(.*?)>/i", $callback, $this->transform($text)); + return preg_replace_callback("/<a(.*?)href=\"([^\"]+)\"(.*?)>/i", $callback, $text); } // Return unique id attribute @@ -68,10 +71,11 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser function doAutoLinks($text) { $text = preg_replace_callback("/<(\w+:[^\'\">\s]+)>/", array(&$this, "_doAutoLinks_url_callback"), $text); - $text = preg_replace_callback("/<(\w+@[\w\-\.]+)>/", array(&$this, "_doAutoLinks_email_callback"), $text); + $text = preg_replace_callback("/<([\w\-\.]+@[\w\-\.]+)>/", array(&$this, "_doAutoLinks_email_callback"), $text); $text = preg_replace_callback("/\[(\w+)\s+(.*?)\]/", array(&$this, "_doAutoLinks_shortcut_callback"), $text); + $text = preg_replace_callback("/\[\-\-(.*?)\-\-\]/", array(&$this, "_doAutoLinks_comment_callback"), $text); $text = preg_replace_callback("/((http|https|ftp):\/\/\S+[^\'\"\,\.\;\:\s]+)/", array(&$this, "_doAutoLinks_url_callback"), $text); - $text = preg_replace_callback("/(\w+@[\w\-\.]+\.[\w]{2,4})/", array(&$this, "_doAutoLinks_email_callback"), $text); + $text = preg_replace_callback("/([\w\-\.]+@[\w\-\.]+\.[\w]{2,4})/", array(&$this, "_doAutoLinks_email_callback"), $text); return $text; } @@ -83,6 +87,15 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser if(is_null($output)) $output = $matches[0]; return $this->hashBlock($output); } + + // Handle comments + function _doAutoLinks_comment_callback($matches) + { + $text = $matches[1]; + $output = "<!--".htmlspecialchars($text, ENT_NOQUOTES)."-->"; + if($text[0] == '-') $output = ""; + return $this->hashBlock($output); + } // Handle fenced code blocks function _doFencedCodeBlocks_callback($matches) diff --git a/system/core/core.php b/system/core/core.php @@ -5,7 +5,7 @@ // Yellow main class class Yellow { - const Version = "0.3.14"; + const Version = "0.3.15"; var $page; //current page var $pages; //pages from file system var $config; //configuration @@ -44,6 +44,7 @@ class Yellow $this->config->setDefault("contentHomeDir", "home/"); $this->config->setDefault("contentDefaultFile", "page.txt"); $this->config->setDefault("contentPagination", "page"); + $this->config->setDefault("contentRemoveHtml", "0"); $this->config->setDefault("contentExtension", ".txt"); $this->config->setDefault("configExtension", ".ini"); $this->config->setDefault("configFile", "config.ini");