-
-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add title field and metadata handling for ZIM file creation #855
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
@nicolapace Thank you for your PR! But the unity for counting is not char, but lexem. There is a javascript/typescript implementation of such a counter in openzim/mwoffliner. |
What is a lexem and how does it compare to a grapheme? I feel like I'm going to have to read a Chomsky book to implement this PR. 🙃 |
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.
This looks really good, great work!
I think the handling of the error conditions on the backend needs to be improved however.
@audiodude I meant grapheme, sorry. See link given in the issue comment. |
90a214e
to
32b3b55
Compare
@audiodude @kelson42 @benoit74 Thanks for the feedback and the suggestions! I pushed a new commit that addresses the discussed issues, in particular:
(I pushed a new commit instead of amending the last one for better clarity. We can squash them later if you prefer.) |
32b3b55
to
80d06a4
Compare
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.
Looking good, just a few small comments.
- Add split-by-grapheme npm package to handle grapheme counting accurately. - Modify ZimFile.vue to implement grapheme counting for title, description, and long description fields - Introduce new exceptions for invalid ZIM metadata: InvalidZimTitleError, InvalidZimDescriptionError, and InvalidZimLongDescriptionError. - Add regex python module to Pipfile and rebuilt Pipfile.lock - Enhance backend logic in builder.py and zimfarm.py to validate ZIM metadata against grapheme limits using regex module - Update unit tests to cover new validation rules and exceptions for ZIM metadata. - Update ZIM file creation tests to check for disabled state of the request button - Add frontend and backend validation of long description (max. length, min. length and difference to description)
907a221
to
4d30fbd
Compare
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.
Great work!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #855 +/- ##
==========================================
+ Coverage 92.58% 92.63% +0.05%
==========================================
Files 66 66
Lines 3546 3573 +27
==========================================
+ Hits 3283 3310 +27
Misses 263 263 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #677
I added a
Title
field in the Zim creation page. This field is automatically filled with theSelection Title
reduced to 30 characters. In this way users can change it if they want. This field is required and is of max 30 chars. (I also added a char counter for both the title and the description).I also added backend validation for the size of zim metadata (title (30) and description (80) as per https://wiki.openzim.org/wiki/Metadata).
I added new unit test for the new "title field" and the validation, for both the backend and the frontend. I also fixed some unit tests and functions to support the new
zimtitle
field.Here is the Zim creation page with the new field: