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

Reconsidering Document Export #197

Closed
vkbo opened this issue May 8, 2020 · 3 comments
Closed

Reconsidering Document Export #197

vkbo opened this issue May 8, 2020 · 3 comments
Assignees
Labels
enhancement Request: New feature or improvement
Milestone

Comments

@vkbo
Copy link
Owner

vkbo commented May 8, 2020

I am reconsidering the Export tool currently implemented in novelWriter. Qt5 actually has a decent tool already for generating various file outputs, including Plain Text, Open Document ODF, HTML and Markdown through the standard QTextDocumentWriter class, as well as printing to physical printer and to PDF from the QPrinter object.

Both of these pathways are available through the QTextEdit that is currently used for the main editing window. but I will probably not apply these tools directly to the main editor.

What it Will Look Like

What I propose is a "Compile Novel" feature that either is another tab in the main view, or a dialog modal tool. I tend towards the former, as it is consistent with the current layout, though it's dependant on resource overhead since all tabs are built even if they're not used.

In either case, the functionality in the Export tool will be ported over to the new tool, and also have the item selection list I never got around to implement there. That is, a treeview of the project structure with a checkbox column to include/exclude single documents.

The tool will have the controls on the left, and on the right a black on white non-editable rich text document which can be built on the fly and scrolled through, with proper page size & separation and such. There will then be a button for saving to various formats, or printing it.

Consequences

This will effectively mean that I will drop support for Pandoc exports, and in the process, we will also lose LaTeX export. However, since we will have HTML and Markdown export, Pandoc can still be used independently for further conversions.

The current export feature is a bit daunting to maintain. It is better to pass the handling of formats and non-English character issues to libraries and tools that already have the ability to handle these. I am also not a big fan of Pandoc as it produces fairly ugly results and strips a lot of formatting. The Qt export path should produce better results considering this is text only documents.

Additional Benefits

The main benefit, aside from the extra features already mentioned, a number of package dependencies can be dropped. That is, at present, the pypandoc and latexcodec packages. I am also considering replacing the lxml package with Qt's own XML parser, which will effectively make novelWriter fully free of dependencies aside from the PyQt5 bundle.

@vkbo vkbo added the enhancement Request: New feature or improvement label May 8, 2020
@vkbo vkbo added this to the Version 1.0 Release milestone May 8, 2020
@vkbo vkbo self-assigned this May 8, 2020
@vkbo
Copy link
Owner Author

vkbo commented May 11, 2020

I've started writing the new export tool. It currently lives in the branch compile_novel.

In the process, I've extended the novelWriter doc to HTML converter quite a bit, and added a number of formatting and selection options. For instance, you can no export in "Outline Mode", which will export headings in a descriptive format, and the Synopsis comment of each heading. The body text is not exported.

Experience So Far

  • The export to Open Document isn't very satisfying in that Qt doesn't preserve headings for some reason. Otherwise it looks fine. It preserves more formatting than Pandoc did.
  • The export to Markdown isn't working on my computer. I suspect it's due to my dev PC running on Qt 5.12, and I think I saw somewhere this was implemented in Qt 5.14 or something like that.
  • The Qt HTML export is really messy, although not as bad as MS Word HTML. Still, I was expecting this, so I also added an option to export "Clean HTML" which is the HTML generated by novelWriter. It is what's used for the document viewer window.
  • I haven't implemented printing yet, so don't know how that's working. It's next on my list.

Screenshot

The tool currently looks like this:

image

Tagging: @johnblommers and @Number042 for feedback, if you have the time.

@vkbo
Copy link
Owner Author

vkbo commented May 12, 2020

Since the changes I want to make for version 0.6 are relatively big, I am merging them into an off-master branch until they're ready for release. If you want to test the new export tool, checkout the dev_0.6 branch.

Printing should now be working, and I've dropped the "Outline Mode" switch in favour of an "Exclude body text" option instead, which gives the user the freedom to assemble the Outline as they wish.

I've noticed that the Qt widget I use to preview the document, and from which I run the print job, strips page breaks. So even though page breaks are added before chapters, they aren't printed. The best way, currently, to get those page breaks is to save as html, and print from the browser. The browser does not strip the page breaks.

I haven't decided yet how to solve this. Either I implement the QWebEngine as the widget for displaying the preview, and print from that, or I make my own print preview dialog and assemble the document myself from the individual document files in the project.

@vkbo
Copy link
Owner Author

vkbo commented May 21, 2020

I've merged these changes to master, but not yet released them. Will release 0.6 within a few days.

@vkbo vkbo closed this as completed May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request: New feature or improvement
Projects
None yet
Development

No branches or pull requests

1 participant