Skip to content

Commit

Permalink
- FIX: opraveny tabulky v TexyLongWordsModule & TexyQuickCorrectModule
Browse files Browse the repository at this point in the history
- FIX: oprava TexyFormatterModule (chybějící mezery v HTML blocks)
- CHG: zobrazují se HTML komentáře
  • Loading branch information
dg committed Feb 13, 2007
1 parent 98f7f15 commit c7f032c
Show file tree
Hide file tree
Showing 6 changed files with 835 additions and 59 deletions.
825 changes: 797 additions & 28 deletions texy.compact/texy-compact.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion texy/libs/dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public function parse($text)
public function toHtml()
{
$html = parent::toHtml();
$wf = new TexyWellForm();
$wf = new TexyHtmlWellForm();
$html = $wf->process($html);
$html = Texy::unfreezeSpaces($html);
$html = TexyHtml::checkEntities($html);
Expand Down
2 changes: 1 addition & 1 deletion texy/modules/formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function postProcess($text)
);

// remove \n
$text = str_replace("\n", '', $text);
$text = str_replace("\n", ' ', $text);

// shrink multiple spaces
$text = preg_replace('# +#', ' ', $text);
Expand Down
35 changes: 17 additions & 18 deletions texy/modules/long-words.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,30 @@ private function _replace($matches)
// little trick - isset($array[$item]) is much faster than in_array($item, $array)
$consonants = array_flip(array(
'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z',
'B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z',
'è','ï','ò','ø','š','','ý','ž', //czech windows-1250
'È','Ï','Ò','Ø','Š','','Ý','Ž',
'č','ď','ň','ř','š','ť','ý','ž', //czech utf-8
'Č','Ď','Ň','Ř','Š','Ť','Ý','Ž'));
'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z',
'B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Z',
"\xe8","\xef","\xf2","\xf8","\x9a","\x9d","\x9e", //czech windows-1250
"\xc8","\xcf","\xd2","\xd8","\x8a","\x8d","\x8e",
"\xc4\x8d","\xc4\x8f","\xc5\x88","\xc5\x99","\xc5\xa1","\xc5\xa5","\xc5\xbe", //czech utf-8
"\xc4\x8c","\xc4\x8e","\xc5\x87","\xc5\x98","\xc5\xa0","\xc5\xa4","\xc5\xbd"));

$vowels = array_flip(array(
'a','e','i','o','y','u',
'A','E','I','O','Y','U',
'á','é','ì','í','ó','ý','ú','ù', //czech windows-1250
'Á','É','Ì','Í','Ó','Ý','Ú','Ù',
'á','é','ě','í','ó','ý','ú','ů', //czech utf-8
'Á','É','Ě','Í','Ó','Ý','Ú','Ů'));
'a','e','i','o','u','y',
'A','E','I','O','U','Y',
"\xe1","\xe9","\xec","\xed","\xf3","\xfa","\xf9","\xfd", //czech windows-1250
"\xc1","\xc9","\xcc","\xcd","\xd3","\xda","\xd9","\xdd",
"\xc3\xa1","\xc3\xa9","\xc4\x9b","\xc3\xad","\xc3\xb3","\xc3\xba","\xc5\xaf","\xc3\xbd", //czech utf-8
"\xc3\x81","\xc3\x89","\xc4\x9a","\xc3\x8d","\xc3\x93","\xc3\x9a","\xc5\xae","\xc3\x9d"));

$before_r = array_flip(array(
'b','B','c','C','d','D','f','F','g','G','k','K','p','P','r','R','t','T','v','V',
'è','È','ï','Ï','ø','Ø','','', //czech windows-1250
'č','ÄŒ','ď','ÄŽ','Åt','Å_','Å¥','Ť', //czech utf-8
));
"\xe8","\xc8","\xef","\xcf","\xf8","\xd8","\x9d","\x8d", //czech windows-1250
"\xc4\x8d","\xc4\x8c","\xc4\x8f","\xc4\x8e","\xc5\x99","\xc5\x98","\xc5\xa5","\xc5\xa4"));

$before_l = array_flip(array(
'b','B','c','C','d','D','f','F','g','G','k','K','l','L','p','P','t','T','v','V',
'è','È','ï','Ï','','', //czech windows-1250
'č','Č','ď','Ď','ť','Ť', //czech utf-8
));
"\xe8","\xc8","\xef","\xcf","\x9d","\x8d", //czech windows-1250
"\xc4\x8d","\xc4\x8c","\xc4\x8f","\xc4\x8e","\xc5\xa5","\xc5\xa4")); //czech utf-8

$before_h = array_flip(array('c', 'C', 's', 'S'));

Expand Down
26 changes: 17 additions & 9 deletions texy/modules/quick-correct.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@
*/
class TexyQuickCorrectModule extends TexyModule
{
// options
public $doubleQuotes = array('„', '“'); // left & right double quote („ “)
public $singleQuotes = array('‚', '‘'); // left & right single quote (‚ ‘)
public $dash = '–'; // dash (–)
// @see http://www.unicode.org/cldr/data/charts/by_type/misc.delimiters.html

// Czech Republic
public $doubleQuotes = array('„', '“'); // left & right double quote
public $singleQuotes = array('‚', '‘'); // left & right single quote

/*
// UK
public $doubleQuotes = array('“', '”'); // left & right double quote
public $singleQuotes = array('‘', '’'); // left & right single quote
*/

private $from, $to;

Expand All @@ -49,16 +56,17 @@ public function init()
=> $this->singleQuotes[0].'$1'.$this->singleQuotes[1],

'#(\S|^) ?\.{3}#m' => '$1…', // ellipsis ...
'#(\d| )-(\d| )#' => "\$1$this->dash\$2", // en dash -
'#,-#' => ",$this->dash", // en dash ,-
'#(\d| )-(\d| )#' => "\$1–\$2", // en dash -
'#,-#' => ",–", // en dash ,-
'#(?<!\d)(\d{1,2}\.) (\d{1,2}\.) (\d\d)#' => '$1&#160;$2&#160;$3', // date 23. 1. 1978
'#(?<!\d)(\d{1,2}\.) (\d{1,2}\.)#' => '$1&#160;$2', // date 23. 1.
'# -- #' => " $this->dash ", // en dash --
'# --- #' => " &#8212; ", // em dash ---
'# -- #' => " &#8211; ", // en dash --
'# -&gt; #' => ' &#8594; ', // right arrow ->
'# &lt;- #' => ' &#8592; ', // left arrow ->
'# &lt;-&gt; #' => ' &#8596; ', // left right arrow <->
'#(\d+) ?x ?(\d+) ?x ?(\d+)#' => '$1&#215;$2&#215;$3', // dimension sign x
'#(\d+) ?x ?(\d+)#' => '$1&#215;$2', // dimension sign x
'#(\d+)( ?)x\\2(\d+)\\2x\\2(\d+)#' => '$1&#215;$3&#215;$4', // dimension sign x
'#(\d+)( ?)x\\2(\d+)#' => '$1&#215;$3', // dimension sign x
'#(?<=\d)x(?= |,|.|$)#m' => '&#215;', // 10x
'#(\S ?)\(TM\)#i' => '$1&#8482;', // trademark (TM)
'#(\S ?)\(R\)#i' => '$1&#174;', // registered (R)
Expand Down
4 changes: 2 additions & 2 deletions texy/texy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
* @license GNU GENERAL PUBLIC LICENSE v2
* @package Texy
* @category Text
* @version 1.2 for PHP5 ONLY $Revision$ $Date$
* @version 1.2a for PHP5 ONLY $Revision$ $Date$
*/


if (version_compare(PHP_VERSION , '5.0.0', '<'))
die('Texy!: too old version of PHP!');

define('TEXY', 'Version 1.2 for PHP5 $Revision$');
define('TEXY', 'Version 1.2a for PHP5 $Revision$');

/**
* Absolute filesystem path to the Texy package
Expand Down

0 comments on commit c7f032c

Please sign in to comment.