From 525eefa9f6f8189a55a95d14e89a6bf527c05985 Mon Sep 17 00:00:00 2001 From: Matthias Lindinger Date: Thu, 31 Aug 2023 07:46:06 +0200 Subject: [PATCH] Add mapping logic for table elements --- .../model/mappings/html/HtmlMapper.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dc-model-mappings/dc-model-html-mapping/src/main/java/de/digitalcollections/model/mappings/html/HtmlMapper.java b/dc-model-mappings/dc-model-html-mapping/src/main/java/de/digitalcollections/model/mappings/html/HtmlMapper.java index 50aa100e..749a591b 100644 --- a/dc-model-mappings/dc-model-html-mapping/src/main/java/de/digitalcollections/model/mappings/html/HtmlMapper.java +++ b/dc-model-mappings/dc-model-html-mapping/src/main/java/de/digitalcollections/model/mappings/html/HtmlMapper.java @@ -6,6 +6,10 @@ import de.digitalcollections.model.text.contentblock.ContentBlockNode; import de.digitalcollections.model.text.contentblock.ListItem; import de.digitalcollections.model.text.contentblock.Mark; +import de.digitalcollections.model.text.contentblock.Table; +import de.digitalcollections.model.text.contentblock.TableCell; +import de.digitalcollections.model.text.contentblock.TableHeader; +import de.digitalcollections.model.text.contentblock.TableRow; import de.digitalcollections.model.text.contentblock.Text; import java.util.List; import org.jsoup.Jsoup; @@ -38,6 +42,14 @@ public static ContentBlock getContentBlock(Node node) { contentBlock = new BulletList(); } else if ("li".equalsIgnoreCase(tagName)) { contentBlock = new ListItem(); + } else if ("table".equalsIgnoreCase(tagName)) { + contentBlock = new Table(); + } else if ("tr".equalsIgnoreCase(tagName)) { + contentBlock = new TableRow(); + } else if ("th".equalsIgnoreCase(tagName)) { + contentBlock = new TableHeader(); + } else if ("th".equalsIgnoreCase(tagName)) { + contentBlock = new TableCell(); } else if ("a".equalsIgnoreCase(tagName)) { // TODO only simple plain text links are supported until now; dive into nodes of a-element // for further linked content