]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6188 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 21 Sep 2023 09:26:03 +0000 (11:26 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 21 Sep 2023 09:26:03 +0000 (11:26 +0200)
app/Fluidbook/SEO/Document.php
app/Models/FluidbookDocument.php
app/Models/FluidbookPublication.php

index 112d128fe9fa9d485ef0e961b249c858fb8bfb0d..a01c6738661a10a684ef940a147dfaf600f4186b 100644 (file)
@@ -118,7 +118,7 @@ class Document
 
     public function getTextContent($page)
     {
-        $f = $this->compiler->getFluidbook()->getTextFile($page, FluidbookDocument::TEXT_HTML);
+        $f = $this->compiler->getFluidbook()->getTextFile($page, FluidbookDocument::TEXT_HTML, 'standard');
         $res = trim(file_get_contents($f));
 
         if (!str_starts_with($res, '<div>')) {
index e013927e217bf57b4a3218716c015cd9ea430ce3..3641374f80a29d872dec045771d05ae12f876ba3 100644 (file)
@@ -406,6 +406,10 @@ class FluidbookDocument extends ToolboxModel
             $sepFolder = 'sep_' . md5($ignoreSeparators) . '/';
         }
 
+        if ($mode === 'robust') {
+            $extractionMethod = 'fluidbook';
+        }
+
         $prefix = self::_getTextFilePrefix($extractionMethod);
         $dir = $mode !== 'standard' ? $mode . '/' : '';
         return $this->path('texts/' . $dir . $sepFolder) . $prefix . $type . $page . '.txt';
index aff48a0849220f97f172b055ae5403a878f7b270..3da16f38d9f2e5d45cfde370435c8bc634a0415c 100644 (file)
@@ -396,10 +396,10 @@ class FluidbookPublication extends ToolboxSettingsModel
         return self::$_docs[$documentID];
     }
 
-    public function getTextFile($page, $type = FluidbookDocument::TEXT_PLAIN)
+    public function getTextFile($page, $type = FluidbookDocument::TEXT_PLAIN, $mode = null)
     {
         $compo = $this->getComposition()[$page];
-        return self::_getDocument($compo[0])->getTextFile($compo[1], $type, $this->search_mode ?: 'standard', $this->textExtraction, $this->ignoreSearchSeparators);
+        return self::_getDocument($compo[0])->getTextFile($compo[1], $type, $mode ?? $this->search_mode ?: 'standard', $this->textExtraction, $this->ignoreSearchSeparators);
     }
 
     public function getHightlightFile($page)
@@ -436,7 +436,7 @@ class FluidbookPublication extends ToolboxSettingsModel
                 try {
                     return Farm::getFileFromPDF($thumbpdf, $page, $format, $resolution, $this->JPEGQuality, $withText, $withGraphics, $version, null, $force, 1);
                 } catch (\Exception $e) {
-                    throw new \Exception('Unable to generate thumbnails file from custom PDF "' . $this->pdfThumbnails . '" (original message : ' . $e->getMessage().')');
+                    throw new \Exception('Unable to generate thumbnails file from custom PDF "' . $this->pdfThumbnails . '" (original message : ' . $e->getMessage() . ')');
                 }
             } else {
             }