From b3df72c5dfb4682e21f6a935eaae154a8b4e56f8 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 1 Jun 2010 18:27:41 +0200 Subject: [PATCH 01/11] opened 3.0-dev --- composer.json | 5 +++++ src/Texy/Texy.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ba75a86e..3e10457c 100644 --- a/composer.json +++ b/composer.json @@ -23,5 +23,10 @@ "autoload": { "classmap": ["src/"], "files": ["src/texy.php"] + }, + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } } } diff --git a/src/Texy/Texy.php b/src/Texy/Texy.php index 59b5db57..da8bccb4 100644 --- a/src/Texy/Texy.php +++ b/src/Texy/Texy.php @@ -25,7 +25,7 @@ class Texy const NONE = false; // Texy version - const VERSION = '2.9.3'; + const VERSION = '3.0-dev'; const REVISION = 'released on 2018-06-22'; // types of protection marks From 6f32a5964aa2ed5673bb8576cd359c3713d4a74b Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 4 Oct 2015 14:57:52 +0200 Subject: [PATCH 02/11] only UTF-8 encoding is now supported (BC break) --- .travis.yml | 2 +- examples/1-2-3 start/demo.php | 3 +- src/Texy/Modules/ImageModule.php | 4 +- src/Texy/Modules/LinkModule.php | 4 +- src/Texy/Texy.php | 24 ++--- src/Texy/Utf.php | 134 -------------------------- src/texy.php | 1 - tests/Texy/expected/windows-1250.html | 46 --------- tests/Texy/sources/windows-1250.texy | 28 ------ tests/Texy/windows-1250.phpt | 18 ---- 10 files changed, 13 insertions(+), 251 deletions(-) delete mode 100644 src/Texy/Utf.php delete mode 100644 tests/Texy/expected/windows-1250.html delete mode 100644 tests/Texy/sources/windows-1250.texy delete mode 100644 tests/Texy/windows-1250.phpt diff --git a/.travis.yml b/.travis.yml index 6c80531d..893bb9eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ jobs: # Install Nette Code Checker - travis_retry composer create-project nette/code-checker temp/code-checker ~2 --no-progress script: - - php temp/code-checker/src/code-checker.php --short-arrays -i windows-1250.html -i windows-1250.texy + - php temp/code-checker/src/code-checker.php --short-arrays - stage: Code Coverage diff --git a/examples/1-2-3 start/demo.php b/examples/1-2-3 start/demo.php index 07e37688..a10c053d 100644 --- a/examples/1-2-3 start/demo.php +++ b/examples/1-2-3 start/demo.php @@ -12,7 +12,6 @@ $texy = new Texy(); // other OPTIONAL configuration -$texy->encoding = 'windows-1250'; // disable UTF-8 $texy->imageModule->root = 'images/'; // specify image folder $texy->allowed['phrase/ins'] = true; $texy->allowed['phrase/del'] = true; @@ -27,7 +26,7 @@ // echo formated output -header('Content-type: text/html; charset=' . $texy->encoding); +header('Content-type: text/html; charset=utf-8'); echo ''; echo '' . $texy->headingModule->title . ''; echo $html; diff --git a/src/Texy/Modules/ImageModule.php b/src/Texy/Modules/ImageModule.php index 1c5f232a..9b9592ef 100644 --- a/src/Texy/Modules/ImageModule.php +++ b/src/Texy/Modules/ImageModule.php @@ -134,7 +134,7 @@ public function patternImage(Texy\LineParser $parser, array $matches) */ public function addReference($name, Image $image) { - $image->name = Texy\Utf::strtolower($name); + $image->name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name; $this->references[$image->name] = $image; } @@ -146,7 +146,7 @@ public function addReference($name, Image $image) */ public function getReference($name) { - $name = Texy\Utf::strtolower($name); + $name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name; if (isset($this->references[$name])) { return clone $this->references[$name]; } diff --git a/src/Texy/Modules/LinkModule.php b/src/Texy/Modules/LinkModule.php index a6ce1665..26cea1ea 100644 --- a/src/Texy/Modules/LinkModule.php +++ b/src/Texy/Modules/LinkModule.php @@ -190,7 +190,7 @@ public function patternUrlEmail(LineParser $parser, array $matches, $name) */ public function addReference($name, Link $link) { - $link->name = Texy\Utf::strtolower($name); + $link->name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name; $this->references[$link->name] = $link; } @@ -202,7 +202,7 @@ public function addReference($name, Link $link) */ public function getReference($name) { - $name = Texy\Utf::strtolower($name); + $name = function_exists('mb_strtolower') ? mb_strtolower($name, 'UTF-8') : $name; if (isset($this->references[$name])) { return clone $this->references[$name]; diff --git a/src/Texy/Texy.php b/src/Texy/Texy.php index da8bccb4..c2b17eda 100644 --- a/src/Texy/Texy.php +++ b/src/Texy/Texy.php @@ -49,9 +49,6 @@ class Texy const XHTML1_STRICT = 3; // Texy::HTML4_STRICT | Texy::XML; const XHTML5 = 6; // Texy::HTML5 | Texy::XML; - /** @var string input & output text encoding */ - public $encoding = 'utf-8'; - /** @var array Texy! syntax configuration */ public $allowed = []; @@ -405,9 +402,6 @@ public function process($text, $singleLine = false) $this->_styles = $this->allowedStyles; } - // convert to UTF-8 (and check source encoding) - $text = Utf::toUtf($text, $this->encoding); - if ($this->removeSoftHyphens) { $text = str_replace("\xC2\xAD", '', $text); } @@ -458,8 +452,7 @@ public function process($text, $singleLine = false) $html = str_replace("\r", "\n", $html); $this->processing = false; - - return Utf::utf2html($html, $this->encoding); + return $html; } @@ -477,14 +470,11 @@ public function processLine($text) /** * Makes only typographic corrections. - * @param string input text (in encoding defined by Texy::$encoding) - * @return string output text (in UTF-8) + * @param string input text + * @return string output text */ public function processTypo($text) { - // convert to UTF-8 (and check source encoding) - $text = Utf::toUtf($text, $this->encoding); - // standardize line endings and spaces $text = Helpers::normalize($text); @@ -495,7 +485,7 @@ public function processTypo($text) $text = $this->longWordsModule->postLine($text); } - return Utf::utf2html($text, $this->encoding); + return $text; } @@ -509,12 +499,12 @@ public function toText() throw new \RuntimeException('Call $texy->process() first.'); } - return Utf::utfTo($this->DOM->toText($this), $this->encoding); + return $this->DOM->toText($this); } /** - * Converts internal string representation to final HTML code in UTF-8. + * Converts internal string representation to final HTML code. * @return string */ final public function stringToHtml($s) @@ -554,7 +544,7 @@ final public function stringToHtml($s) /** - * Converts internal string representation to final HTML code in UTF-8. + * Converts internal string representation to final HTML code. * @return string */ final public function stringToText($s) diff --git a/src/Texy/Utf.php b/src/Texy/Utf.php deleted file mode 100644 index c0f5fb61..00000000 --- a/src/Texy/Utf.php +++ /dev/null @@ -1,134 +0,0 @@ - charset table - self::$xlat = &self::$xlatCache[strtolower($encoding)]; - if (!self::$xlat) { - for ($i = 128; $i < 256; $i++) { - $ch = @iconv($encoding, 'UTF-8//IGNORE', chr($i)); // intentionally @ - if ($ch) { - self::$xlat[$ch] = chr($i); - } - } - } - - // convert - return preg_replace_callback('#[\x80-\x{FFFF}]#u', [__CLASS__, 'cb'], $s); - } - - - /** - * Callback; converts UTF-8 to HTML entity OR character in dest encoding. - */ - private static function cb($m) - { - $m = $m[0]; - if (isset(self::$xlat[$m])) { - return self::$xlat[$m]; - } - - $ch1 = ord($m[0]); - $ch2 = ord($m[1]); - if (($ch2 >> 6) !== 2) { - return ''; - } - - if (($ch1 & 0xE0) === 0xC0) { - return '&#' . ((($ch1 & 0x1F) << 6) + ($ch2 & 0x3F)) . ';'; - } - - if (($ch1 & 0xF0) === 0xE0) { - $ch3 = ord($m[2]); - if (($ch3 >> 6) !== 2) { - return ''; - } - return '&#' . ((($ch1 & 0xF) << 12) + (($ch2 & 0x3F) << 06) + (($ch3 & 0x3F))) . ';'; - } - - return ''; - } -} diff --git a/src/texy.php b/src/texy.php index 7099f82d..c0849c33 100644 --- a/src/texy.php +++ b/src/texy.php @@ -26,7 +26,6 @@ 'Texy\Patterns' => 'Patterns.php', 'Texy\Regexp' => 'Regexp.php', 'Texy\Strict' => 'Strict.php', - 'Texy\Utf' => 'Utf.php', 'Texy\Modules\BlockModule' => 'Modules/BlockModule.php', 'Texy\Modules\BlockQuoteModule' => 'Modules/BlockQuoteModule.php', 'Texy\Modules\EmoticonModule' => 'Modules/EmoticonModule.php', diff --git a/tests/Texy/expected/windows-1250.html b/tests/Texy/expected/windows-1250.html deleted file mode 100644 index 3e69ab5c..00000000 --- a/tests/Texy/expected/windows-1250.html +++ /dev/null @@ -1,46 +0,0 @@ -

Texy! is sexy!

- -

Texy! je převaděč textu do formátovaného HTML kódu. Díky němu -můžete psát strukturované dokumenty i bez znalosti nebo použití jazyka -HTML. Dokument napíšete v přehledné, čistě textové, formě a Texy! jej -automaticky převede do validního (X)HTML kódu.

- -

Texy! je jedním z nejkomplexněj­ších formátovačů. -Umí zpracovávat obrázky, odkazy, vnořené seznamy, tabulky a má také plnou -podporu CSS.

- - diff --git a/tests/Texy/sources/windows-1250.texy b/tests/Texy/sources/windows-1250.texy deleted file mode 100644 index 0e0ee205..00000000 --- a/tests/Texy/sources/windows-1250.texy +++ /dev/null @@ -1,28 +0,0 @@ -Texy! is sexy! -************** - -Texy! je převaděč textu do formátovaného HTML kódu. Díky němu můžete -psát strukturované dokumenty i bez znalosti nebo použití jazyka HTML. -Dokument napíšete v přehledné, čistě textové, formě a Texy! jej -automaticky převede do validního (X)HTML kódu. - -Texy! je jedním z **nejkomplexnějších** formátovačů. Umí zpracovávat -obrázky, odkazy, vnořené seznamy, tabulky a má také plnou -podporu CSS((Kaskádové styly)). - - -- rozdělení velmi dlouhých slov podle českých pravidel. Příklad: nejneobhospodařovávatelnějšími -- klikatelné adresy www.example.cz, dave@example.com (emaily jsou odolné vůči spambotům) -- "české" 'typografické' uvozovky -- pomlčka vs. spojovník: 10-15 vs. česko-slovenský -- pomlčka: jedna -- dvě -- typografický křížek u rozměrů 10 x 20 -- nedělitelné mezery u telefonních čísel +420 776 552 046 -- vkládání nezalomitelných mezer za jednopísmenné předložky -- acronym NATO((North Atlantic Treaty Organisation)) -- abbr "et al."((a další)) -- náhrady(TM) nebo(R) za příslušné (C)entity -- šipky <- a -> a <-> -- tři tečky... -- zachování HTML entit & -- a spousta dalšího :-) diff --git a/tests/Texy/windows-1250.phpt b/tests/Texy/windows-1250.phpt deleted file mode 100644 index 898489fc..00000000 --- a/tests/Texy/windows-1250.phpt +++ /dev/null @@ -1,18 +0,0 @@ -encoding = 'windows-1250'; - -Assert::matchFile( - __DIR__ . '/expected/windows-1250.html', - $texy->process(file_get_contents(__DIR__ . '/sources/windows-1250.texy')) -); From e6399593aba68a96e0ab10be34c354bfd7a98609 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 26 May 2010 17:56:00 +0200 Subject: [PATCH 03/11] removed deprecated stuff --- src/Texy/HandlerInvocation.php | 6 ------ src/Texy/HtmlElement.php | 18 ------------------ src/Texy/Modules/BlockModule.php | 8 -------- src/Texy/Texy.php | 25 +------------------------ src/compatibility.php | 29 ----------------------------- src/texy.php | 2 -- 6 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 src/compatibility.php diff --git a/src/Texy/HandlerInvocation.php b/src/Texy/HandlerInvocation.php index 964be387..840c037b 100644 --- a/src/Texy/HandlerInvocation.php +++ b/src/Texy/HandlerInvocation.php @@ -78,10 +78,4 @@ public function getTexy() { return $this->parser->getTexy(); } - - - /** @deprecated */ - public function free() - { - } } diff --git a/src/Texy/HtmlElement.php b/src/Texy/HtmlElement.php index 7fb618f5..4463eb24 100644 --- a/src/Texy/HtmlElement.php +++ b/src/Texy/HtmlElement.php @@ -159,24 +159,6 @@ final public function &__get($name) } - /** - * Overloaded setter for element's attribute. - * @param string attribute name - * @param array value - * @return self - */ -/* - final public function __call($m, $args) - { - if (count($args) !== 1) { - throw new \InvalidArgumentException("Just one argument is required."); - } - $this->attrs[$m] = $args[0]; - return $this; - } -*/ - - /** * Special setter for element's attribute. * @param string path diff --git a/src/Texy/Modules/BlockModule.php b/src/Texy/Modules/BlockModule.php index d17d2655..ba9e45ec 100644 --- a/src/Texy/Modules/BlockModule.php +++ b/src/Texy/Modules/BlockModule.php @@ -83,14 +83,6 @@ public function pattern(Texy\BlockParser $parser, array $matches) } - // for backward compatibility - public function outdent($s) - { - trigger_error('Use Texy\Helpers::outdent()', E_USER_WARNING); - return Helpers::outdent($s); - } - - /** * Finish invocation. * @return HtmlElement|string|false diff --git a/src/Texy/Texy.php b/src/Texy/Texy.php index c2b17eda..0b8c1feb 100644 --- a/src/Texy/Texy.php +++ b/src/Texy/Texy.php @@ -97,9 +97,6 @@ class Texy /** @var bool remove soft hyphens (SHY)? */ public $removeSoftHyphens = true; - /** @deprecated */ - public static $advertisingNotice = false; - /** @var string */ public $nontextParagraph = 'div'; @@ -205,12 +202,6 @@ class Texy private $mode; - /** DEPRECATED */ - public static $strictDTD; - public $cleaner; - public $xhtml; - - public function __construct() { if (defined('PCRE_VERSION') && PCRE_VERSION == 8.34 && PHP_VERSION_ID < 50513) { @@ -222,18 +213,9 @@ public function __construct() trigger_error("Texy: mb_internal_encoding changed to 'pass'", E_USER_WARNING); } - // load all modules $this->loadModules(); - // DEPRECATED - if (self::$strictDTD !== null) { - $this->setOutputMode(self::$strictDTD ? self::XHTML1_STRICT : self::XHTML1_TRANSITIONAL); - } else { - $this->setOutputMode(self::XHTML1_TRANSITIONAL); - } - - // DEPRECATED - $this->cleaner = &$this->htmlOutputModule; + $this->setOutputMode(self::XHTML1_TRANSITIONAL); // examples of link references ;-) $link = new Link('https://texy.info/'); @@ -750,9 +732,4 @@ final public static function prependRoot($URL, $root) return Helpers::prependRoot($URL, $root); } - - /** @deprecated */ - final public function free() - { - } } diff --git a/src/compatibility.php b/src/compatibility.php deleted file mode 100644 index 9b7e60d3..00000000 --- a/src/compatibility.php +++ /dev/null @@ -1,29 +0,0 @@ - Date: Tue, 5 Apr 2016 16:51:46 +0200 Subject: [PATCH 04/11] Texy: DTD definitions are explicitly passed --- src/Texy/DTD.php | 2 ++ src/Texy/Texy.php | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Texy/DTD.php b/src/Texy/DTD.php index 67554e4b..f1d17e31 100644 --- a/src/Texy/DTD.php +++ b/src/Texy/DTD.php @@ -470,3 +470,5 @@ $dtd['th'][0] += ['nowrap' => 1, 'bgcolor' => 1, 'width' => 1, 'height' => 1]; // missing: FRAMESET, FRAME, BGSOUND, XMP, ... + +return $dtd; diff --git a/src/Texy/Texy.php b/src/Texy/Texy.php index 0b8c1feb..384800d7 100644 --- a/src/Texy/Texy.php +++ b/src/Texy/Texy.php @@ -245,8 +245,7 @@ public function setOutputMode($mode) } if (!isset(self::$dtdCache[$mode])) { - require __DIR__ . '/DTD.php'; - self::$dtdCache[$mode] = $dtd; + self::$dtdCache[$mode] = require __DIR__ . '/DTD.php'; } $this->mode = $mode; From 202481f8839db5e75117339cdc503f2c5a854da3 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 21 Apr 2016 11:26:53 +0200 Subject: [PATCH 05/11] tests/travis: reports code coverage to Coveralls --- readme.md | 1 + tests/.coveralls.yml | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 tests/.coveralls.yml diff --git a/readme.md b/readme.md index 3f01e040..b333ce2b 100644 --- a/readme.md +++ b/readme.md @@ -3,6 +3,7 @@ Texy! [![Buy me a coffee](https://files.nette.org/images/coffee1s.png)](https: [![Downloads this Month](https://img.shields.io/packagist/dm/texy/texy.svg)](https://packagist.org/packages/texy/texy) [![Build Status](https://travis-ci.org/dg/texy.svg?branch=master)](https://travis-ci.org/dg/texy) +[![Coverage Status](https://coveralls.io/repos/github/dg/texy/badge.svg?branch=master)](https://coveralls.io/github/dg/texy?branch=master) [![Latest Stable Version](https://poser.pugx.org/dg/texy/v/stable)](https://github.com/dg/texy/releases) [![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/dg/texy/blob/master/license.md) diff --git a/tests/.coveralls.yml b/tests/.coveralls.yml new file mode 100644 index 00000000..82764a3f --- /dev/null +++ b/tests/.coveralls.yml @@ -0,0 +1,4 @@ +# for php-coveralls +service_name: travis-ci +coverage_clover: coverage.xml +json_path: coverage.json From 1bc0699c8fe2927217b7d19795875760c1a66250 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 3 Jan 2017 00:45:08 +0100 Subject: [PATCH 06/11] updated contributing.md, added GitHub templates --- .gitattributes | 1 + .github/issue_template.md | 16 ++++++++++++++++ .github/pull_request_template.md | 11 +++++++++++ contributing.md | 30 +++++++++++++++++------------- 4 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 .github/issue_template.md create mode 100644 .github/pull_request_template.md diff --git a/.gitattributes b/.gitattributes index 20c7d6b3..0bb91f72 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ .gitattributes export-ignore .gitignore export-ignore +.github export-ignore .travis.yml export-ignore tests export-ignore *.sh eol=lf diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 00000000..750f02ab --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,16 @@ +- bug report? yes/no +- feature request? yes/no +- version: ?.?.? + +### Description +... + +### Steps To Reproduce +... If possible a minimal demo of the problem ... + + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..b41cb73a --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +- bug fix? yes/no +- new feature? yes/no +- BC break? yes/no + + diff --git a/contributing.md b/contributing.md index 8ce237d6..1bec8d4b 100644 --- a/contributing.md +++ b/contributing.md @@ -1,27 +1,31 @@ How to contribute & use the issue tracker ========================================= -The issue tracker is the preferred channel for bug reports, features requests -and submitting pull requests, but please respect the following restrictions: +Texy welcomes your contributions. There are several ways to help out: -* Please **do not** use the issue tracker for personal support requests (use - [Texy forum](https://forum.texy.info) or [Stack Overflow](http://stackoverflow.com)). +* Create an issue on GitHub, if you have found a bug +* Write test cases for open bug issues +* Write fixes for open bug/feature issues, preferably with test cases included +* Contribute to the documentation -* Please **do not** derail or troll issues. Keep the discussion on topic and - respect the opinions of others. +Issues +------ -* Use the GitHub **issue search** — check if the issue has already been - reported. +Please **do not use the issue tracker to ask questions**. We will be happy to help you +on [Texy forum](https://forum.texy.info). -A good **bug report** shouldn't leave others needing to chase you up for more +A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. **Feature requests** are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. -We welcome **pull requests**. If you'd like to contribute, please take a moment -to [read the guidelines](https://nette.org/en/contributing) in order to make -the contribution process easy and effective for everyone involved. +Contributing +------------ -Thanks! +The best way to propose a feature is to discuss your ideas on [Texy forum](https://forum.texy.info) before implementing them. + +Please do not fix whitespace, format code, or make a purely cosmetic patch. + +Thanks! :heart: From ecb4086c31fe4551196af7333ac1e830c584ced7 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 9 Jan 2017 06:08:18 +0100 Subject: [PATCH 07/11] FigureModule: matches standalone images, instead of imageModule (BC break) --- src/Texy/Modules/FigureModule.php | 10 +++++++--- tests/Texy/expected/special.html | 4 ++-- tests/Texy/expected/syntax.html | 7 ++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Texy/Modules/FigureModule.php b/src/Texy/Modules/FigureModule.php index 1ee6dfdb..1fda0e8f 100644 --- a/src/Texy/Modules/FigureModule.php +++ b/src/Texy/Modules/FigureModule.php @@ -38,7 +38,7 @@ public function __construct($texy) $texy->registerBlockPattern( [$this, 'pattern'], '#^\[\* *+([^\n' . Patterns::MARK . ']{1,1000})' . Patterns::MODIFIER . '? *+(\*|(?|<)\]' // [* urls .(title)[class]{style} >] - . '(?::(' . Patterns::LINK_URL . '|:))?? ++\*\*\* ++(.{0,2000})' . Patterns::MODIFIER_H . '?()$#mUu', + . '(?::(' . Patterns::LINK_URL . '|:))??(?: ++\*\*\* ++(.{0,2000}))?' . Patterns::MODIFIER_H . '?()$#mUu', 'figure' ); } @@ -102,8 +102,12 @@ public function solve(Texy\HandlerInvocation $invocation, Texy\Image $image, Tex $mod->decorate($texy, $el); $el[0] = $elImg; - $el[1] = new Texy\HtmlElement('p'); - $el[1]->parseLine($texy, ltrim($content)); + + $content = ltrim($content); + if ($content) { + $el[1] = new Texy\HtmlElement('p'); + $el[1]->parseLine($texy, $content); + } $class = $this->class; if ($hAlign) { diff --git a/tests/Texy/expected/special.html b/tests/Texy/expected/special.html index 91ad2fa3..9d85fdd6 100644 --- a/tests/Texy/expected/special.html +++ b/tests/Texy/expected/special.html @@ -1,4 +1,4 @@ -
alternativni text
+
alternativni text

10 % a 20 %

@@ -121,7 +121,7 @@

[* image <>]

-
+

[* >]

diff --git a/tests/Texy/expected/syntax.html b/tests/Texy/expected/syntax.html index f722f605..057bdd5c 100644 --- a/tests/Texy/expected/syntax.html +++ b/tests/Texy/expected/syntax.html @@ -110,7 +110,7 @@

using references

Images

-
+

in paragraph

@@ -125,7 +125,7 @@

in paragraph

with on-mouse-over event

-
using references

with modifiers

-
+

Phrases

From 2676fb0e3139a5a21df206db5bb1c6ad525fe8a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Hud=C3=ADk?= Date: Sat, 8 Apr 2017 18:49:41 +0200 Subject: [PATCH 08/11] tests: added test for image center syntax (#42) --- tests/Texy/expected/special.html | 2 ++ tests/Texy/sources/special.texy | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/Texy/expected/special.html b/tests/Texy/expected/special.html index 9d85fdd6..97b889f0 100644 --- a/tests/Texy/expected/special.html +++ b/tests/Texy/expected/special.html @@ -127,6 +127,8 @@

[* <]

+
+

V zahradě rozkoší zachmuřen
Hieronymus Bosch
v přístěnku Bestiář Aristotelův

diff --git a/tests/Texy/sources/special.texy b/tests/Texy/sources/special.texy index 0b1e0c6c..4f518b02 100644 --- a/tests/Texy/sources/special.texy +++ b/tests/Texy/sources/special.texy @@ -116,6 +116,8 @@ m_2n [* <] +.<> +[* image *] //V zahradě rozkoší zachmuřen From e995b7a2e60cd1b29a495e8befff63167c5379fc Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 21 Oct 2015 13:35:48 +0200 Subject: [PATCH 09/11] Texy: removed $styleSheet (BC break) --- examples/cache/mytexy.php | 4 ++-- examples/syntax highlighting/demo-geshi.php | 7 ++++--- src/Texy/Texy.php | 3 --- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/cache/mytexy.php b/examples/cache/mytexy.php index 59c36f4f..8ecdc7d0 100644 --- a/examples/cache/mytexy.php +++ b/examples/cache/mytexy.php @@ -38,12 +38,12 @@ public function process($text, $useCache = true) $cacheFile = $this->cachePath . $md5 . '.html'; $content = is_file($cacheFile) ? unserialize(file_get_contents($cacheFile)) : null; if ($content) { // read from cache - list($html, $this->styleSheet, $this->headingModule->title) = $content; + list($html, $this->headingModule->title) = $content; } else { // doesn't exists $html = parent::process($text); file_put_contents($cacheFile, - serialize([$html, $this->styleSheet, $this->headingModule->title]) + serialize([$html, $this->headingModule->title]) ); } diff --git a/examples/syntax highlighting/demo-geshi.php b/examples/syntax highlighting/demo-geshi.php index 4139ce29..224a70a2 100644 --- a/examples/syntax highlighting/demo-geshi.php +++ b/examples/syntax highlighting/demo-geshi.php @@ -56,7 +56,8 @@ function blockHandler(Texy\HandlerInvocation $invocation, $blocktype, $content, $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;'); // save generated stylesheet - $texy->styleSheet .= $geshi->get_stylesheet(); + global $styleSheet + $styleSheet .= $geshi->get_stylesheet(); $content = $geshi->parse_code(); @@ -76,7 +77,7 @@ function blockHandler(Texy\HandlerInvocation $invocation, $blocktype, $content, $texy->addHandler('block', 'blockHandler'); // prepare CSS stylesheet -$texy->styleSheet = 'pre { padding:10px } '; +$styleSheet = 'pre { padding:10px } '; // processing $text = file_get_contents('sample.texy'); @@ -84,7 +85,7 @@ function blockHandler(Texy\HandlerInvocation $invocation, $blocktype, $content, // echo Geshi Stylesheet header('Content-type: text/html; charset=utf-8'); -echo ''; +echo ''; echo '' . $texy->headingModule->title . ''; // echo formated output echo $html; diff --git a/src/Texy/Texy.php b/src/Texy/Texy.php index 384800d7..0e2224aa 100644 --- a/src/Texy/Texy.php +++ b/src/Texy/Texy.php @@ -80,9 +80,6 @@ class Texy 'preload' => [], ]; - /** @var string Generated stylesheet */ - public $styleSheet = ''; - /** @var array CSS classes for align modifiers */ public $alignClasses = [ 'left' => null, From c0b04adc95dac134ae1c9f06402d904fa0f44a23 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 23 Mar 2018 11:55:52 +0100 Subject: [PATCH 10/11] loader: uses only Composer's autoloader --- src/texy.php | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/src/texy.php b/src/texy.php index 15e1219f..3da561fb 100644 --- a/src/texy.php +++ b/src/texy.php @@ -12,41 +12,7 @@ } spl_autoload_register(function ($class) { - static $map = [ - 'Texy\Texy' => 'Texy.php', - 'Texy\BlockParser' => 'BlockParser.php', - 'Texy\Configurator' => 'Configurator.php', - 'Texy\HandlerInvocation' => 'HandlerInvocation.php', - 'Texy\Helpers' => 'Helpers.php', - 'Texy\HtmlElement' => 'HtmlElement.php', - 'Texy\LineParser' => 'LineParser.php', - 'Texy\Modifier' => 'Modifier.php', - 'Texy\Module' => 'Module.php', - 'Texy\Parser' => 'Parser.php', - 'Texy\Patterns' => 'Patterns.php', - 'Texy\Regexp' => 'Regexp.php', - 'Texy\Strict' => 'Strict.php', - 'Texy\Modules\BlockModule' => 'Modules/BlockModule.php', - 'Texy\Modules\BlockQuoteModule' => 'Modules/BlockQuoteModule.php', - 'Texy\Modules\EmoticonModule' => 'Modules/EmoticonModule.php', - 'Texy\Modules\FigureModule' => 'Modules/FigureModule.php', - 'Texy\Modules\HeadingModule' => 'Modules/HeadingModule.php', - 'Texy\Modules\HorizLineModule' => 'Modules/HorizLineModule.php', - 'Texy\Modules\HtmlModule' => 'Modules/HtmlModule.php', - 'Texy\Modules\HtmlOutputModule' => 'Modules/HtmlOutputModule.php', - 'Texy\Image' => 'Image.php', - 'Texy\Modules\ImageModule' => 'Modules/ImageModule.php', - 'Texy\Link' => 'Link.php', - 'Texy\Modules\LinkModule' => 'Modules/LinkModule.php', - 'Texy\Modules\ListModule' => 'Modules/ListModule.php', - 'Texy\Modules\LongWordsModule' => 'Modules/LongWordsModule.php', - 'Texy\Modules\ParagraphModule' => 'Modules/ParagraphModule.php', - 'Texy\Modules\PhraseModule' => 'Modules/PhraseModule.php', - 'Texy\Modules\ScriptModule' => 'Modules/ScriptModule.php', - 'Texy\Modules\TableCellElement' => 'Modules/TableCellElement.php', - 'Texy\Modules\TableModule' => 'Modules/TableModule.php', - 'Texy\Modules\TypographyModule' => 'Modules/TypographyModule.php', - ], $old2new = [ + static $old2new = [ 'Texy' => 'Texy\Texy', 'TexyConfigurator' => 'Texy\Configurator', 'TexyHtml' => 'Texy\HtmlElement', @@ -59,9 +25,7 @@ 'TexyLongWordsModule' => 'Texy\Modules\LongWordsModule', 'TexyTypographyModule' => 'Texy\Modules\TypographyModule', ]; - if (isset($map[$class])) { - require __DIR__ . '/Texy/' . $map[$class]; - } elseif (isset($old2new[$class])) { + if (isset($old2new[$class])) { class_alias($old2new[$class], $class); } }); From 4a5ed867baf441442553d4d9271d81b15a350038 Mon Sep 17 00:00:00 2001 From: Ondrej Zizka Date: Sun, 22 Jul 2018 05:14:51 +0200 Subject: [PATCH 11/11] Message about dockerized Texy --- readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readme.md b/readme.md index b333ce2b..c0b0a204 100644 --- a/readme.md +++ b/readme.md @@ -28,3 +28,9 @@ Refer to the 'examples' directory for examples. Texy documentation is available on the homepage https://texy.info. If you like Texy, **[please make a donation now](https://nette.org/make-donation?to=texy)**. Thank you! + + +Dockerized Texy service +----------------------- + +I am not quite sure how to contact the Texy community anywhere else, so herebe I am letting you know that I created a [Docker image with Texy converter](https://hub.docker.com/r/ondrazizka/texy-service/tags/).