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

Support narrator break symbols and highlight rules #1771

Closed
Tracked by #1773
tmarplatt opened this issue Mar 22, 2024 · 4 comments · Fixed by #1864
Closed
Tracked by #1773

Support narrator break symbols and highlight rules #1771

tmarplatt opened this issue Mar 22, 2024 · 4 comments · Fixed by #1864
Labels
discussion Meta: Feature discussions editor Component: Editor enhancement Request: New feature or improvement next release Note: Features planned for next release

Comments

@tmarplatt
Copy link
Contributor

tmarplatt commented Mar 22, 2024

The problem

In written Spanish we use em dashes as a double symbol to enclose parenthetical narrator breaks in the middle of a dialogue paragraph (among other possible uses).

To illustrate with a ”continuation quote” using Spanish punctuation:

»Oh, a wizard, yeah, I knew that already. —Harry pulled a wand out of thin air, to the astonishment of Hagrid—. And you have trespassed my uncle's home, so I better teach you a lesson, or two».

novelWriter currently does not support narrator breaks. What this means in the example above is the entire paragraph will be highlighted in colour (provided continuation quotes have been configured in place of regular quotes), highlighting the narrator break as if it was spoken dialogue too.

In an equivalent English paragraph, such break would be rendered in neutral text colour. The English rule is to close quotes before breaks, as opposed to using parenthetical symbols, so the problem is absent.

The solution

  • Allow users to configure narrator break enclosing symbols. These should escape colour coding within a quoted text section.
  • Also allow configuring open-ended narrator breaks (without a closing symbol).
@vkbo
Copy link
Owner

vkbo commented Mar 22, 2024

The highlighting is done via RegEx. RegEx is not very good at nested processing, but a possible solution would be to reset the text colour of text wrapped in — after quote highlighting is performed. I can test to see what's possible here. As long the dash isn't used in other ways in the same text, it should be fine.

@vkbo
Copy link
Owner

vkbo commented Mar 22, 2024

Played around with it a little. It is quite easy to achieve.

image

Question: Does the second line, with added space padding, qualify according to this rule, or not?

For future reference, this worked when injected after the dialogue highlighting, but before further highlight rules:

# Narrator Break
self._hRules.append((
    "(—\\b)(.*?)(\\b—)", {
        0: self._hStyles["text"],
    }
))

@vkbo vkbo added discussion Meta: Feature discussions editor Component: Editor labels Mar 22, 2024
@tmarplatt
Copy link
Contributor Author

Question: Does the second line, with added space padding, qualify according to this rule, or not?

If you're asking in terms of Spanish punctuation rules, then no: em dashes must not add padding when enclosing a parenthetical text section.

But if you're thinking of “catch all” narrator-break un-highlighting then yes, by all means.

@vkbo
Copy link
Owner

vkbo commented Mar 22, 2024

But if you're thinking of “catch all” narrator-break un-highlighting then yes, by all means.

I think a first implementation should be with Spanish rules, and allowing spaces can be added if needed. I don't want to add it by default as you can have pauses within the text like this, but with either no spaces at all, or spaces on either side. Keeping the Spanish rule will ignore both those cases.

@vkbo vkbo added this to the Release 2.5 Beta 1 milestone Apr 9, 2024
@vkbo vkbo added the next release Note: Features planned for next release label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Meta: Feature discussions editor Component: Editor enhancement Request: New feature or improvement next release Note: Features planned for next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants