dschmidt opened a new pull request, #3044:
URL: https://github.com/apache/tika/pull/3044

   Adds detection and parsing support for the GeoGebra file formats.
   
   Issue: https://issues.apache.org/jira/browse/TIKA-4831
   
   ## Detection
   
   - `application/vnd.geogebra.file` (`*.ggb`) and 
`application/vnd.geogebra.tool` (`*.ggt`) are now `sub-class-of 
application/zip`, so the filename hint survives magic detection instead of 
being discarded in favor of plain `application/zip`
   - new mime types: `application/vnd.geogebra.slides` (`*.ggs`, zip-based) and 
`application/vnd.geogebra.pinboard` (`*.ggp`, JSON-based)
   - a new `GeoGebraDetector` (zip container detector, ZipFile and streaming 
mode) recognizes the formats without a filename by their well-known entries: 
`geogebra.xml` (worksheet), `structure.json` + `_slideN/geogebra.xml` 
(Notes/Slides), `geogebra_macro.xml` (tool). Since a worksheet with macros 
contains both `geogebra.xml` and `geogebra_macro.xml`, the decision is made 
after all entry names have been seen
   - `ZipParser.ZIP_SPECIALIZATIONS` is kept in sync with the new registry 
entries
   
   ## Parser
   
   A new `GeoGebraParser` (miscoffice module) for `ggb`/`ggs`/`ggt`:
   
   - metadata: construction title/author/date become 
`dc:title`/`dc:creator`/`geogebra:date`, plus `geogebra:appName`, 
`geogebra:appVersion`, `geogebra:formatVersion`, `geogebra:id`; Notes/Slides 
set `xmpTPg:NPages`
   - content: user-visible text as XHTML paragraphs - string-literal expression 
elements of text objects, rich-text content runs (JSON), element captions, 
macro names and help texts; Notes/Slides emit one div per slide in 
`structure.json` order
   - the representative rendering (`geogebra_thumbnail.png` at the root, or the 
first slide's thumbnail) is emitted as an embedded document marked 
`embeddedResourceType=THUMBNAIL`, following the existing convention in the 
OOXML, ODF and iWork parsers, so `/unpack/all` sidecars identify the preview 
image; other slides' thumbnails are redundant renderings and are skipped
   - any other embedded file (e.g. inserted pictures) is emitted as an embedded 
document
   
   XML is parsed through `XMLReaderUtils.parseSAX` like the other parsers in 
the module; `structure.json` and rich-text runs use Jackson (new 
`jackson-databind` dependency in the miscoffice module, version managed by the 
existing BOM import).
   
   ## Testing
   
   - new unit tests: `GeoGebraDetectionTest` (zip-commons) and 
`GeoGebraParserTest` (miscoffice) with crafted `ggb`/`ggs`/`ggt` fixtures; the 
ggs fixture deliberately orders `_slide1` before `_slide0` in `structure.json` 
to pin the ordering behavior
   - full test suites of `tika-core`, `tika-parser-zip-commons`, 
`tika-parser-miscoffice-module` and `tika-parser-pkg-module` pass, plus 
`CompositeZipContainerDetectorTest` in the integration tests
   - verified end-to-end against a real-world GeoGebra Notes file: detected as 
`vnd.geogebra.slides`, text extracted, thumbnail emitted with the `THUMBNAIL` 
marker


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to