I would use paragraph numbering, then maybe a Find/Change query to apply the paragraph styles. Something like this:
1. Create a paragraph style, named e.g. chapter and verse. Enable paragraph numbering, set the level to 2, and use ^1.^#.^t as the number.
2. Apply this paragraph style to all lines that start with a chapter or a verse number.
You'll see that everything is now numbered as if you had just one chapter. That's because the chapter number changes only if you insert a paragraph of level 1. You don't use those, but you have to have them, so you insert them and you hide them:
3. Create a paragraph style, named e.g. chapter. Enable paragraph numbering, set the level to 1, use ^1 as the number string. Set the leading to 0 and the character colour to None.
4. Insert a blank line before all paragraphs that start with a, and apply the chapter paragraph style to those blank lines. Two simple grep replacements do the job:
a. Find what: (?<=\r)a
b. Replace with: @@@@\ra
a. Find what: @@@@
b. Replace with: <nothing>
c. Change format: par. style chapter
That's a clever solution. Didn't realize you could use numbered lists like that.
Is there a way to "apply" this formatting so that the numbers are a real part of the text?
The only thing I can think of is to convert the numbers to text. In the UI you'd use Type > Bulleted and numbered lists > Convert . . . to text. In a script you would use the paragraph's bulletsAndNumberingResultText property.