From 1e581ff6d8f13e3e7c58a3a77e3d6d124fb17960 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 9 Jul 2012 09:36:17 +0000 Subject: [PATCH] --- .../fwstk/nbproject/private/config.properties | 2 +- .../tools/fwstk/nbproject/private/private.xml | 4 ++++ .../tools/fwstk/src/cube/util/StringUtil.java | 14 +++++++++++-- inc/ws/DAO/class.ws.dao.book.php | 16 +++++++------- inc/ws/Util/html5/class.ws.html5.compiler.php | 21 ++++++++++++++++++- 5 files changed, 45 insertions(+), 12 deletions(-) diff --git a/fluidbook/tools/fwstk/nbproject/private/config.properties b/fluidbook/tools/fwstk/nbproject/private/config.properties index 5aa2fea7b..9d6df0f95 100644 --- a/fluidbook/tools/fwstk/nbproject/private/config.properties +++ b/fluidbook/tools/fwstk/nbproject/private/config.properties @@ -1 +1 @@ -config=Extract_Links +config=Extract_texts diff --git a/fluidbook/tools/fwstk/nbproject/private/private.xml b/fluidbook/tools/fwstk/nbproject/private/private.xml index 1ee292a27..621169c0d 100644 --- a/fluidbook/tools/fwstk/nbproject/private/private.xml +++ b/fluidbook/tools/fwstk/nbproject/private/private.xml @@ -3,5 +3,9 @@ file:/H:/Works/cubeExtranet/fluidbook/tools/fwstk/src/com/fluidbook/fwstk/Main.java + file:/H:/Works/cubeExtranet/fluidbook/tools/fwstk/src/com/fluidbook/fwstk/TextsThread.java + file:/H:/Works/cubeExtranet/fluidbook/tools/fwstk/src/com/fluidbook/fwstk/CustomStripper.java + file:/H:/Works/cubeExtranet/fluidbook/tools/fwstk/src/cube/util/StringUtil.java + file:/H:/Works/cubeExtranet/fluidbook/tools/fwstk/nbproject/build-impl.xml diff --git a/fluidbook/tools/fwstk/src/cube/util/StringUtil.java b/fluidbook/tools/fwstk/src/cube/util/StringUtil.java index f02fb0a6c..6438d20ad 100644 --- a/fluidbook/tools/fwstk/src/cube/util/StringUtil.java +++ b/fluidbook/tools/fwstk/src/cube/util/StringUtil.java @@ -42,9 +42,19 @@ public class StringUtil { ignore = "&&[^" + ig + "]"; } - return in.replaceAll( - "[\\x21-\\x2f\\x3a-\\x3f\\x5b-\\x5f\\x7b-\\xa0\\xaa-\\xbf’" + ignore + "]", + String res = in.replaceAll( + "[\\u2000-\\u20ff\\x21-\\x2f\\x3a-\\x3f\\x5b-\\x5f\\x7b-\\xa0\\xaa-\\xbf’" + ignore + "]", " "); + + return res; + } + + public static String normalizeWhite(String in){ + String res = in.replaceAll( + "[\\u2000-\\u20ff]", + " "); + + return res; } public static String removeControl(String in) { diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index f6a378db5..d02170c33 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -765,22 +765,22 @@ class wsDAOBook extends commonDAO { } if (!isset($index[$woa])) { - $index[$woa] = array('total' => 0, 'words' => array()); + $index[$woa] = array('t' => 0, 'w' => array()); } - $index[$woa]['total'] += $total; + $index[$woa]['t'] += $total; $words = explode("\t", $wordslist); foreach ($words as $word) { list($wordwa, $count) = explode('$', $word, 2); - if (!isset($index[$woa]['words'][$wordwa])) { - $index[$woa]['words'][$wordwa] = array('total' => 0, 'pages' => array()); + if (!isset($index[$woa]['w'][$wordwa])) { + $index[$woa]['w'][$wordwa] = array('t' => 0, 'p' => array()); } - if (!isset($index[$woa]['words'][$wordwa]['pages'][$page])) { - $index[$woa]['words'][$wordwa]['pages'][$page] = 0; + if (!isset($index[$woa]['w'][$wordwa]['p'][$page])) { + $index[$woa]['w'][$wordwa]['p'][$page] = 0; } - $index[$woa]['words'][$wordwa]['total'] += $count; - $index[$woa]['words'][$wordwa]['pages'][$page] += $count; + $index[$woa]['w'][$wordwa]['t'] += $count; + $index[$woa]['w'][$wordwa]['p'][$page] += $count; } } } diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 7b4b2cbd4..6ef0672d8 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -54,12 +54,22 @@ class wsHTML5Compiler { protected $fontDocs = array(); protected $dir; protected $vdir; + + /** + * + * @var wsBook + */ protected $book; protected $pages; protected $theme; protected $version; protected $book_id; protected $themeRoot; + + /** + * + * @var wsDAOBook + */ protected $daoBook; protected $needToRecompileContents = true; protected $needToRecompileSettings = true; @@ -86,7 +96,7 @@ class wsHTML5Compiler { if ($version == 'stable') { $this->assets = WS_COMPILE_ASSETS . '/_html5prod'; - wsMaintenance::updateHTML5Sources(array(),false); + wsMaintenance::updateHTML5Sources(array(), false); } else { $this->assets = WS_COMPILE_ASSETS . '/_html5'; } @@ -192,6 +202,7 @@ class wsHTML5Compiler { $this->writeLangs(); $this->writeIndex($numCSS); $this->writeJs(); + $this->writeTexts(); $this->writeCache(); } @@ -454,6 +465,14 @@ class wsHTML5Compiler { file_put_contents($this->vdir . '/data/datas.js', $config); } + public function writeTexts() { + $this->daoBook->makeTextsIndexes($this->book, $this->pages, $index, $textes); + $js = 'var INDEX=' . $index . ';' . "\r"; + $js .= 'var TEXTS=' . $textes . ';' . "\r"; + + file_put_contents($this->vdir . '/data/search.js', $js); + } + protected function writeConfig() { $this->config->numerotation = explode(',', $this->book->numerotation); -- 2.39.5