function testMarkdown1() { $data = <<<MARKDOWN # Hello It's a trap MARKDOWN; $result = <<<HTML <h1>Hello</h1> <p>It's a trap</p> HTML; POINT::clear(); POINT::inline('test1', $data); $this->assertEquals(str_replace("\r\n", "\n", $result), POINT::get('test1', 'markdown-html')); }
public function main() { $this->log('<%=$version%>', Project::MSG_INFO); // define a force tag $time = false; if ($this->force) { $xtime = strtotime($this->force); if (!$xtime) { $time = time(); if ($this->force != 'force') { $this->log('wrong date "' . $this->force . '"', Project::MSG_WARN); } } else { $time = $xtime; } } $this->preprocessor->cfg_time($time); $this->preprocessor->logLevel = $this->logLevel; // difine variable definitions foreach ($this->parameters as $v) { $file = $v->getFile(); if (@is_readable($file)) { foreach (file($file) as $vv) { if (preg_match('/^(?:\\;.*|\\#.*|([^=]+)=(.*))$/', $vv, $mm)) { if (!empty($mm[1])) { $this->preprocessor->export(trim($mm[1]), trim($mm[2])); } } } } else { $this->preprocessor->export($v->getName(), $v->getValue()); } } //run it! if (!!$this->config) { $this->log('making "' . $this->config . '"', Project::MSG_WARN); POINT::clear(); $this->preprocessor->xml_read($this->config); $this->preprocessor->process(); } else { if (!empty($this->xconfigs)) { $config = ''; foreach ($this->xconfigs as $v) { $config .= $v->getText(); } $this->log('making "' . $config . '"', Project::MSG_WARN); POINT::clear(); $this->preprocessor->xml_read($config); $this->preprocessor->process(); } } }
/** * ловим ошибку - вставка кода в // комментарии */ function testPOINTComment() { $data = <<<HTML <?xml version='1.0' standalone='yes'?> <config> <files dstdir='tests'> <echo name="xx.txt"><![CDATA[ /* <% POINT::start('xxx');%> it's a text <% POINT::finish();%> */ // <%=POINT::get('xxx');%> ## <%=POINT::get('xxx');%> /* <%=POINT::get('xxx');%> */ ]]></echo> </files> </config> HTML; $result = <<<HTML // ---- point::xxx ---- it's a text ## ---- point::xxx ---- it's a text /* --- point::xxx --- */ it's a text HTML; $preprocessor = preprocessor::instance(); $preprocessor->xml_read($data); $preprocessor->process(); $data = file_get_contents('tests/xx.txt'); $this->assertEquals($this->nl2nl($result), $this->nl2nl($data)); POINT::clear(); unlink('tests/xx.txt'); }