Skip to content
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

Add support for handling description and long_description #110

Closed
benoit74 opened this issue Aug 14, 2023 · 3 comments · Fixed by #111
Closed

Add support for handling description and long_description #110

benoit74 opened this issue Aug 14, 2023 · 3 comments · Fixed by #111
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@benoit74
Copy link
Collaborator

The following logic could be shared among Python scrapers for handling description and long_description length and the distinction between user-provided and default values:

  • three parameters are provided to the function:
    • a default description (typically retrieved online from some metadata)
    • an optional user-defined description (typically a CLI arg)
    • an optional user-defined long_description (typically a CLI arg)
  • the function returns:
    • a description
    • an optional long_description
  • if set, the two user-defined values are checked to not exceed ZIM maximum length ; an error is thrown otherwise ; if ok, they are returned
  • if user-defined description is not set, it is computed based on the default description (truncated if needed)
  • if user-defined long_description is not set and default description has been truncated (because it was too long for the description field), the long_description is computed based on the default description (truncated if needed), otherwise it is not set

Code is almost already ready in kolibri

@rgaudin
Copy link
Member

rgaudin commented Aug 14, 2023

Where would this land in the API?

@benoit74
Copy link
Collaborator Author

In a function named compute_descriptions in src/zimscraperlib/inputs.py?

@rgaudin
Copy link
Member

rgaudin commented Aug 14, 2023

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants