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 argument --filter to converter #59

Conversation

asmundstavdahl
Copy link

Allows explicitly specifying which export filter to use, rather than relying on auto-detection.

I needed to specify "Office Open XML Text" as filter to be able to convert HTML to Docx.

@asmundstavdahl
Copy link
Author

Allows conversions where no filter can be auto-detected. E.g. no filter is auto-detected for HTML→Docx conversion, but the "Office Open XML Text" filter supports it.

Copy link
Member

@regebro regebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that this looks good!

try:
converter.main()
except RuntimeError as err:
assert "Office Open XML Text" in f"{err}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using f"{err}" here seems needlessly obscure, you should be able to just check this directly in the exception arguments, I think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also black complains so if you could run black on everything that would be great!

Allows explicit selection of which export filter to use, skipping
auto-detection based on filenames.
If the given filter is not recognized, show a list of available filters.

Refer to LibreOffice Help for an overview of available filters:
https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html
@asmundstavdahl asmundstavdahl force-pushed the 2023-01-06_add-export-filter-argument branch from 4ddf294 to b37e04b Compare January 23, 2023 09:41
@asmundstavdahl
Copy link
Author

I'm unable to see why the build step failed - any thoughts?

@regebro
Copy link
Member

regebro commented Jan 24, 2023

It errors out because it can't install version 1.1build1 of dist-info, and I have no idea why it would try to install dist-info at all. So that's all very strange.

The build job failed because an Ubuntu-packaged version of dist-info
with an invalid version tag was used.
Apparently, 1.1 does not exist. Use 1.0 instead.
Adding it to setup.cfg apparently did not work.
Add workaround in build job instead.
@asmundstavdahl
Copy link
Author

I give up on fixing the build job. I can't imagine it has anything to do with any of the changes in this PR anyway.

@regebro
Copy link
Member

regebro commented Feb 3, 2023

Yeah, that was a mess.

Fixed that and merged. Thanks!

@regebro regebro closed this Feb 3, 2023
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.

None yet

2 participants