Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Extraction/Markdown/MarkdownExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ public static function extractContent(array $positionedTextElements, Page $page)
}

$previousTextElementOnLine = null;
$previousFontOnLine = null;
$previousTextElementEndsWithSpace = false;
foreach ($positionedTextElementsForLine as $positionedTextElement) {
$elementText = $positionedTextElement->getText($page);
$font = $positionedTextElement->getFont($page);
if ($elementText === '') {
$previousTextElementOnLine = $positionedTextElement;
$previousFontOnLine = $font;
continue;
}

$font = $positionedTextElement->getFont($page);
$currentHeadingLevel = $font->getHeadingLevel($positionedTextElement->textState, $positionedTextElement->absoluteMatrix);
if ($previousHeadingLevel !== $currentHeadingLevel) {
self::flushInLineNodes($inLineNodes, $textBuffer, $previousElementIsBold, $previousElementIsItalic);
Expand All @@ -61,10 +63,10 @@ public static function extractContent(array $positionedTextElements, Page $page)
self::flushInLineNodes($inLineNodes, $textBuffer, $previousElementIsBold, $previousElementIsItalic);
}

if ($previousTextElementOnLine !== null) {
if ($previousTextElementOnLine !== null && $previousFontOnLine !== null) {
$gap = $positionedTextElement->absoluteMatrix->offsetX
- $previousTextElementOnLine->absoluteMatrix->offsetX
- $previousTextElementOnLine->getAdvanceWidth($font);
- $previousTextElementOnLine->getAdvanceWidth($previousFontOnLine);

$wordBreakThreshold = $previousTextElementOnLine->textState->getFontSize()
* $previousTextElementOnLine->absoluteMatrix->scaleX
Expand All @@ -81,6 +83,7 @@ public static function extractContent(array $positionedTextElements, Page $page)
}

$previousTextElementOnLine = $positionedTextElement;
$previousFontOnLine = $font;
$previousTextElementEndsWithSpace = str_ends_with($elementText, ' ');
$previousElementIsItalic = $font->isItalic();
$previousElementIsBold = $font->isBold();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ pages:
aperiam.
Lorem ipsum dolor sit amet. Et omnis perferendis Et quisquam qui laboriosam explicabo et
natus corrupti aut repudiandae iure quo inventore itaque et odio atque. Qui necessitatibus
odit et commodi accusamusEt fuga!
odit et commodi accusamus Et fuga!
Qui distinctio praesentium sed corporis reiciendis eum
molestiae eius.
Qui aperiam aspernatur rem consectetur ullamest quod qui architecto corporis et
repellendus expedita! Ex fuga ducimus Ea ipsam et nobis architecto sed ratione deserunt et
iure sapiente qui animi Quis. Cum quod facilis eos exercitationem quam Est ullam est
galisum assumenda cum distinctio tempora qui quasi rerum et pariatur harum.
Est incidunt repellat aut iusto odit.
Et magnam incidunt eum possimus perspiciatisQuo pariatur aut perferendis laboriosam
Et magnam incidunt eum possimus perspiciatis Quo pariatur aut perferendis laboriosam
eum repellat ipsa ut debitis ipsa ut distinctio dolores! Et rerum expeditaAut ullam ad ullam
deleniti est facilis consequatur ut architecto nobis.
Non debitis expedita ea reprehenderit asperiores et voluptatem quos.
Expand All @@ -34,7 +34,7 @@ pages:
soluta nulla in culpa iure et quia recusandae? Qui veniam quia id maiores excepturiQui
dolores et officia aperiam ab sint excepturi.
Est molestias illum est dolorem praesentium cum soluta nesciunt.
Ut velit aspernatur ut earum debitisQui ullam aut quod dolorum quo molestiae magni et
Ut velit aspernatur ut earum debitis Qui ullam aut quod dolorum quo molestiae magni et
corrupti minima. Id dolor error ab dignissimos corporis Quo commodi. Et soluta doloribus
Eos quae in magnam praesentium aut accusantium laboriosam non nemo reprehenderit.
Et eveniet ducimus Ut voluptatem et porro velit id suscipit impedit! Vel culpa itaque Eos fuga
Expand All @@ -51,7 +51,7 @@ pages:

Lorem ipsum dolor sit amet. Et omnis perferendis *Et quisquam qui laboriosam explicabo et*
*natus corrupti* aut repudiandae iure quo inventore itaque et odio atque. Qui necessitatibus
odit et commodi accusamus**Et fuga**!
odit et commodi accusamus **Et fuga**!
##### **Qui distinctio praesentium sed corporis reiciendis eum**

##### **molestiae eius.**
Expand All @@ -61,7 +61,7 @@ pages:
iure sapiente qui animi Quis. Cum quod facilis eos exercitationem quam Est ullam est
galisum assumenda cum distinctio tempora qui quasi rerum et pariatur harum.
**Est incidunt repellat aut iusto odit.**
Et magnam incidunt eum possimus perspiciatis**Quo pariatur aut perferendis laboriosam**
Et magnam incidunt eum possimus perspiciatis **Quo pariatur aut perferendis laboriosam**
**eum repellat ipsa ut debitis ipsa** ut distinctio dolores! Et rerum expeditaAut ullam ad ullam
deleniti est facilis consequatur ut architecto nobis.
**Non debitis expedita ea reprehenderit asperiores et voluptatem quos.**
Expand All @@ -71,7 +71,7 @@ pages:
**soluta nulla in culpa iure** et quia recusandae? Qui veniam quia id maiores excepturiQui
dolores et officia aperiam ab sint excepturi.
**Est molestias illum est dolorem praesentium cum soluta nesciunt.**
Ut velit aspernatur ut earum debitis**Qui ullam aut quod dolorum quo molestiae magni et**
Ut velit aspernatur ut earum debitis **Qui ullam aut quod dolorum quo molestiae magni et**
**corrupti minima**. Id dolor error ab dignissimos corporis *Quo commodi*. Et soluta doloribus
Eos quae in magnam praesentium aut accusantium laboriosam non nemo reprehenderit.
Et eveniet ducimus *Ut voluptatem et porro velit id suscipit impedit*! Vel culpa itaque **Eos fuga**
Expand All @@ -89,7 +89,7 @@ pages:
● At adipisci enim id reiciendis officiis.
● Sed sapiente quia qui sint dolorem vel impedit magni.
Et dicta voluptatem sit fugit saepevel nulla et debitis iure et ipsa voluptas? Est facere harum
et inventore evenietAut rerum est molestias quam qui perspiciatis magnam.
et inventore eveniet Aut rerum est molestias quam qui perspiciatis magnam.
Qui eligendi saepe et neque autem A omnis et pariatur rerum est dolore rerum est facere
quasi. Sit dolorem quiaet veritatis rem alias deleniti. Et voluptatem laborum et impedit
atqueaut suscipit. Rem unde quos cum reprehenderit temporeQui eaque sit rerum distinctio
Expand All @@ -109,7 +109,7 @@ pages:
● At adipisci enim id reiciendis officiis.
● Sed sapiente quia qui sint dolorem vel impedit magni.
Et dicta voluptatem sit fugit saepevel nulla et debitis iure et ipsa voluptas? Est facere harum
et inventore eveniet**Aut rerum est molestias quam qui perspiciatis magnam**.
et inventore eveniet **Aut rerum est molestias quam qui perspiciatis magnam**.
Qui eligendi saepe et neque autem *A omnis et pariatur rerum est dolore rerum est facere*
*quasi*. Sit dolorem quiaet veritatis rem alias deleniti. Et voluptatem laborum et impedit
atqueaut suscipit. Rem unde quos cum reprehenderit temporeQui eaque sit rerum distinctio
Expand Down
4 changes: 2 additions & 2 deletions tests/Samples/files/issue-152/contents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pages:
HORTUS BERGERIE ROUGE 2023 75CL AOP PIC ST LOUP210B7520237,951 669,501 13CRD
HORTUS BERGERIE BLANC 2023 75CL IGP VAL DE MONTFERRAND36B7520236,80 244,801 12,5CRD
HORTUS DOMAINE GRANDE CUVEE ROUGE 2022 75CL AOP PIC SAINT LOUP24B75202213,60326,401 13CRD
HORTUS BIB LE LOUP DANS LA BERGERIE ROUGE 3L IGP PAYS D'HERAULT30B3NM 11,85355,501 13CRD
HORTUS BIB LE LOUP DANS LA BERGERIE ROUGE 3L IGP PAYS D'HERAULT30 B3NM11,85355,501 13CRD
Total :570
A Noter : seules les marchandises accompagnées d'un bon de livraison seront réceptionnées.
Merci de bien vouloir nous confirmer par retour la disponibilité, le millésime et le prix.
Expand Down Expand Up @@ -71,7 +71,7 @@ pages:
HORTUS BERGERIE ROUGE 2023 75CL AOP PIC ST LOUP210B7520237,951 669,501 13CRD
HORTUS BERGERIE BLANC 2023 75CL IGP VAL DE MONTFERRAND36B7520236,80 244,801 12,5CRD
HORTUS DOMAINE GRANDE CUVEE ROUGE 2022 75CL AOP PIC SAINT LOUP24B75202213,60326,401 13CRD
HORTUS BIB LE LOUP DANS LA BERGERIE ROUGE 3L IGP PAYS D'HERAULT30B3NM 11,85355,501 13CRD
HORTUS BIB LE LOUP DANS LA BERGERIE ROUGE 3L IGP PAYS D'HERAULT30 B3NM11,85355,501 13CRD
**Total :570**
**A Noter : seules les marchandises accompagnées d'un bon de livraison seront réceptionnées.**
**Merci de bien vouloir nous confirmer par retour la disponibilité, le millésime et le prix.**
Expand Down
8 changes: 4 additions & 4 deletions tests/Samples/files/issue-235/contents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ pages:
der Feuerwehrʻ soll die Befähigung zur Durchführung der auf Ebene einer Gemeinde oder eines Land-
kreises stattfindenden Lehrgänge vermitteln.
(8) 1Voraussetzung für die Ausbildung zur Stabsarbeit ist der Abschluss des Ausbildungslehrgangs
,Zugführerʻ. 2Die Ausbildung erfolgt in einem Ausbildungslehrgang (Ausbildungslehrgang , Einführung in
,Zugführer ʻ. 2Die Ausbildung erfolgt in einem Ausbildungslehrgang (Ausbildungslehrgang , Einführung in
die Stabsarbeitʻ). 3Der Ausbildungslehrgang , Einführung in die Stabsarbeitʻ soll die Befähigung zum
selbständigen Führen eines Sachgebietes in einer stabsmäßig arbeitenden Einsatzleitung vermitteln.
(9) 1Die Führungsausbildung wird durch das Niedersächsische Landesamt für Brand- und Katastro-
Expand Down Expand Up @@ -466,7 +466,7 @@ pages:
der Feuerwehrʻ soll die Befähigung zur Durchführung der auf Ebene einer Gemeinde oder eines Land-
kreises stattfindenden Lehrgänge vermitteln.
(8) 1Voraussetzung für die Ausbildung zur Stabsarbeit ist der Abschluss des Ausbildungslehrgangs
,Zugführerʻ. 2Die Ausbildung erfolgt in einem Ausbildungslehrgang (Ausbildungslehrgang , Einführung in
,Zugführer ʻ. 2Die Ausbildung erfolgt in einem Ausbildungslehrgang (Ausbildungslehrgang , Einführung in
die Stabsarbeitʻ). 3Der Ausbildungslehrgang , Einführung in die Stabsarbeitʻ soll die Befähigung zum
selbständigen Führen eines Sachgebietes in einer stabsmäßig arbeitenden Einsatzleitung vermitteln.
(9) 1Die Führungsausbildung wird durch das Niedersächsische Landesamt für Brand- und Katastro-
Expand Down Expand Up @@ -2584,7 +2584,7 @@ pages:
kordel
– Mützenkordel, gedreht, schwarz, Durchmesser 6 mm, an zwei silberfarbig ge-
körnten Mützensplinten oder Druckknöpfen befestigt.
Zweite Dienstgradgruppe , Brandmeisterin oder Brandmeisterʻ:
Zweite Dienstgradgruppe , Brandmeisterin oder Brandmeister ʻ:
– Mützenkordel, gedreht, silberfarbig, Durchmesser 6 mm, an zwei silberfarbig ge-
körnten Mützensplinten oder Druckknöpfen befestigt.
Dritte Dienstgradgruppe , Brandinspektorin oder Brandinspektorʻ:
Expand Down Expand Up @@ -2625,7 +2625,7 @@ pages:
kordel
– Mützenkordel, gedreht, schwarz, Durchmesser 6 mm, an zwei silberfarbig ge-
körnten Mützensplinten oder Druckknöpfen befestigt.
Zweite Dienstgradgruppe , Brandmeisterin oder Brandmeisterʻ:
Zweite Dienstgradgruppe , Brandmeisterin oder Brandmeister ʻ:
– Mützenkordel, gedreht, silberfarbig, Durchmesser 6 mm, an zwei silberfarbig ge-
körnten Mützensplinten oder Druckknöpfen befestigt.
Dritte Dienstgradgruppe , Brandinspektorin oder Brandinspektorʻ:
Expand Down
16 changes: 8 additions & 8 deletions tests/Samples/files/issue-457/contents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pages:
relevant, use Heading 3. These divisions are not
area. Only headlines may be written with Arial 10
numbered. The style for Heading 3 is Arial 10 point
point bold. The general rule is: DO NOT USE
point bold . The general rule is: DO NOT USE
italic justified to the left margin, with 3 point
OTHER FONTS. (Papers prepared on other
spacing before and after the heading. Begin typing
Expand Down Expand Up @@ -247,7 +247,7 @@ pages:
template.
the heading. Begin typing the text in the line
beneath the heading. 3 2
x + y = 56
x +y =56
(1)
2 [Conference name, place and date].
markdown: |-
Expand All @@ -258,7 +258,7 @@ pages:
relevant, use Heading 3. These divisions are not
area. Only headlines may be written with **Arial 10**
numbered. The style for Heading 3 is *Arial 10 point*
**point bold**. The general rule is: **DO NOT USE**
**point bold** . The general rule is: **DO NOT USE**
*italic* ******justified to the left margin, with 3 point
**OTHER FONTS.** (Papers prepared on other
spacing before and after the heading. Begin typing
Expand Down Expand Up @@ -341,7 +341,7 @@ pages:
template.
the heading. Begin typing the text in the line
beneath the heading. 3 2
*x* + *y* = 56
*x* +*y* =56
(1)
2 [Conference name, place and date].
images:
Expand All @@ -358,7 +358,7 @@ pages:
tables e.g., Figure 1, Figure 2, Figure 3; Table 1,
Use italics for variables (u); bold for vectors (no
Table 2, Table 3. Map 1, Map 2, Map 3 etc. Use (a),
arrows) (u); bold italic for variable vectors (u) and
arrows) ( u); bold italic for variable vectors (u) and
(b), (c) to distinguish individual subjects in a
capital bold italic (U) for variable matrices. Use ith,
composite figure. See Figures 1 and 2 for examples
Expand Down Expand Up @@ -412,7 +412,7 @@ pages:
good contrast.
When preparing figures and tables, make sure that
all lettering inside the figure is no smaller than the
specified size of the paper text, i.e., 10 point . Do
specified size of the paper text, i.e., 10 point. Do
not include any headlines in the diagrams,
graphics or tables. All headlines should be written
separately. See the examples below. Do not use
Expand All @@ -434,7 +434,7 @@ pages:
tables e.g., Figure 1, Figure 2, Figure 3; Table 1,
Use *italics* for variables (*u*); bold for vectors (no
Table 2, Table 3. Map 1, Map 2, Map 3 etc. Use (a),
arrows) (**u**); bold italic for variable vectors (***u***) and
arrows) ( **u**); bold italic for variable vectors (***u***) and
(b), (c) to distinguish individual subjects in a
capital bold italic (***U***) for variable matrices. Use *i*th,
composite figure. See Figures 1 and 2 for examples
Expand Down Expand Up @@ -488,7 +488,7 @@ pages:
good contrast.
When preparing figures and tables, make sure that
all lettering inside the figure is no smaller than the
specified size of the paper text, i.e., **10 point** . Do
specified size of the paper text, i.e., **10 point**. Do
not include any headlines in the diagrams,
graphics or tables. All headlines should be written
separately. See the examples below. Do not use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ pages:
Signal terminations are used to eliminate distortion of signals traveling over long lengths of cable. If
problems are experienced, and signal distortion is suspected, then the user should enable the input
termination of the respective 7707DT. Input terminations are easily selectable through the card edge
interface of the 7707DT, or via Vista linkTM, as described in the product manual. As a general rule,
interface of the 7707DT, or via VistalinkTM, as described in the product manual. As a general rule,
terminations are most effective when placed at the far end of a cable. If more than two devices are
connected to the same cable, as could be the case with MPK interfaces, then it is recommended that
the 7707DT be located at the far end of the longest cable segment when possible.
Expand All @@ -751,7 +751,7 @@ pages:
bias, as it places the balanced input connections in a known logic state while no device is transmitting
to them. Any direct connection between a 7707DT input and a Control Panel may require a failsafe
bias, to compensate for ambient noise, long lengths of cable, or connection to many devices. Input
failsafe bias is easily selectable through the card edge interface of the 7707DT, or via Vista linkTM, as
failsafe bias is easily selectable through the card edge interface of the 7707DT, or via VistalinkTM, as
described in the product manual. To enable failsafe bias on any channel of the 7707DT, the termination
must first be enabled.
AN6-8 Revision 1.0
Expand All @@ -768,7 +768,7 @@ pages:
Signal terminations are used to eliminate distortion of signals traveling over long lengths of cable. If
problems are experienced, and signal distortion is suspected, then the user should enable the input
termination of the respective 7707DT. Input terminations are easily selectable through the card edge
interface of the 7707DT, or via *Vista* linkTM, as described in the product manual. As a general rule,
interface of the 7707DT, or via *Vista*linkTM, as described in the product manual. As a general rule,
terminations are most effective when placed at the far end of a cable. If more than two devices are
connected to the same cable, as could be the case with MPK interfaces, then it is recommended that
the 7707DT be located at the far end of the longest cable segment when possible.
Expand All @@ -777,7 +777,7 @@ pages:
bias, as it places the balanced input connections in a known logic state while no device is transmitting
to them. Any direct connection between a 7707DT input and a Control Panel may require a failsafe
bias, to compensate for ambient noise, long lengths of cable, or connection to many devices. Input
failsafe bias is easily selectable through the card edge interface of the 7707DT, or via *Vista* linkTM, as
failsafe bias is easily selectable through the card edge interface of the 7707DT, or via *Vista*linkTM, as
described in the product manual. To enable failsafe bias on any channel of the 7707DT, the termination
must first be enabled.
**AN6-8** Revision 1.0
Expand Down
Loading
Loading