Change needed in processing verse numbers - digit count

I’m building a song book with SAB. This is the first time I’ve noticed the styles that allow you to have different indents for poetry with or without verse numbers, and if it is a one- or two-digit verse number:
image

Nice! Unfortunately, if I put a period after a verse number (to provide a little more separation), that gets counted as a character in the verse number.

\q1 \v 2. Sində-je kàrè dꞋuwə ta-dé (x2)
\q1 \v 3. Bato-je kàrè dꞋuwə ta-dé (x2)

Those get counted as two-digit verse numbers. Could SAB just match the number at the beginning of the verse number, for counting the number of digits?

Alternatively, is there a way to get the CSS ::after element to work with SAB styles, so that I could specify to add “.” at the end of the span? Then I could leave the verse numbers as only numbers.

I tested in 8.5. It has three types of markup.

  1. \q-v 2 verse text and also \q-vv 33 verse text without and with a period after the number
  2. \q-v \v 2 verse text and also \q-vv \v 33. verse text without and with a period after the number
  3. \q \v 2 verse text with period.

The third one should match what you see with your markup.

None exactly match @jeff_heath markup.

Here is the SFM:

\s song using q-v or q-vv markup no v
\b
\q-v 2 Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\q-v 3. Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\q-vv 33. Bato-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\s2 Song using q-v or q-vv before v
\q-v \v 2 Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\q-v \v 3. Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\q-vv \v 33. Bato-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\s2 Song using USFM markup
\q \v 2. Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\b
\q \v 33. Bato-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)
\q Sində-je kàrè dꞋuwə ta-dé (x2)

And the output:

I am not following your statement: “Nice! Unfortunately, if I put a period after a verse number (to provide a little more separation), that gets counted as a character in the verse number.”

I did try and make a style `.v::after {content:".’} I had to do that in the .appdef but it did not work. Some things in SAB are controlled by programming rather than CSS. Chapters and Verse numbers have many controls so have programming behind them.

So which output is closest to what you want?

I believe the styles are applied so that any verse numbers found can be put into the margin, like this:
image
Because there are 3 different styles, \q1’s that have no verse number can have a different indent to \q1’s that have a one-digit verse number and a two-digit verse number. So I can outdent two-digit verse numbers a bit more and make them line up better with the one-digit verse numbers, or no verse numbers, as seen above.

My “Unfortunately” is because a verse number of “9.” (i.e. with a period) is treated as a two-digit verse number. That means there is no outdent difference between “9.” and “10.”, and things don’t line up as nicely. If I don’t include a period after the verse number, then I can get things to work out nicely, as seen above, but there isn’t very much separation between the verse number and the text.

So what I’m asking for is a bug fix for processing of verse numbers to determine how many digits they are. I think the algorithm should only count the digits in the verse number, not any other characters that appear afterwards. In other words instead of just finding the length of the verse number field, search first for “^\d+” and return the length of that to determine which style to use.

Hope that’s clearer…

Your explanation is clear, I get/see what you mean.

Styles are linked to SFM markup everywhere else, so I’d be surprised if this is different. @richard can you clarify?

Without a period, the numbers are lining up as you want with standard USFM. So I suspect they are being programmatically handled not styled directly. The period messes up that number arrangement. I still think it is unrelated to the div.q-v style.

Yes, we decide programmatically whether to use q-v, q-vv or q-vvv styles depending on the number of digits in the verse number, in order to line them up in Bible poetry. This is not a bug, since USFM does not expect to find a period in the \v verse number.

I don’t think we intended for \v markers to be used in song books. Perhaps you could use user-defined styles to handle this situation?

If I did this, I wouldn’t get the benefit of the programmatic choice for which style to use, since your magic only happens on verse numbers… :slight_smile:

Verse numbers work quite nicely to format song books, especially with this style-choice feature based on the number of digits in the verse number. But it would be nice to have a period or other divider (like “/”) after the verse number. It may not be exactly a bug (since the verse number field is not following the USFM standard), but if I have a verse number of “1.”, it’s unfortunate that SAB uses the q-vv style, since the number is only one digit. What I’m asking you to consider is before deciding which style to use, just do a RegEx match of “^\d+” on the verse number field and use the length of that match rather than the entire length of the verse number field to decide the style to use.

Alternatively, is there any way to get the CSS ::after element to kick in, so that I could tell the verse number to put a period or other character after the verse number?