-
-
Notifications
You must be signed in to change notification settings - Fork 111
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 html text-indent option for docbuild. #1851
Conversation
I'll have a look, but it looks mostly fine. There is no particular reason why this wasn't added to HTML. The only point is that the first paragraphs after a break should not be indented, which is how the ODT version works. |
Also, for consistency, the indentation for HTML should either be a fixed as it is for ODT, or both should be settings. I think the easiest solution is to make the indentation a general text option, and use the same indentation for both formats. |
Making it a general option makes sense to me. That's why I asked the second question. And it's pretty clear to me it should be adjustable as people will need different values (eg. Chinese requires 2em, Japanese seems often use 1em). Without making things too complicated, I think something like 0.0 - 8.0 with 0.5 step should be pretty reasonable. So, put it under Format? Like adding a
Did you mean after a head? I'm no expert on typesetting English, but found this Section on MDN:
For CJK, this is often required, at least for Chinese the first paragraph is always indented. So if you want to keep the current odt behavior, maybe adding a seperate toggle only for this? Seems clearer to me than something like linking it to current lang setting hence more implicit/magical. |
Yes, under Format > Text Options. Sure, we can have a toggle for turning it on or off for the first paragraph after a break (any break, not just a heading). If you add the settings, I can push the changes to the ODT code, and maybe you can mirror it in HTML. The ODT code is not easy to follow. I recently added footnotes to it, and it took me ages to figure out how to do it, and I wrote that code! 😄 |
Also, this PR is made from your copy of the main branch directly. As described in the contributor guide, do not do that. Create a branch at your end first. Doing this from the main branch causes all sorts of problems as the main branch is what you update against from my repo when I make changes. You should create a branch from the changes you've made and make a new PR from that, and roll back your main branch to the state of the main repo's main branch. |
Cool, I will take a look at the ODT code.
Sure, I will consult the contributor guide. Let me figure out the code part first 😂 , then see how to proceed. Here is just a couple lines of PoC code, I can always close this and fork again if necessary.
Just to clarify, for breaks you mean hard/soft scene breaks as in here, right? Or you may point to the relevant code and I could probably figure it out from the ODT implementation. |
I'm just giving you a warning as I plan to make the 2.4.1 release today. When I merge that back into
I mean any break that isn't continuous paragraphs. There are many ways to format the output. If you look in the Tokenizer class, there are a bunch of "block styles" other than novelWriter/novelwriter/core/tokenizer.py Lines 90 to 102 in c05620d
In the ODT writer, I handle it with the novelWriter/novelwriter/core/toodt.py Lines 450 to 477 in c05620d
Something similar would be needed for HTML, but we also need to add a switch that forces it to always be But we can work out the details when you make a branch and a new PR. We also need to move the In any case, thanks for your contribution. I will create a task to associate with this, and we can take the implementation discussion there. |
I also see now that comments probably shouldn't trigger the non-indentation flag, so there are some more fixes to be made. I'll add a ticket for that. |
Sounds all good to me. I will close this and make a clean fork to start a new feature branch for future PR. Took a quick look at the ODT code and it's indeed pretty dense 😂 Specially for someone with no prior knowledge of OpenDocument. I like the idea starting from the HTML side first (after some basic understanding of the odt side). Let's do this then see how to tie things together. |
Just created release 2.4.1, so there should be less of a chance of merge conflicts now. There were only two actually, and they were pretty trivial. |
Just an initial PoC PR to get your opinions on.
Rationale
text-indent
for 1 or 2em is the proper typesetting spec for some languages, eg. CJK.There is already an
Indent First Line
feature for odt. I'm not sure in your opinion:Add Css Styles
?)If you like the direction, we can discuss and refine the implementation a bit if necessary, then I can add tests/i18n stuff to make this a proper PR.
Cheers,
Alex
Summary:
Related Issue(s):
Reviewer's Checklist: