-
Notifications
You must be signed in to change notification settings - Fork 2
Added function to export JSON and extract Metadata #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces two new features for the ElpParser library: exporting parsed data to JSON and retrieving a detailed metadata tree.
- Adds the exportJson() method to output JSON data (either as a string or directly to a file)
- Introduces the getMetadata() method to provide a rich metadata structure including Package, Dublin Core, LOM, and LOM-ES information
- Updates tests and documentation (README.md, docs/index.md, docs/api.md) to cover and explain the new features
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/ElpParserTest.php | Added unit tests verifying the functionality of exportJson() and getMetadata() |
| tests/Fixtures/04_La_Ilustracion.json | New fixture for exported JSON data; includes a placeholder for cloze_text in a ClozeIdevice entry |
| tests/Fixtures/04_La_Ilustracion.expected.json | Added expected JSON structure for testing exportJson() |
| src/ElpParser.php | New methods exportJson() and getMetadata() added along with associated helper functions |
| docs/index.md, docs/api.md, README.md | Updated documents to include usage examples and API details for the new methods |
| // ToDo | ||
| ] |
Copilot
AI
Jun 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment is present inside the JSON array for 'cloze_text', which is not valid JSON syntax. Either remove the comment or replace it with valid JSON content (for example, an empty array) to ensure the fixture file is parseable.
| // ToDo | |
| ] | |
| ] |
This PR adds two key features to the
ElpParserlibrary:Export to JSON:
The new
exportJson()method allows saving parsed ELP data as a JSON file. It supports optional file paths and handles errors on encoding or write failure.Metadata Tree Retrieval:
The new
getMetadata()method returns a detailed metadata tree including Dublin Core, LOM, LOM-ES, and page structure.Docs
README.mdanddocs/index.mdnow include usage examples and updated feature lists.docs/api.mdincludes details on the new methods.Tests
04_La_Ilustracion.*).exportJson()andgetMetadata().Utilities
remove_accentsandseems_utf8helper functions for better metadata handling.