Skip to content

Conversation

@doylelew
Copy link

Import only fix #3296 : Cooklang markdown integration. Export and images still not yet implemented. Also does, not currently support .zip file import, but does allow for multi-file import. .zips and images are my next tasks.

Included documentation of the process of creating a new integration in the docs. Will continue to update integration documentation as I implement .zip imports, export and images.

It took a lot of experimenting and i am a little new at contributing to other people's projects, so it is a little commit heavy, sorry in advance.

Connecting the Integration

 - cookbook/forms.py
 - cookbook/views/import_export.py
 - docs/features/import_export.md
 - vue3/src/utils/integration_utils.ts

Pytest Files

 - cookbook/tests/other/test_cooklang_integration.py
 - Markdown .cook files to test
      - cookbook/tests/other/test_data/Cooklang/American Pancakes.cook
      - cookbook/tests/other/test_data/Cooklang/Another Lemon Blueberry Bread.cook
      - cookbook/tests/other/test_data/Cooklang/Butter Swirl Shortbread Cookies.cook

Integration Files

 - cookbook/helper/cooklang_parser.py
      - I mostly completely rebuilt the parser from https://github.com/luizribeiro/py-cooklang/blob/main/cooklang.py
      - Felt neater to have this large parser separate from  the integration logic
 - cookbook/integration/cooklang.py
      - Implemented .cook file importing
      - Commented the scaffolding for the exporter and zip import functions I will eventually implement
 - cookbook/integration/integration.py
      - Cookland .cook files traditionally use their file names as the recipe name. I added the .name property into the the ByteIO object that the Integration.do_import passes to the get_recipe_from_file so that the filename can be preserved in the handoff. This should not effect implementations that already exist and do not use the .name property.

General Helper Functions

 - cookbook/helper/HelperFunctions.py
      - Implemented a fuzzy matching method for metadata matching between integrations
 - requirements.txt
      - fuzzymatching required pip package thefuzz

Documentation

 - docs/contribute/contribute.md
      - Added a link to the new Feature Guide page I added
 - docs/contribute/feature_contrib/featureguides.md
      - Created a page that could document how to contribute to certain features
 - docs/contribute/feature_contrib/Integration.md
     - The first addition to the feature-guide page I documented everything that needs to be done to create an import Integration so future contributors can start up easier.
 - docs/contribute/installation.md
      - Probably didn't belong in this pull, but the info was important to creating a testing docker environment so I included it. It gives instructions for how to install and update yarn before you build the container from source.

@vabene1111
Copy link
Collaborator

thank you.

I am extremly busy IRL right now so I will leave this open until you implement the images. If you cant get them to work just let me know then I will review this without them and get it merged once time clears up next year.

@doylelew
Copy link
Author

Sounds good. I will work on that, happy holidays and new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import/Export support for Cooklang

2 participants