Better handling of optional line breaks

According to the USFM Reference manual v2.4 (p. 59), “//” is used as a “Discretionary (optional) line break. Primarily used in poetic text, but could also be used for marking optional breaks for titles, headings, or table cell content breaks. … E.g. \s1 Jesus Heals a Man // Who Could Not Walk”

As of now, SAB just passes those marks through, and they don’t look very pretty in the middle of section headings. I would suggest that they just be removed, since the actual place that the line will break will vary widely between different devices, and a line break suggestion probably doesn’t make a lot of sense. A RegEx that can remove them could be something like this:
find: “\s*//\s*”
replace: " " (single space)

1 Like

So your source text has the “//” line breaks in the text? You can use the Changes node to do the replacements yourself using the RegEx you recommended.

I will ask Richard about this.

Chris

Yes, I realize that I could do the replacements myself using the Changes tab, but if this sequence is defined in the USFM standard, it just seemed like it would be better for SAB to handle these replacements itself, and not to rely on the user to remember that those “//” optional line breaks are in the text and that they need to be replaced. Besides, I think the change in SAB should be trivial, probably making the replacements right at the point the text is loaded? Or maybe leaving the “//” breaks in the text but if they are present automatically adding an appropriate rule to the Changes tab? Thanks for considering it.

Apparently the // is not ‘respected’ or ‘recognised’ in SAB … but why actually because this possibility of having a line break in a title or heading would be interesting for us.

\s1 The creation // of heaven and earth

It would nice if it came out in the APP as:

The creation
of heaven and earth

more important however for long titles … is this feature still under consideration or is it rejected?

I remember that there has also been mention of “br/” (bracketed) for a line break in a footnote but we have never been able to find out if this is really supposed to work and if yes, can somebody give a small example of how the code should look like?
The same for “hr/” (bracketed) the horizontal line …? See release notes SAB 3.3 …

(I see this topic is 3 years old, but I don’t want to create a new one)

I would really like to use the line break marker “//” in table cell (the table is in in Bible module), but it is not working for me. It doesn’t show up as character in the SAB app, but also doesn’t affect the line.

I don’t understand quite well is this marker supported for SAB or no? I will appreciate advise. Thanks!

By the way “~” - the no-break marker works just fine.

Well, if the “//” is removed in your text but doesn’t affect where the line breaks, then apparently the developers implemented my initial request. I think is good, because at build time you have no idea how the text is going to be presented on the device.

Take the example I gave initially: “\s1 Jesus Heals a Man // Who Could Not Walk”. Consider if the text and screen size work out so that “Jesus Heals a” can just fit onto one line. If SAB paid attention to your “//” markers, then the next line would read only “Man”, and the next line would probably be “Who Could Not”, followed by another single word on a line, “Walk”. Ugly! The “//” markers are great when you are typesetting to a format with a known page/column width, but since SAB is publishing to a dynamic media (you can just flip your phone on its side to completely change the formatting!) the “//” markers should just be deleted by SAB (which it appears it does), or if not, you should put in a Change to remove them.

Publishing Assistant ( PA ) converts these to soft-Enters (line breaks) for print.
There is no such thing as a discretionary break since a line would break at any of the spaces.

If you want to force a line break as PA does you will need to add a regex in Changes to replace with either

Find Replace
//\s* <br>
//\s* \n

I find SAB’s Changes doesn’t like finding end-of-lines (EOL)* so this will need testing.

*To find to the next line, I use
[^\r\n]+\s*
1 or more characters that are not EOL characters followed by any amount of space characters (EOL characters are also space characters).

I understand! Thank you Jeff!
I wanted to use the line break marker for list of Bible references in table sell - each on a single line without semicolons.

Thank you @Greg I’m very new here and it looks like I’ll need to do some reading about SAB Changes. I will really appreciate if you or @jeff_heath help me with a link.

I really don’t know what is this. Can you please help me get what you are saying.

Meanwhile I found out that the Changes are under the Book collection adjustment :sunny: and I tried your suggestions for Find/Replace. The \n acts as // (no effect) and < br > (without the extra spaces) shows up in the text:

Thanks!

It would help if you could show us a bit of your initial text, and a screen shot of the Changes that you are trying to do. If you want to force line breaks always where there is “//”, then I think a change which replaces “//” with “\n” should probably work. If not, try replacing with “\r\n”.

1 Like

Sure:



The above screenshots are made with this setting in Changes:


“\n” does the same.

I found RegexBuddy’s help very useful.
Also, it is a very powerful program to help test out regular expressions (and put the to use).

Just bare in mind that there are different flavours of Regex. Therefore I had to make an unusual regex to get EOL characters. Usually I would find [^\r\n]+\r\n
Why do I keep bringing up EOL?
It’s just an example of a piece of regex I use regularly.
So that I could find something, then find the rest of the line until the next line. The I can find something else on the next line e.g. \v.

1 Like

Replacing //\s* with \r or \r\n doesn’t work because it just adds a line break in the Paratext code/markup which will just convert to/function as a space.

Replacing //\s* with <br> is getting converted to &lt;br> which is why it is displaying as <br> instead of being interpreted as a line break. This is probably because some languages/translations use < as a quotation mark and this should not be interpreted as the beginning of an HTML tag.

Something for the devs to look at. i.e. How to insert a line break (not paragraph break) in the text?

Sorry for leading you astray, and thanks to @GregAshleyCooper for reminding us that we are in the HTML world when we are dealing with the text. That’s why the manual line breaks are ignored - all white space is lumped together as a single space. I can see why the SAB code would normally replace “<” with “<” in the text, as normally the “less than” sign is the beginning of an HTML tag. (The “>” is left alone because if there isn’t an opening bracket, the closing bracket is just treated as text in HTML.)

From my tests, the “//” characters seem to be removed automatically from the text - something that I requested a while back. I’m wondering if they actually get removed before the Changes are applied?

One other thing you could try… In the USFM world, \b is used to produce a blank line / spacing. Any chance that putting it in the text would help your cause?

I think we do need some input from the developers. Specifically:

  • Are “//” characters removed automatically from the text, and if so, before Changes are applied?
  • Is there a way to force a manual line break (i.e. <br>) in the text?

It would be good to have a code e.g. [br] or [lb]
but then again, we have //.

Maybe just a setting to …

Discretionary line breaks (//):
[ ] Ignore
[ ] Remove
[ ] Add line break (<br/>)