[ 
https://issues.apache.org/jira/browse/TIKA-4831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18108691#comment-18108691
 ] 

ASF GitHub Bot commented on TIKA-4831:
--------------------------------------

dschmidt commented on PR #3044:
URL: https://github.com/apache/tika/pull/3044#issuecomment-5435913683

   Thanks, that was a genuinely useful pass. I've gone through all of it.
   
   The two things worth calling out: the metadata keys are now kebab-cased 
(`geogebra:app-name` etc., the verbatim attribute names like `toolName` stay), 
and the component is explicitly named `geogebra-parser`. Both change public 
surface, so shout if you'd rather have something else before 4.1.0.
   
   On the parser, the real bugs were the macro XML overwriting the worksheet 
metadata and the text expressions dropping anything that wasn't a single 
literal. Both fixed; for the latter I checked GeoGebra's source and strings are 
written between plain quotes with no escaping at all, so the `\"` handling was 
simply wrong and is gone. The rest follows the module conventions now: 
unreadable or malformed parts are recorded and skipped instead of aborting, 
`structure.json` only orders the slides that actually exist, the script is a 
MACRO, pictures are INLINE with their page number, and the detector uses 
`getEntry()` lookups and sits at the end of the SPI file.
   
   One thing I left alone: `ZipFileHelper.open` failing still throws, same as 
OpenDocumentParser next door. A non-zip named .ggb isn't detected as GeoGebra 
anyway, so it only bites when the parser is called directly.
   
   Streaming detection is now covered by TestContainerAwareDetector. The 
fixtures are still synthetic though; I'm trying to get hold of a real GeoGebra 
file with a suitable licence and will add it when I have one.
   
   CHANGES is rewritten along your suggestion. The smaller items (bounded JSON 
reads, thumbnail fallback, leading zeros in slide ids, the hygiene list) are 
all in, each with a test.
   




> Add content-based detection and a parser for GeoGebra files (ggb, ggs, ggt)
> ---------------------------------------------------------------------------
>
>                 Key: TIKA-4831
>                 URL: https://issues.apache.org/jira/browse/TIKA-4831
>             Project: Tika
>          Issue Type: New Feature
>            Reporter: Dominik Schmidt
>            Priority: Major
>
> GeoGebra files are currently only recognized by file extension. The mime
> registry has glob-only entries for {{application/vnd.geogebra.file}} 
> ({{*.ggb}})
> and {{application/vnd.geogebra.tool}} ({{*.ggt}}), but both formats are zip
> containers and the entries are not declared as sub-classes of
> {{application/zip}}. As a result, as soon as content is available, magic
> detection returns {{application/zip}} and the filename hint is discarded in
> {{MimeTypes.applyHint()}} - even when the resource name is known. Content-only
> detection (no filename) has no way to identify the formats at all, and the
> newer GeoGebra formats {{*.ggs}} (Notes/Slides) and {{*.ggp}} (Pinboard) are
> missing from the registry entirely.
> There is also no parser for any of the GeoGebra formats: files fall through to
> the generic {{PackageParser}}, which extracts the zip entries but produces no
> document metadata and no usable text (the {{geogebra.xml}} construction is
> emitted as raw XML through the XML parser).
> Proposed improvement:
> * mime registry: declare {{application/vnd.geogebra.file}} and
>   {{application/vnd.geogebra.tool}} as {{sub-class-of application/zip}}; add
>   {{application/vnd.geogebra.slides}} ({{*.ggs}}, zip-based) and
>   {{application/vnd.geogebra.pinboard}} ({{*.ggp}}, JSON-based)
> * a {{ZipContainerDetector}} that identifies the formats without a filename by
>   their well-known entries: {{geogebra.xml}} (worksheet), {{structure.json}}
>   plus {{_slideN/geogebra.xml}} (Notes/Slides), {{geogebra_macro.xml}} (tool);
>   a worksheet with macros contains both {{geogebra.xml}} and
>   {{geogebra_macro.xml}}, so the decision must be made after all entry names
>   have been seen
> * a {{GeoGebraParser}} for ggb/ggs/ggt that extracts the construction metadata
>   (title, author, date) and application name/version, emits the user-visible
>   text (text objects, rich-text notes, captions, macro names/help) as XHTML,
>   and emits the embedded {{geogebra_thumbnail.png}} (root, or the first 
> slide's
>   for Notes/Slides) as an embedded document marked
>   {{embeddedResourceType=THUMBNAIL}}, following the existing convention in the
>   OOXML, ODF and iWork parsers, so downstream consumers of {{/unpack/all}}
>   sidecars can identify the preview image
> Use case: file sync/share servers (e.g. OpenCloud) use Tika for content
> extraction and for serving embedded preview images; with the THUMBNAIL marker
> they can select the representative preview of a GeoGebra file the same way as
> for Office documents.
> Pull request to follow.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to